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

หาอนุพันธ์อนุกรม Chebyshev คูณสเกลแต่ละครั้งใน Python

บทนำ

การใช้พารามิเตอร์ scl ใน chebyshev.chebder() ทำให้แต่ละครั้งของการหาอนุพันธ์ถูกคูณด้วยค่าสเกลที่กำหนด

ตัวอย่าง: scl = -1 (อนุพันธ์ 1 ครั้ง)

import numpy as np
from numpy.polynomial import chebyshev as C

c = np.array([1, 2, 3, 4])
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)

# อนุพันธ์ 1 ครั้ง พร้อม scl = -1
print("\nResult...\n", C.chebder(c, scl=-1))

ผลลัพธ์

Our coefficient Array... [1 2 3 4]
Dimensions of our Array... 1
Datatype of our Array object... int64
Shape of our Array object... (4,)
Result... [-14. -12. -24.]

เปรียบเทียบกับไม่มี scl (ค่าเริ่มต้น 1) ที่ให้ [14, 12, 24] การใช้ scl=-1 เปลี่ยนเครื่องหมายทั้งหมด