numpy.polynomial.hermite.hermfromroots#

polynomial.hermite.hermfromroots(roots)[源代码]#

生成具有给定根的 Hermite 级数.

该函数返回多项式的系数

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

以 Hermite 形式,其中 \(r_n\) 是在 roots 中指定的根.如果一个零点具有重数 n,那么它必须在 roots 中出现 n 次.例如,如果 2 是一个重数为 3 的根,3 是一个重数为 2 的根,那么 roots 看起来像 [2, 2, 2, 3, 3].根可以以任何顺序出现.

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

\[p(x) = c_0 + c_1 * H_1(x) + ... + c_n * H_n(x)\]

对于 Hermite 形式的 monic 多项式,最后一项的系数通常不是 1.

参数:
rootsarray_like

包含根的序列.

返回:
outndarray

系数的 1-D 数组.如果所有根都是实数,那么 out 是一个实数数组,如果某些根是复数,那么即使结果中的所有系数都是实数, out 也是复数(参见下面的例子).

示例

>>> from numpy.polynomial.hermite import hermfromroots, hermval
>>> coef = hermfromroots((-1, 0, 1))
>>> hermval((-1, 0, 1), coef)
array([0.,  0.,  0.])
>>> coef = hermfromroots((-1j, 1j))
>>> hermval((-1j, 1j), coef)
array([0.+0.j, 0.+0.j])