numpy.polynomial.hermite.hermfromroots#
- polynomial.hermite.hermfromroots(roots)[source]#
產生具有給定根的 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])