Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Integrate a Hermite_e series and set the Integration constant in Python
To integrate a Hermite_e series, use the hermite_e.hermeint() method in Python. This function integrates a Hermite_e polynomial and allows you to set integration constants.
Syntax
numpy.polynomial.hermite_e.hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0)
Parameters
- c ? Array of Hermite_e series coefficients
- m ? Order of integration (default: 1)
-
k ? Integration constant(s). If
k == [], all constants are zero (default: []) - lbnd ? Lower bound of integration (default: 0)
- scl ? Scalar multiplier applied after each integration (default: 1)
- axis ? Axis over which integration is performed (default: 0)
Basic Integration
Let's integrate a simple Hermite_e series with default parameters ?
import numpy as np
from numpy.polynomial import hermite_e as H
# Create coefficient array
c = np.array([1, 2, 3])
print("Original coefficients:", c)
# Basic integration
result = H.hermeint(c)
print("Integrated series:", result)
Original coefficients: [1 2 3] Integrated series: [0. 1. 1. 1.]
Setting Integration Constants
You can specify integration constants using the k parameter ?
import numpy as np
from numpy.polynomial import hermite_e as H
c = np.array([1, 2, 3])
# Set integration constant k = 5
result_with_constant = H.hermeint(c, k=5)
print("With k=5:", result_with_constant)
# Multiple integration with different constants
result_double = H.hermeint(c, m=2, k=[2, 3])
print("Double integration with k=[2, 3]:", result_double)
With k=5: [5. 1. 1. 1.] Double integration with k=[2, 3]: [2. 3. 0.5 0.33333333 0.33333333]
Higher Order Integration
The m parameter controls the order of integration ?
import numpy as np
from numpy.polynomial import hermite_e as H
c = np.array([2, 4, 6])
# First order integration (default)
first_order = H.hermeint(c, m=1)
print("First order (m=1):", first_order)
# Second order integration
second_order = H.hermeint(c, m=2)
print("Second order (m=2):", second_order)
# Third order integration
third_order = H.hermeint(c, m=3)
print("Third order (m=3):", third_order)
First order (m=1): [0. 2. 2. 2.] Second order (m=2): [0. 0. 1. 0.66666667 0.66666667] Third order (m=3): [0. 0. 0. 0.16666667 0.16666667 0.22222222]
Integration with Scaling
Use the scl parameter to scale results after each integration ?
import numpy as np
from numpy.polynomial import hermite_e as H
c = np.array([1, 3, 5])
# Integration with scaling factor
scaled_result = H.hermeint(c, scl=2)
print("With scl=2:", scaled_result)
# Compare with normal integration
normal_result = H.hermeint(c)
print("Normal integration:", normal_result)
With scl=2: [0. 2. 3. 3.33333333] Normal integration: [0. 1. 1.5 1.66666667]
Conclusion
The hermeint() function provides flexible integration of Hermite_e series with customizable integration constants, order, and scaling. Use the k parameter to set integration constants and m for higher-order integration.
Advertisements
