在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