บทนำ
ในการหาปริพันธ์ของอนุกรม Hermite และคูณผลลัพธ์ด้วยสเกลาร์ scl ก่อนบวกค่าคงที่การปริพันธ์ สามารถใช้เมธอด hermite.hermint() พร้อมตั้งค่า scl
ขั้นตอนการทำงาน
1. นำเข้าไลบรารี
import numpy as np from numpy.polynomial import hermite as H
2. สร้างอาเรย์สัมประสิทธิ์
c = np.array([1, 2, 3])
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. หาปริพันธ์พร้อมตั้งค่า scl=-2
print("\nResult...\n", H.hermint(c, scl=-2))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import hermite as H
# สร้างอาเรย์สัมประสิทธิ์
c = np.array([1, 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)
# หาปริพันธ์พร้อม scl=-2
print("\nResult...\n", H.hermint(c, scl=-2))
ผลลัพธ์ที่คาดหวัง
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result... [-2. -1. -1. -1.]