numpy.polynomial.polynomial.polyder#

polynomial.polynomial.polyder(c, m=1, scl=1, axis=0)[源]#

对多项式进行求导。

返回沿 axis 求导 m 次的多项式系数 c。在每次迭代中,结果乘以 scl(此比例因子用于线性变量变换)。参数 c 是沿每个轴从低次到高次排列的系数数组,例如,[1,2,3] 表示多项式 1 + 2*x + 3*x**2,而 [[1,2],[1,2]] 表示 1 + 1*x + 2*y + 2*x*y,如果 axis=0 是 x 且 axis=1 是 y

参数:
c类数组

多项式系数数组。如果 c 是多维的,则不同的轴对应不同的变量,每个轴的次数由相应的索引给出。

m整数, 可选

求导的次数,必须是非负数。(默认值: 1)

scl标量, 可选

每次求导都乘以 scl。最终结果是乘以 scl**m。这用于线性变量变换。(默认值: 1)

axis整数, 可选

求导的轴。(默认值: 0)。

返回:
derndarray

导数的多项式系数。

另请参阅

polyint

示例

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