하나의 Laguerre 시리즈를 다른 시리즈에 추가하려면 PythonNumpy에서 polynomial.laguerre.lagadd() 메서드를 사용합니다. 이 메서드는 합계의 Laguerre 급수를 나타내는 배열을 반환합니다.
두 Laguerre 급수 c1 + c2의 합을 반환합니다. 인수는 가장 낮은 차수에서 가장 높은 항으로 정렬된 계수 시퀀스입니다. 즉, [1,2,3]은 시리즈 P_0 + 2*P_1 + 3*P_2를 나타냅니다. 매개변수 c1 및 c2는 정렬된 라게르 시리즈 계수의 1차원 배열입니다. 낮은 곳에서 높은 곳으로.
단계
먼저 필요한 라이브러리를 가져옵니다 -
import numpy as np from numpy.polynomial import laguerre as L
Laguerre 급수 계수의 1차원 배열 생성 -
c1 = np.array([1,2,3]) c2 = np.array([3,2,1])
계수 배열 표시 -
print("Array1...\n",c1)
print("\nArray2...\n",c2) 데이터 유형 표시 -
print("\nArray1 datatype...\n",c1.dtype)
print("\nArray2 datatype...\n",c2.dtype) 두 어레이의 차원을 확인하십시오 -
print("\nDimensions of Array1...\n",c1.ndim)
print("\nDimensions of Array2...\n",c2.ndim) 두 배열의 모양을 확인하십시오 -
print("\nShape of Array1...\n",c1.shape)
print("\nShape of Array2...\n",c2.shape) 하나의 Laguerre 시리즈를 다른 시리즈에 추가하려면 polynomial.laguerre.lagadd() 메소드를 사용하십시오 -
print("\nResult (sum)....\n",L.lagadd(c1, c2))
예시
import numpy as np
from numpy.polynomial import laguerre as L
# Create 1-D arrays of Laguerre series coefficients
c1 = np.array([1,2,3])
c2 = np.array([3,2,1])
# Display the arrays of coefficients
print("Array1...\n",c1)
print("\nArray2...\n",c2)
# Display the datatype
print("\nArray1 datatype...\n",c1.dtype)
print("\nArray2 datatype...\n",c2.dtype)
# Check the Dimensions of both the arrays
print("\nDimensions of Array1...\n",c1.ndim)
print("\nDimensions of Array2...\n",c2.ndim)
# Check the Shape of both the arrays
print("\nShape of Array1...\n",c1.shape)
print("\nShape of Array2...\n",c2.shape)
# To add one Laguerre series to another, use the polynomial.laguerre.lagadd() method in Python Numpy
# The method returns an array representing the Laguerre series of their sum.
print("\nResult (sum)....\n",L.lagadd(c1, c2)) 출력
Array1... [1 2 3] Array2... [3 2 1] Array1 datatype... int64 Array2 datatype... int64 Dimensions of Array1... 1 Dimensions of Array2... 1 Shape of Array1... (3,) Shape of Array2... (3,) Result (sum).... [4. 4. 4.]