numpy.polynomial.chebyshev.chebfromroots#

polynomial.chebyshev.chebfromroots(roots)[源]#

生成具有给定根的切比雪夫级数。

该函数返回

\[p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),\]

以切比雪夫形式表示,其中 \(r_n\) 是在 roots 中指定的根。如果一个零点具有 n 重性,则它必须在 roots 中出现 n 次。例如,如果 2 是一个三重复根,3 是一个二重复根,则 roots 的外观类似于 [2, 2, 2, 3, 3]。根可以按任意顺序出现。

如果返回的系数是 c,那么

\[p(x) = c_0 + c_1 * T_1(x) + ... + c_n * T_n(x)\]

对于切比雪夫形式中的首项系数为 1 的多项式,最后一个项的系数通常不为 1。

参数:
rootsarray_like

包含根的序列。

返回:
outndarray

一维系数数组。如果所有根都是实数,则 out 是一个实数数组;如果一些根是复数,则 out 是复数数组,即使结果中的所有系数都是实数(请参阅下面的示例)。

示例

>>> import numpy.polynomial.chebyshev as C
>>> C.chebfromroots((-1,0,1)) # x^3 - x relative to the standard basis
array([ 0.  , -0.25,  0.  ,  0.25])
>>> j = complex(0,1)
>>> C.chebfromroots((-j,j)) # x^2 + 1 relative to the standard basis
array([1.5+0.j, 0. +0.j, 0.5+0.j])