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

หาอนุพันธ์อนุกรม Legendre ใน Python

บทนำ

เมธอด legendre.legder() หาอนุพันธ์ของอนุกรม Legendre ด้วยค่าเริ่มต้น m=1, scl=1

ตัวอย่าง: อนุพันธ์ 1 ครั้ง

import numpy as np
from numpy.polynomial import legendre as L

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

ผลลัพธ์

Our Array... [1 2 3 4]
Dimensions of our Array... 1
Datatype of our Array object... int64
Shape of our Array object... (4,)
Result... [ 6.  9. 20.]

อนุกรม P₀ + 2P₁ + 3P₂ + 4P₃ อนุพันธ์ 1 ครั้งได้สัมประสิทธิ์ [6, 9, 20]