Difference between curve_fit and lesssq in python from scipy.optimize

I have a function containing: Independent variable X, Dependent variable Y
Two fixed parameters a and b.

Using identical experimental data, the curve_fit and leastsq can be set to a function with similar results.

Using curve_fit I have: [ 2.50110215e-04 , 7.80730380e-05] for fixed parameters a and b.

Using leastsq , I: [ 2.50110267e-04 , 7.80730843e-05] for fixed parameters a and b.

I would like to know if there are any differences in both of them, if so, what are the situations in which I should use curve_fit and in which situation should I use leastsq ?

+6
source share
1 answer

curve-fit uses leastsq to calculate, so they should always give the same result. The slight difference you see there is probably the result of a rounding error. a leastsq call should fix this immediately.

From the curve_fit docs :

The algorithm uses the Levenberg-Marquardt algorithm through the smallest number. Additional keyword arguments are passed directly to this algorithm.

+5
source

All Articles