在Python中使用给定的复数根生成Hermite_e级数

在Python中使用给定的复数根生成Hermite_e级数

要使用Python Numpy中的hermite_e.hermefromroots()方法生成具有给定复数根的Hermite_e级数。该方法返回一个一维数组,包含系数。如果所有根都是实数,则out是一个实数组;如果一些根是复数,则out也是复数,即使结果中的所有系数都是实数。参数roots是包含根的序列。

步骤

首先,导入所需的库 –

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

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程