[SciPy-user] Re: optimize.leastsq -> fjac and the covariance redux

Stephen Walton stephen.walton at csun.edu
Mon Mar 14 18:59:29 CST 2005

Travis Oliphant wrote:

> I made the change and now when using full_output for leastsq, the 
> covariance matrix is returned (as a separate output).

I tested it against Brendan's original script after making a couple of 
changes:  at line 34 the call to y() needs to be evalY();  add the 
additional argument to the list of output arguments from leastsq; and 
add "epsfcn=0.0001" to the calling sequence of leastsq.  This last is 
needed because otherwise the delta value for the numeric Jacobian is 
chosen too small for single precision arithmetic.

Once that's done, the values of C_true, C_true2, and the new output from 
leastsq agree to within roundoff error, I believe.

More information about the SciPy-user mailing list