numpy.polynomial.hermite_e.hermevander#
- polynomial.hermite_e.hermevander(x, deg)[原始碼]#
給定次數的偽范德蒙矩陣。
傳回給定次數 deg 和樣本點 x 的偽范德蒙矩陣。偽范德蒙矩陣定義為
\[V[..., i] = He_i(x),\]其中
0 <= i <= deg
。 V 的前導索引為 x 的元素索引,而最後一個索引是 HermiteE 多項式的次數。如果 c 是一個長度為
n + 1
的一維係數陣列,且 V 是陣列V = hermevander(x, n)
,則np.dot(V, c)
和hermeval(x, c)
在四捨五入誤差內是相同的。此等價性對於最小平方擬合以及評估相同次數和樣本點的大量 HermiteE 級數都很有用。- 參數:
- xarray_like
點的陣列。dtype 會轉換為 float64 或 complex128,取決於是否有任何元素是複數。如果 x 是純量,則會轉換為一維陣列。
- degint
結果矩陣的次數。
- 傳回值:
- vanderndarray
偽范德蒙矩陣。傳回矩陣的形狀為
x.shape + (deg + 1,)
,其中最後一個索引是相應 HermiteE 多項式的次數。dtype 將與轉換後的 x 相同。
範例
>>> import numpy as np >>> from numpy.polynomial.hermite_e import hermevander >>> x = np.array([-1, 0, 1]) >>> hermevander(x, 3) array([[ 1., -1., 0., 2.], [ 1., 0., -1., -0.], [ 1., 1., 0., -2.]])