在 Python 中生成具有給定複數根的 Hermite_e 級數
如需使用指定的複數根生成 Hermite_e 級數,請在 Python Numpy 中使用 hermite_e.hermefromroots() 方法。此方法返回一個係數一維陣列。如果所有根都是實數,則 out 是一個實數陣列,如果有些根是複數,則即使結果中的所有係數都是實數,out 也是複數的。根引數是包含這些根的序列。
步驟
首先,匯入必需的庫 -
from numpy.polynomial mport hermite_e as H
使用給定的複數根生成一個 Hermite_e 級數 -
j = complex(0,1)
print("Result...\n",H.hermefromroots((-j, j)))透過獲得資料型別 -
print("\nType...\n",H.hermefromroots((-j, j)).dtype)透過獲得形狀 -
print("\nShape...\n",H.hermefromroots((-j, j)).shape)Create an array示例
from numpy.polynomial import hermite_e as H
j = complex(0,1)
print("Result...\n",H.hermefromroots((-j, j)))
# Get the datatype
print("\nType...\n",H.hermefromroots((-j, j)).dtype)
# Get the shape
print("\nShape...\n",H.hermefromroots((-j, j)).shape)輸出
Result... [2.+0.j 0.+0.j 1.+0.j] Type... complex128 Shape... (3,)
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP