在 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,)

更新於: 11-Mar-2022

瀏覽 94 次

啟動您的 職業

完成課程獲得認證

開始
廣告
© . All rights reserved.