numpy.polynomial.hermite_e.hermevander#

polynomial.hermite_e.hermevander(x, deg)[源代码]#

给定次数的伪范德蒙矩阵。

返回给定次数 deg 和采样点 x 的伪范德蒙矩阵。伪范德蒙矩阵定义如下:

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

其中 0 <= i <= degV 的前导索引是 x 的元素索引,最后一个索引是 HermiteE 多项式的次数。

如果 c 是长度为 n + 1 的一维系数数组,并且 V 是数组 V = hermevander(x, n),那么 np.dot(V, c)hermeval(x, c) 在舍入误差范围内是相同的。这种等价性对于最小二乘拟合以及对相同次数和采样点的 HermiteE 级数进行大量求值都非常有用。

参数:
x类数组

点数组。根据元素是否为复数,dtype 会被转换为 float64 或 complex128。如果 x 是标量,它将被转换为一维数组。

deg整型

结果矩阵的次数。

返回:
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.]])