在Python中将拉盖尔级数提升到幂

在Python中将拉盖尔级数提升到幂

要将拉盖尔级数提升到幂,可以使用Python Numpy中的polynomial.laguerre.lagpow()方法。该方法返回将级数c提升到pow次幂后的结果。参数c是一个从低到高排序的系数序列,例如[1,2,3]表示级数P_0 + 2*P_1 + 3*P_2

返回将级数c提升到pow次幂后的结果。参数c是一个从低到高排序的系数序列,例如[1,2,3]表示级数P_0 + 2*P_1 + 3*P_2。参数c是一个一维数组,表示拉盖尔级数的系数,按从低到高的顺序排列。参数pow表示要提升到的幂次。参数maxpower是允许的最大幂次,主要用于限制级数增长到无法处理的大小。默认值为16。

步骤

首先,导入所需的库:

import numpy as np
from numpy.polynomial import laguerre as L

创建Laguerre系数的一维数组 −

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)

将拉盖尔级数提升的方法是使用Python Numpy库中的polynomial.laguerre.lagpow()方法。

print("\nResult....\n",L.lagpow(c, 3))

示例

import numpy as np
from numpy.polynomial import laguerre as L

# Create 1-D arrays of Laguerre 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 Laguerre series to a power, use the polynomial.laguerre.lagpow() method in Python Numpy
print("\nResult....\n",L.lagpow(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....
   [ 150. -1116. 4590. -9672. 11934. -8100. 2430.]

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程