bundles / numpy latest / numpy / polyder
_ArrayFunctionDispatcher
numpy:polyder
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_polynomial_impl.py:375
Signature
def polyder(p, m = 1)Summary
Return the derivative of the specified order of a polynomial.
Extended Summary
Parameters
p: poly1d or sequencePolynomial to differentiate. A sequence is interpreted as polynomial coefficients, see poly1d.
m: int, optionalOrder of differentiation (default: 1)
Returns
der: poly1dA new polynomial representing the derivative.
Examples
The derivative of the polynomial :math:`x^3 + x^2 + x^1 + 1` is:import numpy as np
✓p = np.poly1d([1,1,1,1]) p2 = np.polyder(p) p2✓
poly1d([3, 2, 1])which evaluates to:
p2(2.)
✗np.float64(17.0)We can verify this, approximating the derivative with ``(f(x + h) - f(x))/h``:
(p(2. + 0.001) - p(2.)) / 0.001
✗np.float64(17.007000999997857)The fourth-order derivative of a 3rd-order polynomial is zero:
np.polyder(p, 2) np.polyder(p, 3) np.polyder(p, 4)✓
poly1d([0])
See also
Aliases
numpy.polyder