Solving a differential equation in python with the finite difference method