Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

อินทิเกรต Hermite_e Series และตั้งค่า Lower Bound ของ Integral ใน Python

ในการอินทิเกรต Hermite_e Series ใช้เมธอด hermite_e.hermeint() ใน Python พารามิเตอร์:

  • c: อาร์เรย์ของ Hermite_e Series Coefficients หากเป็นหลายมิติ แก้ต่างๆ ตรงกับตัวแปรต่างๆ
  • m: Order of Integration ต้องเป็นบวก (Default: 1)
  • k: Integration Constant(s) ค่าของ Integral แรกที่ lbnd คือค่าแรกในลิสต์ (Default: [] ทั้งหมดเป็นศูนย์)
  • lbnd: Lower Bound ของ Integral (Default: 0)
  • scl: Scalar คูณผลลัพธ์หลังแต่ละการอินทิเกรต (Default: 1)
  • axis: Axis ที่ทำการอินทิเกรต (Default: 0)

ขั้นตอน

1. Import ไลบรารี:

import numpy as np 
from numpy.polynomial import hermite_e as H

2. สร้างอาร์เรย์สัมประสิทธิ์:

c = np.array([1,2,3])

3. แสดงอาร์เรย์ ตรวจสอบ Dimensions Datatype Shape

4. อินทิเกรต Hermite_e Series:

print("Result...\n", H.hermeint(c, lbnd = -2))

ตัวอย่างโค้ดเต็ม

import numpy as np 
from numpy.polynomial import hermite_e 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) 
print("\nResult...\n",H.hermeint(c, lbnd = -2))

ผลลัพธ์

Our Array...   [1 2 3] 
Dimensions of our Array... 1 
Datatype of our Array object... int64 
Shape of our Array object... (3,) 
Result...   [1. 1. 1. 1.]