[SciPy-User] Derivative in scipy?
Warren Weckesser
warren.weckesser at enthought.com
Sun Oct 30 13:57:22 EDT 2011
On Sun, Oct 30, 2011 at 12:55 PM, Warren Weckesser <
warren.weckesser at enthought.com> wrote:
>
>
> On Sun, Oct 30, 2011 at 11:03 AM, <josef.pktd at gmail.com> wrote:
>
>> 2011/10/30 François Boulogne <boulogne.f at gmail.com>:
>> >
>> > -----BEGIN PGP SIGNED MESSAGE-----
>> > Hash: SHA1
>> >
>> > Dear all,
>> >
>> > I was wondering if a piece of code has been developped for derivative
>> > calculations, espacially for a sample (array of points) like for
>> > integration:
>> > http://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html with
>> > different methods (right or left first derivatives, second
>> derivatives...)
>> > I didn't succeed in finding this in the documentation. Does it exist? If
>> > not, is it planned by someone?
>>
>> There is one helper function in scipy.optimize
>> (scipy.optimize.optimize), nothing else in scipy.
>>
>
>
> Well, not exactly "nothing else"...
> (eat's email arrived as I was typing this, so it will echo some of what he
> said.)
>
> Functions that operate on a discrete sample:
>
> numpy.diff
> This can be used to compute a derivative by dividing by the appropriate
> power of dx.
>
> numpy.ediff1d
> Like numpy.diff, but strictly for 1D arrays. It also provides the
> option
> for specifying values to append to the ends of the array before
> computing
> the difference.
>
> numpy.gradient
> Return the gradient of an n-d array.
>
> scipy.fftpack.diff
> Derivative of a periodic sequence.
> See http://www.scipy.org/Cookbook/KdV for an example.
>
>
> Functions that operate on a callable function:
>
> scipy.misc.derivative
> Find the n-th derivative of a function at point x0.
>
> scipy.misc.central_difference_weights
> Return weights for an Np-point central derivative
>
Correction: I put this in the wrong list; central_difference_weights is
just a utility function for computing weights (as the name says). It does
not compute derivatives of a callable function.
Warren
> scipy.optimize.approx_fprime
> No docstring (sigh), but from the source code (use approx_fprime?? in
> ipython), it is pretty easy to figure out what it does.
>
>
> Having said that, I think a module specifically for computing derivatives
> (with good docs and tests), as being discussed in the ticket #1510 (
> http://projects.scipy.org/scipy/ticket/1510) would be a nice addition.
>
>
> Warren
>
>
>
>>
>> My standard recommendation for finite differences is numdifftools,
>> it's on pypi. There is a ticket that asks for it's inclusion in scipy,
>> IIRC.
>>
>
>> There are some packages on automatic differentiation.
>>
>> (and we have our own hacked together numdiff in statsmodels, just for
>> optimization and Hessian calculations.)
>>
>> Josef
>>
>>
>> >
>> > Thanks.
>> > Cheers,
>> >
>> > - --
>> > François Boulogne.
>> >
>> > Membre de l'April - Promouvoir et défendre le logiciel libre
>> > http://www.april.org
>> > -----BEGIN PGP SIGNATURE-----
>> > Version: GnuPG v1.4.11 (GNU/Linux)
>> >
>> > iQIcBAEBAgAGBQJOrXHDAAoJEKkn15fZnrRLxbYP/3/NUzU5metNhGc4tw6Uo0mw
>> > kIlAxf1cvtopbJ+JTXrmKkJpyYUI1bMsqVKpPniW073dgPAfAX3Bajymysh5Hgnd
>> > 5+0hh7v8JmsIvKm9HrEePSrENYrIVTfFyvRV+tBLhkfHJ9Vj7uUy7a3/lyRS6s7v
>> > FEItXLhkNYtqEir8h2eZ7uW178mwq6nBl6Zi5UOjOXq7u0SxcnusKkYyiL+CirSN
>> > KafcrU+rUdHw6khE1exj435GMSKx+N3+rV/kDAQWWQc0ncWmdX2Jr7PapT1DQbNN
>> > b3UK2NjYGDZE2NMRuZmRmeTIk2S+PVPqRxEu0x62CS4Y4JnTaZx1xSiPGP0d9cZC
>> > NG4/9h0LFM8rxj/kxYjBakbIs6LhwPnS1ZvYf00o3eaY4+tLGx3UozoLpEWSCOuQ
>> > GrONTWvdUlfVWsd3qOhwCj+NORkz9yXJNqJHulgz6T8fKnMyPL+R80XfRuS1alxj
>> > m166ySHxrPDzwiSlV5vWR/1ajrEMAI/GYev55dtzlIx6hxfLVCOryFei/LNtlrN+
>> > lYK48QqateqvLDs+NUq+7azmCAkc8fW5UeD7bBLdoGwlXvYaOEZh8+lzxU2sc0T4
>> > 93kNZAzOzv/CdcI1uhnp2NP8ODGEyRLx5cUlcKqmF/iAqtM2zc5Zca9YiygR2w83
>> > XQsGdZYw4rkVMnUTk6Ep
>> > =/Nlz
>> > -----END PGP SIGNATURE-----
>> >
>> > _______________________________________________
>> > SciPy-User mailing list
>> > SciPy-User at scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-user
>> >
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111030/fc99a474/attachment.html>
More information about the SciPy-User
mailing list