Pythonで多項式をルジャンドル級数に変換する
多項式をLegendre系列に変換するには、Python Numpyのlegendre.poly2lag()メソッドを使用します。多項式の係数を最低次から最高次の順に表す配列を、同等のLegendre系列の係数の配列に変換します。最低から最高度。このメソッドは、equivalentLegendreシリーズの係数を含む1次元配列を返します。パラメータpolは、多項式係数を含む1次元配列です
ステップ
まず、必要なライブラリをインポートします-
import numpy as np from numpy.polynomial import legendre as L
numpy.array()メソッドを使用して配列を作成します-
c = np.array([1, 2, 3, 4, 5])
配列を表示する-
print("Our Array...\n",c) 寸法を確認してください-
print("\nDimensions of our Array...\n",c.ndim) データ型を取得-
print("\nDatatype of our Array object...\n",c.dtype) 形をとる-
print("\nShape of our Array object...\n",c.shape) 多項式をLegendre系列に変換するには、Python Numpyのlegendre.poly2lag()メソッドを使用します-
print("\nResult (polynomial to legendre)...\n",L.poly2leg(c)) 例
import numpy as np
from numpy.polynomial import legendre as L
# Create an array using the numpy.array() method
c = np.array([1, 2, 3, 4, 5])
# Display the array
print("Our Array...\n",c)
# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)
# Get the Shape
print("\nShape of our Array object...\n",c.shape)
# To convert a polynomial to a Legendre series, use the legendre.poly2lag() method in Python Numpy
print("\nResult (polynomial to legendre)...\n",L.poly2leg(c)) 出力
Our Array... [1 2 3 4 5] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (5,) Result (polynomial to legendre)... [3. 4.4 4.85714286 1.6 1.14285714]
-
Pythonで多項式をチェビシェフ系列に変換する
多項式をチェビシェフ系列に変換するには、Python Numpyのchebyshev.poly2cheb()メソッドを使用します。最低次数から最高次数の順に並べられた多項式の係数を表す配列を、最低次数から最高次数の順に並べられた同等のチェビシェフ級数の係数の配列に変換します。このメソッドは、同等のチェビシェフ級数の係数を含む1次元配列を返します。パラメータcは、多項式係数を含む1次元配列です ステップ まず、必要なライブラリをインポートします- import numpy as np from numpy import polynomial as P numpy.array()メソッドを使用
-
チェビシェフ系列をPythonで多項式に変換する
チェビシェフ系列を多項式に変換するには、PythonNumpyのchebyshev.cheb2poly()メソッドを使用します。チェビシェフ級数の係数を表す配列を、最低度から最高度の順に並べて、同等の多項式(「標準」基底に対して)の係数の配列に、最低度から最高度の順に変換します。 このメソッドは、最低次の項から最高次の項に順序付けられた等価多項式の係数を含む1次元配列を返します。パラメータcは、チェビシェフ系列係数を含む1次元配列であり、最下位の項から最上位の項の順に並べられています。 ステップ まず、必要なライブラリをインポートします- import numpy as np from n