Open In App

Python | Numpy np.poly2lag() method

Last Updated : 06 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of np.poly2lag() method, we can get the laguerre series coefficient from a given polynomial.

Syntax : np.poly2lag(polynomial)
Return : Return the coefficient of laguerre series.

Example #1 :
In this example we can see that by using np.poly2lag() method, we are able to get the coefficients of laguerre series from polynomial using this method.




# import numpy and poly2lag
import numpy as np
from numpy.polynomial.laguerre import poly2lag
  
arr = np.array([0.1, 0.2, 0.3, 0.4, 0.5])
# using np.poly2lag() method
ans = poly2lag(arr)
  
print(ans)


Output :

[ 15.3 -56.6 79.8 -50.4 12. ]

Example #2 :




# import numpy and poly2lag
import numpy as np
from numpy.polynomial.laguerre import poly2lag
  
arr = np.array([-0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5])
# using np.poly2lag() method
ans = poly2lag(arr)
  
print(ans)


Output :

[ 1.97272290e+06 -1.95546092e+07 8.72343894e+07 -2.30634853e+08
4.00196230e+08 -4.76216928e+08 3.93562584e+08 -2.23051248e+08
8.29664640e+07 -1.82891520e+07 1.81440000e+06]


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads