# [SciPy-user] Derivative() usage?

Robert Kern rkern at ucsd.edu
Wed Nov 3 12:53:59 CST 2004

```Giovanni Samaey wrote:
>
>>
>> 'n' as in d^n/dx^n .
>>
>> Somewhat confusingly, 'N' is being used in the docstring as a synonym
>> for 'order' and is the number of discrete points used to evaluate the
>> numerical derivative. I'm going to fix that.
>>
>> For example, when n=2, and order=3, one is computing the second
>> central derivative using 3 points [x0-dx, x0, x0+dx].
>
>
> Normally, one would expect "order" to be an indication of the accuracy
> of the derivative.  So, order=p should mean
> d^n/dx^n (exact answer) - (what's computed) = O(dx^p) where dx is the
> mesh spacing.
> Clearly, with three points for the second derivative, the order is only
> two, so this is clearly not a mathematically correct use of the word
> "order"...

Not really. "Order" is an incredibly overloaded word in this area. Its
usage here is one of several acceptable ones. "numpoints" may be
clearer, though.

--
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

```