Integrate a Hermite_e series Over Axis 0 using Numpy in Python

In this article, we will cover how to integrate a Hermite_e series over axis 0 using NumPy in Python.
NumPy e.hermeint() methodĀ
We useĀ the hermite e.hermeint() function present in the NumPy module of python to integrate a Hermite e series. The first parameter āarrāĀ is an array of coefficients from the Hermite e series. If āarrāĀ is multi-dimensional, the various axes correspond to various variables, with the degree in each axis being determined by the associated index.
The second parameter āmāĀ is theĀ integrationāsĀ order and itĀ should be positive. The integration constant(s)Ā k is the third parameter. The first value in the list is the value of the first integral at ālbndā (the lower bound of the integral which is an optional parameter having a default value zero(0)), the second value is the value of theĀ second integral, and so on.Ā when the value of m == 1, we can use a single scalar rather than using a list.Ā
ālbndā is the fourthĀ parameter andĀ is the lower bound of the integral Ā (The default value is 0). āsclā isĀ the fifth parameter and itās a scalar. Before adding the integration constant, the result of each integration is multiplied by āsclāĀ (the default is 1). The axis parameter, which is the sixth parameter, is an axis across which the integral is calculated.
Parameters :Ā
- arr : (an array_like structure containing Hermite_e series coefficients)
- m : integer, optional parameter
- k : {[], list, scalar}, optional parameter
- lbnd : scalar, optional parameter
- scl : scalar, optional parameter
- axis : integer, optional parameter
Returns : ndarray
Raises : ValueError (if m < 0, len(k) > m, np.ndim(lbnd) != 0, or np.ndim(scl) != 0)
Example 1 :
Importing NumPy and Ā Hermite_e libraries, create a multidimensional array of coefficients and then use hermite_e.hermeint()Ā
Python3
# import hermite_e librariesfrom numpy.polynomial import hermite_e as hĀ
# create a multidimensional array # 'arr' of coefficientsarr = [[0, 1, 2],[3, 4, 5]]Ā
# integrate a Hermite_e series using # hermite_e.hermeint() functionprint(h.hermeint(arr, m=2, k=[1, 2], lbnd=-1, axis=0)) |
Output :
[[2. 2.66666667 3.33333333] [1. 2. 3. ] [0. 0.5 1. ] [0.5 0.66666667 0.83333333]]
Example 2:Ā
Python3
# import numpy and hermite_e librariesimport numpy as npfrom numpy.polynomial import hermite_eĀ
# create a multidimensional array # 'arr' of coefficientsarr = np.arange(6).reshape(2,3)Ā
# integrate a Hermite_e series using# hermite_e.hermeint() functionprint(hermite_e.hermeint(arr, axis = 0)) |
Output :
[[1.5 2. 2.5] [0. 1. 2. ] [1.5 2. 2.5]]



