Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

หาปริพันธ์อนุกรม Chebyshev กำหนดออเดอร์การปริพันธ์ใน Python

บทนำ

พารามิเตอร์ m ใน chebyshev.chebint() ควบคุมออเดอร์ (order) ของการปริพันธ์ ทำให้สามารถปริพันธ์ซ้ำได้หลายครั้ง

พารามิเตอร์ m

จำนวนครั้งของการปริพันธ์ ต้องเป็นจำนวนเต็มบวก ค่าเริ่มต้นคือ 1

ตัวอย่าง: ปริพันธ์ออเดอร์ 3 (m=3)

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)

# ปริพันธ์ 3 ครั้ง (m=3)
print("\nResult...\n", C.chebint(c, m=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... [ 0.03125      -0.1875        0.04166667  -0.05208333   0.01041667   0.00625    ]

ปริพันธ์ 3 ครั้งทำให้ได้อาร์เรย์ยาวขึ้น (เพิ่มมิติ 3) สัมประสิทธิ์เล็กลงตามลำดับ