Hermite 다항식과 x, y, z 샘플 포인트의 의사 Vandermonde 행렬을 생성하려면 Python Numpy에서 hermite.hermvander3d()를 사용합니다. 이 메서드는 의사 Vandermondematrix를 반환합니다. 매개변수 x, y, z는 모두 같은 모양의 점 좌표 배열입니다. dtypes는 요소가 복잡한지 여부에 따라 float64 또는 complex128로 변환됩니다. 스칼라는 1차원 배열로 변환됩니다. 매개변수 deg는 [x_deg, y_deg, z_deg] 형식의 최대 각도 목록입니다.
단계
먼저 필요한 라이브러리를 가져옵니다 -
import numpy as np from numpy.polynomial import hermite as H
numpy.array() 메서드를 사용하여 동일한 모양의 점 좌표 배열을 만듭니다. -
x = np.array([1, 2]) y = np.array([3, 4]) z = np.array([5, 6])
배열 표시 -
print("Array1...\n",x)
print("\nArray2...\n",y)
print("\nArray3...\n",z) 데이터 유형 표시 -
print("\nArray1 datatype...\n",x.dtype)
print("\nArray2 datatype...\n",y.dtype)
print("\nArray3 datatype...\n",z.dtype) 두 어레이의 차원을 확인하십시오 -
print("\nDimensions of Array1...\n",x.ndim)
print("\nDimensions of Array2...\n",y.ndim)
print("\nDimensions of Array3...\n",z.ndim) 두 배열의 모양을 확인하십시오 -
print("\nShape of Array1...\n",x.shape)
print("\nShape of Array2...\n",y.shape)
print("\nShape of Array3...\n",z.shape) # Hermite 다항식과 x, y, z 샘플 포인트의 의사 Vandermonde 행렬을 생성하려면 hermite.hermvander3d() -
x_deg, y_deg, z_deg = 2, 3, 4
print("\nResult...\n",H.hermvander3d(x,y,z, [x_deg, y_deg, z_deg])) 예시
import numpy as np
from numpy.polynomial import hermite as H
# Create arrays of point coordinates, all of the same shape using the numpy.array() method
x = np.array([1, 2])
y = np.array([3, 4])
z = np.array([5, 6])
# Display the arrays
print("Array1...\n",x)
print("\nArray2...\n",y)
print("\nArray3...\n",z)
# Display the datatype
print("\nArray1 datatype...\n",x.dtype)
print("\nArray2 datatype...\n",y.dtype)
print("\nArray3 datatype...\n",z.dtype)
# Check the Dimensions of both the arrays
print("\nDimensions of Array1...\n",x.ndim)
print("\nDimensions of Array2...\n",y.ndim)
print("\nDimensions of Array3...\n",z.ndim)
# Check the Shape of both the arrays
print("\nShape of Array1...\n",x.shape)
print("\nShape of Array2...\n",y.shape)
print("\nShape of Array3...\n",z.shape)
# To generate a pseudo Vandermonde matrix of the Hermite polynomial and x, y, z sample points, use the hermite.hermvander3d() in Python Numpy
# The method returns the pseudo-Vandermonde matrix.
x_deg, y_deg, z_deg = 2, 3, 4
print("\nResult...\n",H.hermvander3d(x,y,z, [x_deg, y_deg, z_deg])) 출력
Array1...
[1 2]
Array2...
[3 4]
Array3...
[5 6]
Array1 datatype...
int64
Array2 datatype...
int64
Array3 datatype...
int64
Dimensions of Array1...
1
Dimensions of Array2...
1
Dimensions of Array3...
1
Shape of Array1...
(2,)
Shape of Array2...
(2,)
Shape of Array3...
(2,)
Result...
[[1.0000000e+00 1.0000000e+01 9.8000000e+01 9.4000000e+02 8.8120000e+03
6.0000000e+00 6.0000000e+01 5.8800000e+02 5.6400000e+03 5.2872000e+04
3.4000000e+01 3.4000000e+02 3.3320000e+03 3.1960000e+04 2.9960800e+05
1.8000000e+02 1.8000000e+03 1.7640000e+04 1.6920000e+05 1.5861600e+06
2.0000000e+00 2.0000000e+01 1.9600000e+02 1.8800000e+03 1.7624000e+04
1.2000000e+01 1.2000000e+02 1.1760000e+03 1.1280000e+04 1.0574400e+05
6.8000000e+01 6.8000000e+02 6.6640000e+03 6.3920000e+04 5.9921600e+05
3.6000000e+02 3.6000000e+03 3.5280000e+04 3.3840000e+05 3.1723200e+06
2.0000000e+00 2.0000000e+01 1.9600000e+02 1.8800000e+03 1.7624000e+04
1.2000000e+01 1.2000000e+02 1.1760000e+03 1.1280000e+04 1.0574400e+05
6.8000000e+01 6.8000000e+02 6.6640000e+03 6.3920000e+04 5.9921600e+05
3.6000000e+02 3.6000000e+03 3.5280000e+04 3.3840000e+05 3.1723200e+06]
[1.0000000e+00 1.2000000e+01 1.4200000e+02 1.6560000e+03 1.9020000e+04
8.0000000e+00 9.6000000e+01 1.1360000e+03 1.3248000e+04 1.5216000e+05
6.2000000e+01 7.4400000e+02 8.8040000e+03 1.0267200e+05 1.1792400e+06
4.6400000e+02 5.5680000e+03 6.5888000e+04 7.6838400e+05 8.8252800e+06
4.0000000e+00 4.8000000e+01 5.6800000e+02 6.6240000e+03 7.6080000e+04
3.2000000e+01 3.8400000e+02 4.5440000e+03 5.2992000e+04 6.0864000e+05
2.4800000e+02 2.9760000e+03 3.5216000e+04 4.1068800e+05 4.7169600e+06
1.8560000e+03 2.2272000e+04 2.6355200e+05 3.0735360e+06 3.5301120e+07
1.4000000e+01 1.6800000e+02 1.9880000e+03 2.3184000e+04 2.6628000e+05
1.1200000e+02 1.3440000e+03 1.5904000e+04 1.8547200e+05 2.1302400e+06
8.6800000e+02 1.0416000e+04 1.2325600e+05 1.4374080e+06 1.6509360e+07
6.4960000e+03 7.7952000e+04 9.2243200e+05 1.0757376e+07 1.2355392e+08]]