บทนำ
ในการหาอนุพันธ์ของอนุกรม Laguerre และกำหนดจำนวนครั้ง m สามารถใช้เมธอด laguerre.lagder() จาก NumPy พารามิเตอร์ m ระบุจำนวนครั้งของการหาอนุพันธ์ (ค่าเริ่มต้น: 1)
ขั้นตอนการทำงาน
1. นำเข้าไลบรารี
import numpy as np from numpy.polynomial import laguerre as L
2. สร้างอาเรย์สัมประสิทธิ์
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)
4. หาอนุพันธ์ครั้งที่ 3
print("\nResult...\n", L.lagder(c, 3))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import laguerre 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)
# หาอนุพันธ์ครั้งที่ 3
print("\nResult...\n", L.lagder(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... [-4.]