Python| Numpy np.hermvander3d() 方法
借助np.hermvander3d()
方法,我们可以使用np.hermvander3d()
方法从给定度数的 Hermite 级数中得到 3-D 伪范德蒙矩阵。
Syntax : np.hermvander3d(x, y, z, deg)
Return : Return the 3-D pseudo vandermonde matrix of given degree.
示例 #1:
在这个例子中我们可以看到,通过使用np.hermvander3d()
方法,我们可以通过这个方法得到 Hermite 级数的 3-D 伪范德蒙矩阵。
# import numpy and hermvander3d
import numpy as np
from numpy.polynomial.hermite import hermvander3d
x = np.array([1, 2])
y = np.array([-1, -2])
z = np.array([1, -2])
x_deg, y_deg, z_deg = 2, 2, 2
# using np.hermvander3d() method
gfg = hermvander3d(x, y, z, [x_deg, y_deg, z_deg])
print(gfg)
输出 :
[[ 1.000e+00 2.000e+00 2.000e+00 -2.000e+00 -4.000e+00 -4.000e+00
2.000e+00 4.000e+00 4.000e+00 2.000e+00 4.000e+00 4.000e+00
-4.000e+00 -8.000e+00 -8.000e+00 4.000e+00 8.000e+00 8.000e+00
2.000e+00 4.000e+00 4.000e+00 -4.000e+00 -8.000e+00 -8.000e+00
4.000e+00 8.000e+00 8.000e+00]
[ 1.000e+00 -4.000e+00 1.400e+01 -4.000e+00 1.600e+01 -5.600e+01
1.400e+01 -5.600e+01 1.960e+02 4.000e+00 -1.600e+01 5.600e+01
-1.600e+01 6.400e+01 -2.240e+02 5.600e+01 -2.240e+02 7.840e+02
1.400e+01 -5.600e+01 1.960e+02 -5.600e+01 2.240e+02 -7.840e+02
1.960e+02 -7.840e+02 2.744e+03]]
示例 #2:
# import numpy and hermvander3d
import numpy as np
from numpy.polynomial.hermite import hermvander3d
x = np.array([0.5, 0.10, 0.10, 0.5])
y = np.array([1, 2, 3, 5])
z = np.array([10.1, 20.2, 30.3, -50])
x_deg, y_deg, z_deg = 1, 1, 1
# using np.hermvander3d() method
gfg = hermvander3d(x, y, z, [x_deg, y_deg, z_deg])
print(gfg)
输出 :
[[ 1.000e+00 2.020e+01 2.000e+00 4.040e+01 1.000e+00 2.020e+01
2.000e+00 4.040e+01]
[ 1.000e+00 4.040e+01 4.000e+00 1.616e+02 2.000e-01 8.080e+00
8.000e-01 3.232e+01]
[ 1.000e+00 6.060e+01 6.000e+00 3.636e+02 2.000e-01 1.212e+01
1.200e+00 7.272e+01]
[ 1.000e+00 -1.000e+02 1.000e+01 -1.000e+03 1.000e+00 -1.000e+02
1.000e+01 -1.000e+03]]