[SciPy-user] Derivative() usage?
Travis Oliphant
oliphant at ee.byu.edu
Thu Oct 21 12:59:14 EDT 2004
Francesc Alted wrote:
>Hi,
>
>I'm trying to figure out how to compute the derivatives of a function with
>scipy, but the documentation is a bit terse for me:
>
>def derivative(func,x0,dx=1.0,n=1,args=(),order=3):
> """Given a function, use an N-point central differenece
> formula with spacing dx to compute the nth derivative at
> x0, where N is the value of order and must be odd.
>
> Warning: Decreasing the step size too small can result in
> round-off error.
> """
>
>I would like to compute a derivative of an arbitrary order, but by reading
>the docs, I'm not sure what the n and order parameters exactly means.
>
>
>
n is the derivative you are computing and
order is the order of the central difference approximateion formula you
will use to approximate it (i.e. how many sample values of func will be
used)
order should probably default to n+2 or something rather than only
three all the time. But suggestions are welcome.
-Travis O.
More information about the SciPy-User
mailing list