[SciPy-user] Estimation of parameters while fitting data

Rob Clewley rob.clewley@gmail....
Wed Apr 2 09:30:19 CDT 2008

Hi Doreen,

>  def residuals(p,y,t):
>     return [V - S(t,p) for i in xrange(len(t))]

Minpack expects an array type to be returned. You're returning a
python list. So try this:

def residuals(p,y,t):
    return array([V - S(t_val,p) for t_val in t])

Here I've also removed the unnecessary i index variable -- Python lets
you iterate directly over the contents of the list t.


Robert H. Clewley, Ph. D.
Assistant Professor
Department of Mathematics and Statistics
Georgia State University
720 COE, 30 Pryor St
Atlanta, GA 30303, USA

tel: 404-413-6420 fax: 404-651-2246

More information about the SciPy-user mailing list