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
Integrate a Hermite_e series over axis 1 in Python
To integrate a Hermite_e series over a specific axis, use the hermite_e.hermeint() method in Python. This function integrates Hermite_e polynomial coefficients and can work with multidimensional arrays where different axes correspond to different variables.
Syntax
hermite_e.hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0)
Parameters
The function accepts the following parameters:
- c − Array of Hermite_e series coefficients
- m − Order of integration (default: 1)
- k − Integration constant(s) (default: [])
- lbnd − Lower bound of the integral (default: 0)
- scl − Scalar multiplier (default: 1)
- axis − Axis over which integration is performed
Example
Let's create a multidimensional array and integrate over axis 1 −
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, use the hermite_e.hermeint() method in Python
print("\nResult...\n",H.hermeint(c, axis = 1))
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... [[0.5 0. 0.5] [1.5 2. 1.5]]
How It Works
When integrating over axis 1, the function processes each row independently. For a polynomial represented by coefficients [a, b], the integral becomes [a/2, 0, b/2]. The middle coefficient is 0 because integrating introduces a new term, and the original coefficients are divided by their respective powers.
Conclusion
The hermite_e.hermeint() method efficiently integrates Hermite_e series over specified axes. When using axis=1, integration occurs along rows, producing expanded coefficient arrays with the integrated polynomial representation.
