[SciPy-User] Optimize.Leastsq Issues

Pauli Virtanen pav at iki.fi
Fri Aug 9 08:26:40 EDT 2013


09.08.2013 10:03, Suraj Mirpuri kirjoitti:> Hello All,
[clip]
 > I think I've been having some difficulty with optimize.leastsq the
 > past  few hours because for the life of me I cannot seem to get it to
 > work.

The bug is in your own code: your resid() function always returns the 
same result:

 >>> print(randomtest.resid(numpy.array([  60.,   180.,    22.,    22., 
     0.2]), [randomtest.sorted_list]))
[  1.9845187   32.64266682  26.29888414 -16.90617247  -5.73287752
   -0.58050037   2.75023576]

 >>> print(randomtest.resid(numpy.array([  6.,   18.,    2.,    2., 
0.]), [randomtest.sorted_list]))
[  1.9845187   32.64266682  26.29888414 -16.90617247  -5.73287752
   -0.58050037   2.75023576]





More information about the SciPy-User mailing list