numpy.polynomial.hermite.hermvander#

polynomial.hermite.hermvander(x, deg)[原始碼]#

給定次數的偽范德蒙矩陣。

傳回次數為 deg 和樣本點 x 的偽范德蒙矩陣。偽范德蒙矩陣定義為

\[V[..., i] = H_i(x),\]

其中 0 <= i <= degV 的前導索引為 x 的元素索引,最後一個索引是厄米特多項式的次數。

如果 c 是一個長度為 n + 1 的 1-D 係數陣列,且 V 是陣列 V = hermvander(x, n),則 np.dot(V, c)hermval(x, c) 在捨入誤差內是相同的。此等效性對於最小平方擬合以及評估相同次數和樣本點的大量厄米特級數都很有用。

參數:
xarray_like

點陣列。dtype 會轉換為 float64 或 complex128,取決於是否有任何元素是複數。如果 x 是純量,則會轉換為 1-D 陣列。

degint

結果矩陣的次數。

傳回:
vanderndarray

偽范德蒙矩陣。傳回矩陣的形狀為 x.shape + (deg + 1,),其中最後一個索引是相應厄米特多項式的次數。dtype 將與轉換後的 x 相同。

範例

>>> import numpy as np
>>> from numpy.polynomial.hermite import hermvander
>>> x = np.array([-1, 0, 1])
>>> hermvander(x, 3)
array([[ 1., -2.,  2.,  4.],
       [ 1.,  0., -2., -0.],
       [ 1.,  2.,  2., -4.]])