在 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
创建拉盖尔级数系数的一维数组 -
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.]
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP