在Python中将切比雪夫级数提高到一定次方
要将切比雪夫级数提高到一定次方,在Python的Numpy中使用chebyshev.chebpow()方法。将切比雪夫级数c提高到pow次方。参数c是一个按照从低到高顺序排序的系数序列,即[1,2,3]
表示级数T_0 + 2*T_1 + 3*T_2
。该方法返回幂次的切比雪夫级数。
参数c是一个按照从低到高顺序排序的一维数组,表示切比雪夫级数的系数。参数power表示级数将要提高的次方。参数maxpower是允许的最大次方。这主要是为了限制级数增长到无法处理的大小。默认值为16。
步骤
首先,导入所需的库-
import numpy as np
from numpy.polynomial import chebyshev as C
创建Chebyshev级数系数的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)
要将Chebyshev级数提高到一个幂,可以使用Python Numpy中的chebyshev.chebpow()方法。将Chebyshev级数c提升到幂pow。参数c是从低到高排序的系数序列。即,[1,2,3]
是系列T_0 + 2*T_1 + 3*T_2
。
print("\nResult...\n",C.chebdiv(c,3))
示例
import numpy as np
from numpy.polynomial import chebyshev as C
# Create 1-D array of Chebyshev series coefficient
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 Chebyshev series to a power, use the chebyshev.chebpow() method in Python Numpy
print("\nResult...\n",C.chebdiv(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...
(array([0.33333333, 0.66666667, 1. ]), array([0.]))