เพื่อหาปริพันธ์ (integrate) ของอนุกรมเชบิเชฟ ให้ใช้เมธอด chebyshev.chebint() ใน Python เมธอดนี้จะคืนค่า係數ของอนุกรมเชบิเชฟที่ถูกปริพันธ์แล้ว m ครั้ง จากขอบเขตล่าง lbnd ตามแกน axis ในแต่ละรอบ ผลลัพธ์จะถูกคูณด้วย scl และบวกด้วยค่าคงที่การปริพันธ์ k
พารามิเตอร์สำคัญ:
c: อาร์เรย์ของ係數อนุกรมเชบิเชฟ หากเป็นหลายมิติ แกนต่างๆ จะสอดคล้องกับตัวแปรต่างๆm: ลำดับของการปริพันธ์ ต้องเป็นจำนวนบวก (ค่าเริ่มต้น: 1)k: ค่าคงที่การปริพันธ์ ค่าของปริพันธ์อันดับหนึ่งที่ศูนย์คือค่าแรกในรายการ เป็นต้น หากk == [](ค่าเริ่มต้น) ทุกค่าคงที่จะเป็นศูนย์lbnd: ขอบเขตล่างของการปริพันธ์ (ค่าเริ่มต้น: 0)scl: ตัวคูณสเกลาร์ หลังการปริพันธ์แต่ละครั้ง ผลลัพธ์จะถูกคูณด้วยsclก่อนบวกค่าคงที่ (ค่าเริ่มต้น: 1)axis: แกนที่ใช้ในการปริพันธ์ (ค่าเริ่มต้น: 0)
ขั้นตอน
นำเข้าไลบรารี:
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)
หาปริพันธ์อนุกรมเชบิเชฟพร้อมกำหนด scl = -2:
print("\nResult...\n", C.chebint(c, scl=-2))
ตัวอย่างโค้ดสมบูรณ์
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)
print("\nResult...\n", C.chebint(c, scl=-2))
ผลลัพธ์
Our coefficient Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result... [-1. 1. -1. -1.]