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

Python에서 특정 축에 대해 Hermite 시리즈 통합

<시간/>

Hermite 계열을 통합하려면 Python에서 hermite.hermint() 메서드를 사용합니다. 첫 번째 매개변수인 c는 Hermite 계열 계수의 배열입니다. c가 다차원이면 다른 축은 해당 인덱스에 의해 주어진 각 축의 차수를 가진 다른 변수에 해당합니다. 두 번째 매개변수인 m은 적분 차수이며 양수여야 합니다. (기본값:1)

세 번째 매개변수 k는 적분 상수입니다. lbnd의 첫 번째 적분 값은 목록의 첫 번째 값이고, lbnd의 두 번째 적분 값은 두 번째 값입니다. k ==[](기본값)이면 모든 상수가 0으로 설정됩니다. m ==1이면 목록 대신 단일 스칼라가 주어질 수 있습니다. 4번째 매개변수인 lbnd는 적분의 하한입니다. (기본값:0). 다섯 번째 매개변수인 scl은 스칼라입니다. 각 적분 후에 결과는 적분 상수가 추가되기 전에 scl로 곱해집니다(기본값:1). 여섯 번째 매개변수인 axis는 적분을 수행하는 축입니다. (기본값:0).

단계

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

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

계수의 다차원 배열 생성 -

c = np.arange(4).reshape(2,2)

배열 표시 -

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 시리즈를 통합하려면 Python에서 hermite.hermint() 메서드를 사용하십시오 -

print("\nResult...\n",H.hermint(c, axis = 1))

예시

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

# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)

# 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 integrate a Hermite series, use the hermite.hermint() method in Python
print("\nResult...\n",H.hermint(c, axis = 1))

출력

Our Array...
   [[0 1]
   [2 3]]

Dimensions of our Array...
2

Datatype of our Array object...
int64

Shape of our Array object...
(2, 2)

Result...
   [[0.5 0. 0.25]
   [1.5 1. 0.75]]