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

หาอนุพันธ์อนุกรม Legendre กำหนดจำนวนอนุพันธ์ใน Python

บทนำ

เมธอด legendre.legder() หาอนุพันธ์ของอนุกรม Legendre รองรับการกำหนดจำนวนครั้งของการหาอนุพันธ์

พารามิเตอร์

  • c: สัมประสิทธิ์อนุกรม Legendre
  • m: จำนวนอนุพันธ์ (ค่าเริ่มต้น 1) ต้องไม่ติดลบ
  • scl: ตัวคูณสเกล (ค่าเริ่มต้น 1) ผลคูณด้วย scl**m
  • axis: แกนการหาอนุพันธ์ (ค่าเริ่มต้น 0)

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

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, 3))

ผลลัพธ์

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

อนุพันธ์ 3 ครั้งของพหุนามดีกรี 3 ให้ค่าคงที่ [60.]