Convert a Polynomial to Hermite Series Using NumPy
In this article, we will discuss how to convert a Polynomial to Hermite series using NumPy.
Example:
Polynomial: [4 2 3 6]
Coefficients of the converted equivalent Hermite series : [5.5 5.5 0.75 0.75]
To convert a polynomial to Hermite series we need to use numpy methods hermite.poly2herm(). We can get the hermite series coefficient from polynomial by using np.poly2herm() method.
Syntax : np.poly2herm(polynomial)
Return : Return the coefficient of hermite series.
Example 1: Convert to Physicist’s Hermite Series
Python3
import numpy as np
from numpy.polynomial import hermite
pol = np.array([ 4 , 2 , 3 , 6 ])
converted = hermite.poly2herm(pol)
print ( "Coefficients of the defined polynomial:" , pol)
print ( "Converting by Physicist's Hermite series.." )
print ("Coefficients of the converted\
equivalent Hermite series :", converted)
|
Output:
Coefficients of the defined polynomial: [4 2 3 6]
Converting by Physicist’s Hermite series..
Coefficients of the converted equivalent Hermite series : [5.5 5.5 0.75 0.75]
Example 2: Convert to Probabilist’s Hermite Series
Python3
import numpy as np
from numpy.polynomial import hermite_e
pol = np.array([ 4 , 2 , 3 , 6 ])
converted = hermite_e.poly2herme(pol)
print ( "Coefficients of the defined polynomial:" , pol)
print ( "Converting by Probabilist's Hermite series.." )
print ("Coefficients of the converted \
equivalent Hermite series :", converted)
|
Output:
Coefficients of the defined polynomial: [4 2 3 6]
Converting by Probabilist’s Hermite series..
Coefficients of the converted equivalent Hermite series : [ 7. 20. 3. 6.]
Last Updated :
25 Apr, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...