Python | Numpy np.lagfromroots() method
np.lagfromroots()
method is used to generate a Laguerre series with given roots.
Syntax : np.lagfromroots(roots)
Parameters:
roots :[array_like] Input sequence containing the roots.
Return : [ndarray] 1-D array of coefficients of Laguerre series.
Code #1 :
import numpy as np
import numpy.polynomial.laguerre as geek
roots = ( 2 , 4 , 8 )
res = geek.lagfromroots(roots)
print (res)
|
Output:
[-30. -18. -10. -6.]
Code #2 :
import numpy as np
import numpy.polynomial.laguerre as geek
s = ( 1 , 2 , 3 , 4 , 5 )
res = geek.lagfromroots(s)
print (res)
|
Output:
[ -26. -64. 120. -270. 240. -120.]
Last Updated :
29 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...