Open In App

Python | Numpy np.hermfromroots() method

Last Updated : 29 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of np.hermfromroots() method, we can get the hermite series coefficient from given roots by using np.hermfromroots() method.

Syntax : np.hermfromroots(roots)
Return : Return the coefficient of hermite series.

Example #1 :
In this example we can see that by using np.hermfromroots() method, we are able to get the coefficient of hermite series from given roots by using this method.




# import numpy and hermfromroot
import numpy as np
from numpy.polynomial.hermite import hermfromroots
  
roots = np.array([0.1, 2, 0.3, 4])
# using np.hermfromroots() method
gfg = hermfromroots(roots)
  
print(gfg)


Output :

[6.205 -6.49 3.3575 -0.8 0.0625]

Example #2 :




# import numpy and hermfromroot
import numpy as np
from numpy.polynomial.hermite import hermfromroots
  
roots = np.array([1, 2, 3, 4, 1.0001])
# using np.hermfromroots() method
gfg = hermfromroots(roots)
  
print(gfg)


Output :

[-7.4754225e+01 7.2628250e+01 -2.9500950e+01 6.2501250e+00
-6.8750625e-01 3.1250000e-02]


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads