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

Python에서 주어진 루트로 Hermite_e 시리즈 생성

<시간/>

주어진 루트로 Hermite_e 시리즈를 생성하려면 Python Numpy에서 hermite_e.hermefromroots() 메소드를 사용하십시오. 이 메서드는 계수의 1차원 배열을 반환합니다. 모든 근이 실수이면 out은 실수형 배열이고, 일부 근이 복소수이면 결과의 모든 계수가 실수인 경우에도 out은 복소수입니다. 루트 매개변수는 루트를 포함하는 시퀀스입니다.

단계

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

from numpy.polynomial import hermite_e as H

Ggenerate a Hermite_e series 주어진 root −

print("Result...\n",H.hermefromroots((-1,0,1)))

데이터 유형 가져오기 -

print("\nType...\n",H.hermefromroots((-1,0,1)).dtype)

모양 가져오기 -

print("\nShape...\n",H.hermefromroots((-1,0,1)).shape)

예시

from numpy.polynomial import hermite_e as H

# To generate a Hermite_e series with given roots, use the hermite_e.hermefromroots() method in Python Numpy.
print("Result...\n",H.hermefromroots((-1,0,1)))

# Get the datatype
print("\nType...\n",H.hermefromroots((-1,0,1)).dtype)

# Get the shape
print("\nShape...\n",H.hermefromroots((-1,0,1)).shape)

출력

Result...
   [0. 2. 0. 1.]

Type...
float64

Shape...
(4,)