[SciPy-user] Another leastsq Jacobian bug
Lin Shao
shao at msg.ucsf.edu
Tue Jun 26 12:47:43 EDT 2007
No I didn't. The simplest refute to your answer is that your J[1] is
-2*params[0]*(xx*params[1]-params[1]^2). How could there be a term
with params[1]'s quadratic in the derivative if the original function
is a quadratic function?
On 6/25/07, Christian K <ckkart at hoc.net> wrote:
> 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
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list