ในการคูณอนุกรม Chebyshev ด้วยตัวแปรอิสระ ให้ใช้เมธอด polynomial.chebyshev.chebmulx() ใน Python Numpy วิธีการส่งกลับอาร์เรย์ที่แสดงผลของการคูณ พารามิเตอร์ c1 และ c2 เป็นอาร์เรย์ 1-D ของสัมประสิทธิ์ซีรีส์ Chebyshev เรียงจากต่ำไปสูง
ขั้นตอน
ขั้นแรก นำเข้าไลบรารีที่จำเป็น -
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)
ในการคูณอนุกรม Chebyshev ด้วยตัวแปรอิสระ ให้ใช้เมธอด 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]