The Jacobian was derived according to the chi2 function.
The key point was to evaluate the two derivative arrays for all times points, and
and then sum each of the two arrays together, before constructing the Jacobian.
This clearly shows the difference between minfx and scipy.optimize.leastsq.
scipy.optimize.leastsq takes as input a function F(x0), which should return the array
of weighted differences between function value and measured values:
" 1. / self.errors * (self.calc_exp(self.times, *params) - self.values) "
This will be an array with number of elements 'i' corresponding to number of elements.
scipy.optimize.leastsq then internally evaluates the sum of squares -> sum[ (O - E)**2 ],
and minimises this. This is the chi2.
Minfx requires the function to minimise before hand.
So, the "func" should be chi2.
Then the dfunc, and d2func, should be derivative of chi2, bum all elements in the array should
still be summed together.
task #7822(https://gna.org/task/index.php?7822): Implement user function to estimate R2eff and associated errors for exponential curve fitting.