[SciPy-user] Another leastsq Jacobian bug
Christian K
ckkart at hoc.net
Mon Jun 25 23:33:35 EDT 2007
Lin Shao wrote:
>>> ## Now define my Jacobian
>>> def Jacobian(params,xx,yy,mode='col'):
>>> J = N.empty((len(params),xx.size))
>>> J[0] = (xx-params[1])**2
>>> J[1] = -2*params[0]*(xx-params[1])
>> shouldn't that be -2*params[0]*(xx-params[1])*params[1] ?
>
> I think I was right. Think about what's the derivative of -x^2 -- it's -2x
you forgot about the chain rule .
Christian
More information about the SciPy-User
mailing list