[SciPy-user] Optimization Working only with a Specific Expression of the input Parameters

Lorenzo Isella lorenzo.isella@gmail....
Fri Mar 2 07:25:29 CST 2007

Dear All,
I was trying to fit some data using the leastsq package in
scipy.optimize. The function I would like to use to fit my data is:


 where A1, mu1 and myvar1 are fitting parameters.
For some reason, I used to get an error message from scipy.optimize
telling me that I was not working with an array of floats.
I suppose that this is due to the fact that the optimizer also tries
solving for negative values of mu1 and myvar1, for which the log
function (x is always positive) does not exist.
In fact, if I use the fitting function:


Where mu1 and myvar1 appear squared, then the problem does not exist
any longer and the results are absolutely ok.
Can anyone enlighten me here and confirm this is what is really going on?
Kind Regards


More information about the SciPy-user mailing list