[SciPy-user] optimize.leastsq fit errors?

Fernando Perez Fernando.Perez at colorado.edu
Thu Apr 15 17:57:34 CDT 2004


Just a quick note.  Given:

>      n = len(x)

you may want to note that in:

>      SEa = s*math.sqrt( 1/n + mean_x**2/SSxx )

your 1/n term is ==0 for all n>1.  Python's integer division floors.  It won't 
matter much for large n, but still.  You can fix it by using 1.0/n instead.  I 
think all other divisions (like the /(n-2) one) you have are OK, because they 
all use float denominators.

Cheers,

f



More information about the SciPy-user mailing list