def polyder(p, m=<NUM_LIT:1>):
m = int(m)<EOL>if m < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>truepoly = isinstance(p, poly1d)<EOL>p = NX.asarray(p)<EOL>n = len(p) - <NUM_LIT:1><EOL>y = p[:-<NUM_LIT:1>] * NX.arange(n, <NUM_LIT:0>, -<NUM_LIT:1>)<EOL>if m == <NUM_LIT:0>:<EOL><INDENT>val = p<EOL><DEDENT>else:<EOL><INDENT>val = polyder(y, m - <NUM_LIT:1>)<EOL><DEDENT>if truepoly:<EOL><INDENT>val = poly1d(val)<EOL><DEDENT>return val<EOL>
Return the derivative of the specified order of a polynomial.

Parameters
----------
p : poly1d or sequence
    Polynomial to differentiate.
    A sequence is interpreted as polynomial coefficients, see `poly1d`.
m : int, optional
    Order of differentiation (default: 1)

Returns
-------
der : poly1d
    A new polynomial representing the derivative.

See Also
--------
polyint : Anti-derivative of a polynomial.
poly1d : Class for one-dimensional polynomials.

Examples
--------
The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is:

>>> p = np.poly1d([1,1,1,1])
>>> p2 = np.polyder(p)
>>> p2
poly1d([3, 2, 1])

which evaluates to:

>>> p2(2.)
17.0

We can verify this, approximating the derivative with
``(f(x + h) - f(x))/h``:

>>> (p(2. + 0.001) - p(2.)) / 0.001
17.007000999997857

The fourth-order derivative of a 3rd-order polynomial is zero:

>>> np.polyder(p, 2)
poly1d([6, 2])
>>> np.polyder(p, 3)
poly1d([6])
>>> np.polyder(p, 4)
poly1d([ 0.])