Integrate a Hermite_e series Over Axis 0 using Numpy in Python
Last Updated :
28 Jun, 2022
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 libraries
from numpy.polynomial import hermite_e as h
# create a multidimensional array
# 'arr' of coefficients
arr = [[0, 1, 2],[3, 4, 5]]
# integrate a Hermite_e series using
# hermite_e.hermeint() function
print(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 libraries
import numpy as np
from numpy.polynomial import hermite_e
# create a multidimensional array
# 'arr' of coefficients
arr = np.arange(6).reshape(2,3)
# integrate a Hermite_e series using
# hermite_e.hermeint() function
print(hermite_e.hermeint(arr, axis = 0))
Output :
[[1.5 2. 2.5]
[0. 1. 2. ]
[1.5 2. 2.5]]
Similar Reads
Integrate a Legendre series over axis 0 using NumPy in Python In this article, we will cover how to integrate a Legendre series over axis 0 using NumPy in Python. polynomial.legendre.legint method The polynomial.legendre.legint() method from the NumPy library is used to Integrate a Legendre series over axis 0 in python.The resulting series is multiplied by scl
3 min read
Add one Hermite series to another using NumPy in Python In this article, we will cover how to add one Hermite series to another using NumPy in Python. np.polynomial.hermite.hermadd method The numpy.polynomial.hermite.hermadd() method from the NumPy library is used to add one Hermite series to another. The sum of two Hermite series (c1 + c2) is returned.
3 min read
Evaluate a Hermite series at list of points x using NumPy in Python In this article, we will be looking toward the approach to evaluating a Hermite series at a list of points x in Python and NumPy. Example: List: [6,7,8,9,10] Result: [102175. 191631. 329175. 529399. 808815.] Explanation: Hermite series at points x.NumPy.polynomial.hermite.hermval() method To evaluat
2 min read
Divide one Hermite series by another in Python using NumPy In this article, we are going to see how to divide one Hermite series by another in Python using NumPy. The numpy hermdiv() method helps us divide one Hermite series by another. The quotient and remainder of two Hermite series, c1 / c2, are returned. The arguments are a series of coefficients from l
3 min read
Evaluate a Hermite_e series at points x in using NumPy Python In this article, we will cover how to evaluate a Hermite_e series at points x using NumPy in Python. numpy.polynomial.hermite.hermval The numpy.polynomial.hermite.hermval() method from the NumPy library is used to evaluate a Hermite series at points x. If the parameter x is a tuple or a list, it is
2 min read