在 Python 中将切比雪夫级数乘以一个自变量
要通过一个自变量将切比雪夫级数相乘,请在 Python Numpy 中使用 polynomial.chebyshev.chebmulx() 方法。该方法返回一个表示乘法结果的数组。c1 和 c2 参数是从低到高排列的切比雪夫级数系数的 1 维数组。
步骤
首先导入需要的函数库 -
import numpy as np from numpy.polynomial import chebyshev as C
创建一个数组 −
x = np.array([1, 2, 3])
显示数组 −
print("Our Array...\n",x)检查维度 −
print("\nDimensions of our Array...\n",x.ndim)
获取数据类型 −
print("\nDatatype of our Array object...\n",x.dtype)获取形状 −
print("\nShape of our Array object...\n",x.shape)
要通过一个自变量将切比雪夫级数相乘,请使用 polynomial.chebyshev.chebmulx() 方法 −
print("\nResult....\n",C.chebmulx(x))範例
import numpy as np
from numpy.polynomial import chebyshev as C
# Create an array
x = np.array([1, 2, 3])
# Display the array
print("Our Array...\n",x)
# Check the Dimensions
print("\nDimensions of our Array...\n",x.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",x.dtype)
# Get the Shape
print("\nShape of our Array object...\n",x.shape)
# To multiply a Chebyshev series by an independent variable, use the polynomial.chebyshev.chebmulx() method in Python Numpy
# The method returns an array representing the result of the multiplication.
print("\nResult....\n",C.chebmulx(x))输出
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result.... [1. 2.5 1. 1.5]
广告
数据结构
计算机网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP