在 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.