Computer >> 컴퓨터 >  >> 프로그램 작성 >> Python

Python에서 Hermite_e 시리즈를 다항식으로 변환

<시간/>

Hermite_e 시리즈를 다항식으로 변환하려면 PythonNumpy에서 hermite_e.herme2poly() 메서드를 사용합니다. 가장 낮은 차수에서 가장 높은 차수로 정렬된 Hermite_e 계열의 계수를 나타내는 배열을 가장 낮은 차수에서 가장 높은 차수로 정렬된 등가 다항식("표준" 기준에 상대적)의 계수 배열로 변환합니다. 이 메서드는 가장 낮은 차수에서 가장 높은 순으로 정렬된 등가 다항식("표준" 기준에 상대적)의 계수를 포함하는 1차원 배열을 반환합니다. 매개변수 c는 에르마이트 계열 계수를 포함하는 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)

Hermite_e 시리즈를 다항식으로 변환하려면 Python에서 hermite_e.herme2poly() 메서드를 사용하십시오 -

print("\nResult (hermite_e to polynomial)...\n",H.herme2poly(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 Hermite_e series to a polynomial, use the hermite_e.herme2poly() method in Python Numpy
print("\nResult (hermite_e to polynomial)...\n",H.herme2poly(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 (hermite_e to polynomial)...
   [ 13. -10. -27. 4. 5.]