Python
 Computer >> コンピューター >  >> プログラミング >> Python

Pythonでエルミート多項式と点のx、y、z浮動配列の疑似ファンデルモンド行列を生成します


エルミート多項式とx、y、zサンプルポイントの疑似ファンデルモンド行列を生成するには、Python Numpyでhermite.hermvander3d()を使用します。このメソッドは、疑似ファンデルモンド行列を返します。パラメータx、y、zは、すべて同じ形状の点座標の配列です。 dtypeは、要素のいずれかが複雑であるかどうかに応じて、float64またはcomplex128のいずれかに変換されます。スカラーは1-D配列に変換されます。パラメータ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)

エルミート多項式とx、y、zサンプルポイントの疑似ファンデルモンド行列を生成するには、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]]

  1. Pythonで点座標のfloat配列を使用してチェビシェフ多項式の疑似ファンデルモンド行列を生成します

    チェビシェフ多項式の疑似ファンデルモンド行列を生成するには、Python Numpyでthechebyshev.chebvander()を使用します。このメソッドは、度度とサンプルポイント(x、y)の疑似ファンデルモンド行列を返します。パラメータx、yは、すべて同じ形状の点座標の配列です。 dtypeは、要素のいずれかが複合であるかどうかに応じて、float64またはcomplex128のいずれかに変換されます。スカラーは1-D配列に変換されます。パラメータdegは、[x_deg、y_deg]の形式の最大度のリストです。 ステップ まず、必要なライブラリをインポートします- import n

  2. Pythonでエルミート多項式とx、y、z複素数の点の配列の疑似ファンデルモンド行列を生成します

    エルミート多項式とx、y、zサンプルポイントの疑似ファンデルモンド行列を生成するには、Python Numpyでhermite.hermvander3d()を使用します。このメソッドは、疑似ファンデルモンド行列を返します。パラメータx、y、zは、すべて同じ形状の点座標の配列です。 dtypeは、要素のいずれかが複雑であるかどうかに応じて、float64またはcomplex128のいずれかに変換されます。スカラーは1-D配列に変換されます。パラメータdegは、[x_deg、y_deg、z_deg]の形式の最大度のリストです。 ステップ まず、必要なライブラリをインポートします- numpy a