numpy.polynomial.hermite_e.hermefromroots#

polynomial.hermite_e.hermefromroots(roots)[源代码]#

生成具有给定根的 HermiteE 级数。

该函数返回

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

以 HermiteE 形式表示,其中 \(r_n\) 是在 roots 中指定的根。如果一个零点具有 n 重,则它必须在 roots 中出现 n 次。例如,如果 2 是一个三重复,3 是一个二重复,则 roots 看起来像 [2, 2, 2, 3, 3]。根可以按任意顺序出现。

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

\[p(x) = c_0 + c_1 * He_1(x) + ... + c_n * He_n(x)\]

对于 HermiteE 形式的单项多项式,最后一项的系数通常不为 1。

参数:
rootsarray_like

包含根的序列。

返回:
outndarray

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

示例

>>> from numpy.polynomial.hermite_e import hermefromroots, hermeval
>>> coef = hermefromroots((-1, 0, 1))
>>> hermeval((-1, 0, 1), coef)
array([0., 0., 0.])
>>> coef = hermefromroots((-1j, 1j))
>>> hermeval((-1j, 1j), coef)
array([0.+0.j, 0.+0.j])