Chebyshev 다항식과 x, y, z 샘플 포인트의 의사 Vandermonde 행렬을 생성하려면 Python Numpy에서 chebyshev.chebvander()를 사용합니다. 이 메서드는 각도 및 샘플 포인트(x, y, z)의 의사 Vandermondematrix를 반환합니다.
매개변수 x, y, z는 모두 같은 모양의 점 좌표 배열입니다. 복잡한 요소가 있는지 여부에 따라 dtypes는 float64 또는 complex128로 변환됩니다. 스칼라는 1차원 배열로 변환됩니다. 매개변수 deg는 [x_deg, y_deg, z_deg] 형식의 최대 각도 목록입니다.
단계
먼저 필요한 라이브러리를 가져옵니다 -
import numpy as np from numpy.polynomial import chebyshev as C
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)
Chebyshev 다항식과 x, y, z 샘플 포인트의 의사 Vandermonde 행렬을 생성하려면 chebyshev.chebvander() -
x_deg, y_deg, z_deg = 2, 3, 4 print("\nResult...\n",C.chebvander3d(x,y, z, [x_deg, y_deg, z_deg]))
예시
import numpy as np from numpy.polynomial import chebyshev as C # 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 Chebyshev polynomial and x, y, z sample points, use the chebyshev.chebvander() in Python Numpy x_deg, y_deg, z_deg = 2, 3, 4 print("\nResult...\n",C.chebvander3d(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 5.30000000e+00 5.51800000e+01 5.79608000e+02 6.08866480e+03 3.70000000e+00 1.96100000e+01 2.04166000e+02 2.14454960e+03 2.25280598e+04 2.63800000e+01 1.39814000e+02 1.45564840e+03 1.52900590e+04 1.60618977e+05 1.91512000e+02 1.01501360e+03 1.05676322e+04 1.11001887e+05 1.16605237e+06 1.50000000e+00 7.95000000e+00 8.27700000e+01 8.69412000e+02 9.13299720e+03 5.55000000e+00 2.94150000e+01 3.06249000e+02 3.21682440e+03 3.37920896e+04 3.95700000e+01 2.09721000e+02 2.18347260e+03 2.29350886e+04 2.40928466e+05 2.87268000e+02 1.52252040e+03 1.58514482e+04 1.66502831e+05 1.74907856e+06 3.50000000e+00 1.85500000e+01 1.93130000e+02 2.02862800e+03 2.13103268e+04 1.29500000e+01 6.86350000e+01 7.14581000e+02 7.50592360e+03 7.88482092e+04 9.23300000e+01 4.89349000e+02 5.09476940e+03 5.35152066e+04 5.62166421e+05 6.70292000e+02 3.55254760e+03 3.69867126e+04 3.88506606e+05 4.08118331e+06] [1.00000000e+00 6.60000000e+00 8.61200000e+01 1.13018400e+03 1.48323088e+04 4.40000000e+00 2.90400000e+01 3.78928000e+02 4.97280960e+03 6.52621587e+04 3.77200000e+01 2.48952000e+02 3.24844640e+03 4.26305405e+04 5.59474688e+05 3.27536000e+02 2.16173760e+03 2.82074003e+04 3.70175947e+05 4.85811510e+06 2.30000000e+00 1.51800000e+01 1.98076000e+02 2.59942320e+03 3.41143102e+04 1.01200000e+01 6.67920000e+01 8.71534400e+02 1.14374621e+04 1.50102965e+05 8.67560000e+01 5.72589600e+02 7.47142672e+03 9.80502431e+04 1.28679178e+06 7.53332800e+02 4.97199648e+03 6.48770207e+04 8.51404677e+05 1.11736647e+07 9.58000000e+00 6.32280000e+01 8.25029600e+02 1.08271627e+04 1.42093518e+05 4.21520000e+01 2.78203200e+02 3.63013024e+03 4.76395160e+04 6.25211481e+05 3.61357600e+02 2.38496016e+03 3.11201165e+04 4.08400578e+05 5.35976751e+06 3.13779488e+03 2.07094462e+04 2.70226895e+05 3.54628557e+06 4.65407426e+07]]