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

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

บทนำ

เมธอด chebyshev.chebint() ใช้หาปริพันธ์ของอนุกรม Chebyshev ส่งคืนสัมประสิทธิ์ที่ผ่านการปริพันธ์ m ครั้งจากขอบเขตล่าง lbnd

พารามิเตอร์ทั้งหมด

  • c: อาร์เรย์สัมประสิทธิ์อนุกรม Chebyshev
  • m: ออเดอร์การปริพันธ์ (ค่าเริ่มต้น 1) ต้องเป็นบวก
  • k: ค่าคงที่การปริพันธ์ (ค่าเริ่มต้น [] ทั้งหมดเป็น 0)
  • lbnd: ขอบเขตล่าง (ค่าเริ่มต้น 0)
  • 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)

print("\nResult...\n", C.chebint(c))

ผลลัพธ์

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.5 -0.5  0.5  0.5]

อนุกรม [1,2,3] = T₀ + 2T₁ + 3T₂ ปริพันธ์ 1 ครั้งได้สัมประสิทธิ์ [0.5, -0.5, 0.5, 0.5]