Homework 4 for Computational Physics course