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.5, 2.3]) y = np.array([3.7, 4.4]) z = np.array([5.3, 6.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 행렬을 생성하려면 Python Numpy에서 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.5, 2.3]) y = np.array([3.7, 4.4]) z = np.array([5.3, 6.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 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.5 2.3] Array2... [3.7 4.4] Array3... [5.3 6.6] Array1 datatype... float64 Array2 datatype... float64 Array3 datatype... float64 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.00000000e+00 1.06000000e+01 1.10360000e+02 1.12741600e+03 1.12884496e+04 7.40000000e+00 7.84400000e+01 8.16664000e+02 8.34287840e+03 8.35345270e+04 5.27600000e+01 5.59256000e+02 5.82259360e+03 5.94824682e+04 5.95578601e+05 3.60824000e+02 3.82473440e+03 3.98205366e+04 4.06798751e+05 4.07314354e+06 3.00000000e+00 3.18000000e+01 3.31080000e+02 3.38224800e+03 3.38653488e+04 2.22000000e+01 2.35320000e+02 2.44999200e+03 2.50286352e+04 2.50603581e+05 1.58280000e+02 1.67776800e+03 1.74677808e+04 1.78447404e+05 1.78673580e+06 1.08247200e+03 1.14742032e+04 1.19461610e+05 1.22039625e+06 1.22194306e+07 7.00000000e+00 7.42000000e+01 7.72520000e+02 7.89191200e+03 7.90191472e+04 5.18000000e+01 5.49080000e+02 5.71664800e+03 5.84001488e+04 5.84741689e+05 3.69320000e+02 3.91479200e+03 4.07581552e+04 4.16377277e+05 4.16905021e+06 2.52576800e+03 2.67731408e+04 2.78743756e+05 2.84759126e+06 2.85120048e+07] [1.00000000e+00 1.32000000e+01 1.72240000e+02 2.22076800e+03 2.82806976e+04 8.80000000e+00 1.16160000e+02 1.51571200e+03 1.95427584e+04 2.48870139e+05 7.54400000e+01 9.95808000e+02 1.29937856e+04 1.67534738e+05 2.13349583e+06 6.28672000e+02 8.29847040e+03 1.08282465e+05 1.39613466e+06 1.77792827e+07 4.60000000e+00 6.07200000e+01 7.92304000e+02 1.02155328e+04 1.30091209e+05 4.04800000e+01 5.34336000e+02 6.97227520e+03 8.98966886e+04 1.14480264e+06 3.47024000e+02 4.58071680e+03 5.97714138e+04 7.70659794e+05 9.81408080e+06 2.89189120e+03 3.81729638e+04 4.98099340e+05 6.42221944e+06 8.17847005e+07 1.91600000e+01 2.52912000e+02 3.30011840e+03 4.25499149e+04 5.41858166e+05 1.68608000e+02 2.22562560e+03 2.90410419e+04 3.74439251e+05 4.76835186e+06 1.44543040e+03 1.90796813e+04 2.48960932e+05 3.20996558e+06 4.08777800e+07 1.20453555e+04 1.58998693e+05 2.07469203e+06 2.67499401e+07 3.40651057e+08]]