improvements for the nle solver

Now analytical calculation of the gradient