numpy.polynomial.polynomial.polyder

numpy.polynomial.polynomial.polyder(cs, m=1, scl=1)

Differentiate a polynomial.

Returns the polynomial cs differentiated m times. At each iteration the result is multiplied by scl (the scaling factor is for use in a linear change of variable). The argument cs is the sequence of coefficients from lowest order term to highest, e.g., [1,2,3] represents the polynomial 1 + 2*x + 3*x**2.

Parameters :

cs: array_like :

1-d array of polynomial coefficients ordered from low to high.

m : int, optional

Number of derivatives taken, must be non-negative. (Default: 1)

scl : scalar, optional

Each differentiation is multiplied by scl. The end result is multiplication by scl**m. This is for use in a linear change of variable. (Default: 1)

Returns :

der : ndarray

Polynomial of the derivative.

See also

polyint

Examples

>>> from numpy import polynomial as P
>>> cs = (1,2,3,4) # 1 + 2x + 3x**2 + 4x**3
>>> P.polyder(cs) # (d/dx)(cs) = 2 + 6x + 12x**2
array([  2.,   6.,  12.])
>>> P.polyder(cs,3) # (d**3/dx**3)(cs) = 24
array([ 24.])
>>> P.polyder(cs,scl=-1) # (d/d(-x))(cs) = -2 - 6x - 12x**2
array([ -2.,  -6., -12.])
>>> P.polyder(cs,2,-1) # (d**2/d(-x)**2)(cs) = 6 + 24x
array([  6.,  24.])

Next topic

numpy.polynomial.polynomial.polyint

This Page