在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
创建切比雪夫级数系数的一维数组 -
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中使用chebyshev.chebpow()方法。返回切比雪夫级数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.]))
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP