Generate a Hermite_e series with given roots using NumPy in Python
In this article, we will cover how to raise a Hermite_e series to power in Python using NumPy.
We use the hermite_e.hermefromroots() function present in the NumPy module of python to construct a Hermite_e series with the given roots. A 1-D array of coefficients is returned by the following function. we will get a real array if all of the roots are real; if any of the roots are complex than we will get a complex array even if all of the coefficients in the result are real.
- Sequence containing the roots.
Returns : ndarray ,1-D array of coefficients. If all roots are real then out is a real array, if some of the roots are complex, then out is complex
Steps to generate the Hermite_e series with given roots :
Step 1: Importing the hermite_e library.
from numpy.polynomial import hermite_e
Step 2: Create a 1-dimensional array of roots.
arr = [1,2,0]
Step 3: Finally generate a Hermite_e series with the array of roots.
In this example, we are creating a simple array to return a Hermite_e series with the given roots using hermefromroots.
[1. 1. 1. 1.]
In this example, we are creating an array with the complex number to return a Hermite_e series with the given complex roots using hermefromroots.
[-127.-165.j -1. -25.j 36. +35.j -11. -5.j 1. +0.j]
In this example, we are creating a NumPy array of 8 elements and returning the Hermite_e series with the given roots using hermefromroots.
[ 2.34086e+05 -3.83256e+05 2.77808e+05 -1.16424e+05 3.08490e+04
-5.29200e+03 5.74000e+02 -3.60000e+01 1.00000e+00]
Please Login to comment...