Gradient needs fixing

Found a way to make the numpy.gradient function work. It does however
make the solution look worse than it did before. Look at the last
definition of the gradient to see what went wrong or somthing I don't
fukcing care anymore.