ホームページ  >  記事  >  バックエンド開発  >  Python で多項式を Hermite_e 系列に変換する

Python で多項式を Hermite_e 系列に変換する

WBOY
WBOY転載
2023-09-08 08:25:021128ブラウズ

Python で多項式を Hermite_e 系列に変換する

多項式をエルミート級数に変換するには、Python で hermite_e.poly2herme() メソッドを使用します。 Numpy. 多項式の係数を表す配列を次数の低いものから順に変換します 最高点へ、等価なエルミート級数の係数配列へ、低いものから高いものへと並べ替えられます。 最大回数。このメソッドは、同等の係数を含む 1 次元配列を返します。 エルミットシリーズ。パラメーター pol は、多項式係数を含む 1 次元配列です。

手順

まず、必要なライブラリをインポートします。 -

import numpy as np
from numpy.polynomial import hermite_e as H

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)

To多項式をエルミート級数に変換するには、Python で hermite_e.poly2herme() メソッドを使用します。 Numpy. 多項式の係数を表す配列を次数の低いものから順に変換します 最高点へ、等価なエルミート級数の係数配列へ、低いものから高いものへと並べ替えられます。 最高度 −

print("\nResult (polynomial to hermite_e)...\n",H.poly2herme(c))

import numpy as np
from numpy.polynomial import hermite_e as H

# 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 Hermite series, use the hermite_e.poly2herme() method in Python Numpy
print("\nResult (polynomial to hermite_e)...\n",H.poly2herme(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 hermite_e)...
   [19. 14. 33. 4. 5.]

以上がPython で多項式を Hermite_e 系列に変換するの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。