เพื่ออินทิเกรตชุด Hermite_e ให้ใช้เมธอด hermite_e.hermeint() ใน Python พารามิเตอร์แรก c คืออาร์เรย์ของ係ชุด Hermite_e หาก c เป็นหลายมิติ แกนต่างๆ จะสอดคล้องกับตัวแปรต่างๆ โดยอันดับในแต่ละแกนกำหนดโดยดัชนีที่สอดคล้อง
พารามิเตอร์ที่ 2 m คืออันดับของการอินทิเกรต ต้องเป็นบวก พารามิเตอร์ที่ 3 k คือค่าคงที่การอินทิเกรต ค่าของอินทิเกรตแรกที่ lbnd คือค่าแรกในลิสต์ ค่าของอินทิเกรตที่สองที่ lbnd คือค่าที่สอง เป็นต้น หาก k == [] (ค่าเริ่มต้น) ค่าคงทั้งหมดจะเป็นศูนย์ หาก m == 1 สามารถให้สเกลาร์เดียวแทนลิสต์ได้
พารามิเตอร์ที่ 4 lbnd คือขอบล่างของการอินทิเกรต (Default: 0) พารามิเตอร์ที่ 5 scl คือสเกลาร์ หลังการอินทิเกรตแต่ละครั้ง ผลลัพธ์จะคูณด้วย scl ก่อนบวกค่าคงที่ (Default: 1) พารามิเตอร์ที่ 6 axis คือแกนที่ทำการอินทิเกรต
ขั้นตอน
ก่อนอื่น import ไลบรารีที่จำเป็น:
import numpy as np
from numpy.polynomial import hermite_e as H
สร้างอาร์เรย์หลายมิติของ係:
c = np.arange(4).reshape(2,2)
แสดงอาร์เรย์:
print("Our Array...\n", c)
ตรวจสอบมิติ:
print("\nDimensions of our Array...\n", c.ndim)
ดึง datatype:
print("\nDatatype of our Array object...\n", c.dtype)
ดึง shape:
print("\nShape of our Array object...\n", c.shape)
อินทิเกรตชุด Hermite_e ผ่านแกน 0:
print("\nResult...\n", H.hermeint(c, axis=0))
ตัวอย่าง
import numpy as np
from numpy.polynomial import hermite_e as H
# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)
# Display the array
print("Our Array...\n", c)
# Check the Dimensions
print("\nDimensions of our Array...\n", c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n", c.dtype)
# Get the Shape
print("\nShape of our Array object...\n", c.shape)
# To integrate a Hermite_e series
print("\nResult...\n", H.hermeint(c, axis=0))
ผลลัพธ์
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... [[1. 1.5] [0. 1. ] [1. 1.5]]