# [SciPy-User] How to print the jacobian in the output of leastsq function

Charles R Harris charlesr.harris@gmail....
Thu Aug 25 00:04:06 CDT 2011

```On Wed, Aug 24, 2011 at 10:50 PM, <josef.pktd@gmail.com> wrote:

> On Thu, Aug 25, 2011 at 12:11 AM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> >
> >
> > On Tue, Aug 23, 2011 at 9:57 AM, Abraham Zamudio <
> abraham.zamudio@gmail.com>
> > wrote:
> >>
> >> Hi All,
> >>
> >> i use  the leastsq function from module scipy ... but what I want now
> >> is the jacobian matrix of the algorithm ... How should I use this
> >> function to print the Jacobian ??? .
> >>
> >
> > That's tricky, as what is returned is the qr factorization of the
> Jacobian
> > stored in condensed form containing the r part and what I think are the
> > vectors of the Householder reflections that can be used to generate q. In
> > addition, the columns are pivoted. So I think it would take a bit of
> > research and work to recover the Jacobian. Perhaps someone here knows a
> bit
> > more about the specific function used in this function. If you just want
> the
> > covariance of the coefficients, that is easier to get, but note the
> > documentation is incorrect, you need to multiply by the variance, not the
> > standard deviation.
>
> Is it even possible to recover the Jacobian from this?
>
> I never found a way (but I'm not an expert). I gave up and just
> calculate a numerical derivative at the solution.
>
> Since this question shows up regularly it would also be good to have
> an answer if it is a definite NO (or at least not with what the
> underlying function returns).
>
>
I'm pretty sure the Jacobian can be recovered but I'd have to read through
the code to see how.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110824/66ebc6b5/attachment.html
```