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

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

<시간/>

Hermite 시리즈를 다항식으로 변환하려면 Python Numpy에서 hermite.herm2poly() 메서드를 사용합니다. "표준" 기준으로) 가장 낮은 등급에서 가장 높은 등급으로 정렬됩니다.

이 메서드는 가장 낮은 차수에서 가장 높은 순으로 정렬된 등가 다항식("표준" 기준에 상대적)의 계수를 포함하는 1차원 배열을 반환합니다. 매개변수 c는 에르미트 계열 계수를 포함하는 1차원 배열로, 가장 낮은 차수에서 가장 높은 순으로 정렬됩니다.

단계

먼저 필요한 라이브러리를 가져옵니다 -

import numpy as np
from numpy.polynomial import hermite 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 시리즈를 다항식으로 변환하려면 hermite.herm2poly() 메소드를 사용하십시오 -

print("\nResult (hermite to polynomial)...\n",H.herm2poly(c))

import numpy as np
from numpy.polynomial import hermite 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 series to a polynomial, use the hermite.herm2poly() method in Python Numpy
print("\nResult (hermite to polynomial)...\n",H.herm2poly(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 to polynomial)...
[ 55. -44. -228. 32. 80.]