New gradient calculation

Replaced my gradient calculator with the one supplied by minFunc