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

หาอนุพันธ์ของอนุกรมเฮอร์ไมท์และกำหนดลำดับอนุพันธ์ใน Python

เมธอด hermite.hermder() ใช้หาอนุพันธ์ของอนุกรมเฮอร์ไมท์ (Hermite series)

พารามิเตอร์:

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

ขั้นตอน

นำเข้าไลบรารี:

import numpy as np
from numpy.polynomial import hermite as H

สร้างอาร์เรย์係ณ:

c = np.array([1, 2, 3, 4])

แสดงข้อมูลและหาอนุพันธ์อันดับ 3:

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", H.hermder(c, 3))

ตัวอย่างโค้ดสมบูรณ์

import numpy as np
from numpy.polynomial import hermite as H

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", H.hermder(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...   [192.]