Code

And now gradients should be (almost) perfect... The gradient vector is set up to...