用 Python 將 Hermit 級數提升到某個冪次
要在 Python 中將 Hermit 級數提升到某個冪次,請使用 polynomial.hermite.hermpow() 方法。該方法返回冪次 Hermite 級數。返回到 pow 次冪的 Hermite 級數 c。引數 c 是從低到高順序排列的一組係數。也就是說,[1,2,3] 是級數 P_0 + 2*P_1 + 3*P_2。
引數 c 是從低到高順序排列的 Hermite 級數係數的一維陣列。引數 pow 是該級數將被提升到的冪次。引數 maxpower 是允許的最大冪次。這主要用於將級數增長限制為可控的大小。預設值為 16。
步驟
首先,匯入所需的庫 −
import numpy as np from numpy.polynomial import hermite as H
建立 Hermite 級數係數的一維陣列 −
c = np.array([1,2,3])
顯示係數陣列 −
print("Our coefficient 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 中將 Hermite 級數提升到某個冪次,請使用 polynomial.hermite.hermpow() 方法 −
print("\nResult....\n",H.hermpow(c, 3))示例
import numpy as np
from numpy.polynomial import hermite as H
# Create 1-D arrays of Hermite series coefficients
c = np.array([1,2,3])
# Display the coefficient array
print("Our coefficient 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 raise a Hermite series to a power, use the polynomial.hermite.hermpow() method in Python Numpy
# The method returns Hermite series of power.
print("\nResult....\n",H.hermpow(c, 3))輸出
Our coefficient Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result.... [2257. 2358. 3837. 908. 711. 54. 27.]
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP