บทนำ
ในการยกกำลังอนุกรม Laguerre สามารถใช้เมธอด polynomial.laguerre.lagpow() จาก NumPy เมธอดนี้คืนค่าอนุกรม Laguerre c ยกกำลัง pow อาร์กิวเมนต์ c คือลำดับสัมประสิทธิ์เรียงจากต่ำไปสูง
พารามิเตอร์สำคัญ
- c: อาเรย์ 1 มิติ สัมประสิทธิ์อนุกรม Laguerre เรียงจากต่ำไปสูง
- pow: กำลังที่จะยก
- maxpower: กำลังสูงสุดที่อนุญาต (ค่าเริ่มต้น: 16) เพื่อจำกัดขนาดอนุกรม
ขั้นตอนการทำงาน
1. นำเข้าไลบรารี
import numpy as np from numpy.polynomial import laguerre as L
2. สร้างอาเรย์สัมประสิทธิ์ 1 มิติ
c = np.array([1, 2, 3])
3. แสดงอาเรย์และตรวจสอบคุณสมบัติ
print("Our coefficient 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.lagpow(c, 3))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import laguerre as L
# สร้างอาเรย์สัมประสิทธิ์ 1 มิติ
c = np.array([1, 2, 3])
# แสดงอาเรย์
print("Our coefficient 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)
# ยกกำลังอนุกรม Laguerre
print("\nResult....\n", L.lagpow(c, 3))
ผลลัพธ์ที่คาดหวัง
Our coefficient Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result.... [ 150. -1116. 4590. -9672. 11934. -8100. 2430.]