บทนำ
ในการหาอนุพันธ์ของอนุกรมเฮอร์ไมท์อี (Hermite_e series) สามารถใช้เมธอด hermite_e.hermeder() ใน Python ซึ่งรองรับอาร์เรย์สัมประสิทธิ์หลายมิติ โดยแกนต่างๆ จะสอดคล้องกับตัวแปรต่างๆ
พารามิเตอร์สำคัญ
- c: อาร์เรย์สัมประสิทธิ์ของอนุกรมเฮอร์ไมท์อี หากเป็นหลายมิติ แกนต่างๆ สอดคล้องกับตัวแปรต่างๆ
- m: จำนวนอนุพันธ์ (ค่าเริ่มต้น: 1)
- scl: ตัวคูณสเกล (ค่าเริ่มต้น: 1)
- axis: แกนที่หาอนุพันธ์ (ค่าเริ่มต้น: 0)
ขั้นตอนการทำงาน
1. นำเข้าไลบรารีที่จำเป็น
import numpy as np
from numpy.polynomial import hermite_e as H
2. สร้างอาร์เรย์สัมประสิทธิ์หลายมิติ
c = np.arange(4).reshape(2, 2)
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)
4. หาอนุพันธ์ (ค่าเริ่มต้น axis=0)
print("\nResult...\n", H.hermeder(c))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import hermite_e as H
# สร้างอาร์เรย์สัมประสิทธิ์หลายมิติ (2x2)
c = np.arange(4).reshape(2, 2)
# แสดงข้อมูลอาร์เรย์
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)
# หาอนุพันธ์ของอนุกรมเฮอร์ไมท์อี (axis=0 เริ่มต้น)
print("\nResult...\n", H.hermeder(c))
ผลลัพธ์
Our Array...
[[0 1]
[2 3]]
Dimensions of our Array...
2
Datatype of our Array object...
int64
Shape of our Array object...
(2, 2)
Result...
[[2. 3.]]
สรุป
เมื่อไม่ระบุ axis (ใช้ค่าเริ่มต้น axis=0) อนุพันธ์จะถูกคำนวณตามแถว (แกนแถว) สำหรับอาร์เรย์ 2x2 ผลลัพธ์มีขนาด (1, 2) ซึ่งเป็นอนุพันธ์ของแต่ละคอลัมน์