用 Python 乘以一個獨立變數上的拉蓋爾級數


如需用 Python 乘以某個獨立變數上的拉蓋爾級數,請使用 Python 中的 polynomial.laguerre.lagmulx() 方法。用 x 乘以拉蓋爾級數,其中 x 是獨立變數。引數 c 是從低到高排序的拉蓋爾級數係數的一維陣列。

步驟

首先,匯入必需的庫 -

import numpy as np
from numpy.polynomial import laguerre as L

建立陣列 -

c = np.array([1, 2, 3])

顯示陣列 -

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)

如需用 Python 中的 polynomial.laguerre.lagmulx() 方法用獨立變數乘以拉蓋爾級數,請執行以下操作 -

print("\nResult....\n",L.lagmulx(c))

範例

import numpy as np
from numpy.polynomial import laguerre as L

# Create an array
c = np.array([1, 2, 3])

# 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 multiply a Laguerre series by an independent variable, use the polynomial.laguerre.lagmulx() method in Python Numpy
print("\nResult....\n",L.lagmulx(c))

輸出

Our Array...
   [1 2 3]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result....
   [-1. -1. 11. -9.]

已更新時間:03-Mar-2022

91 瀏覽量

開啟你的 職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.