在Python中将Hermite级数提高到一个幂次

在Python中将Hermite级数提高到一个幂次

要将Hermite级数提高到一定的幂次,请使用Python的numpy库中的polynomial.hermite.hermpow() 方法。该方法返回指定幂次的Hermite级数。返回Hermite级数 c 的 pow次幂。参数 c 是一个按从低到高排序的系数序列,例如 [1,2,3] 就是级数 P_0 + 2*P_1 + 3*P_2

参数 c 是一个按从低到高排序的1-D Hermite级数系数数组。参数 pow 是级数将提高到的幂次。参数 maxpower 是允许的最大幂次。这主要是为了限制级数的增长,以避免变得无法处理。默认值为16。

步骤

首先,导入所需的库 –

import numpy as np
from numpy.polynomial import hermite as H

创建Hermite系数的1-D数组−

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)

将一个Hermite级数提高到一定的幂次,可以使用Python中的polynomial.hermite.hermpow()方法 Numpy−

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

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程