Python | Numpy np.legroots() method Last Updated : 31 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report np.legroots() method is used to compute the roots of a legendre series.Return the roots of the polynomial. Syntax : np.legroots(c) Parameters: c :[array_like] 1-D arrays of legendre series coefficients. Return : [ndarray] Array of the roots of the series. If all the roots are real, then out is also real, otherwise it is complex. Code #1 : Python3 # Python program explaining # numpy.legroots() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # Input legendre series coefficients s = (2, 4, 8) # using np.legroots() method res = geek.legroots(s) # Resulting legendre series coefficient print (res) Output: [-0.60762522 0.27429189] Code #2 : Python3 # Python program explaining # numpy.legroot() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # legendre series coefficients s = (1, 2, 3, 4, 5) # using np.legroots() method res = geek.legroots(s) # Resulting legendre series print (res) Output: [-0.86884116 -0.48972874 0.21530729 0.68611975] Comment More infoAdvertise with us Next Article Python | Numpy np.lagfromroots() method J jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads Python | Numpy np.lagroots() method np.lagroots() method is used to compute the roots of a Laguerre series.Return the roots of the polynomial. Syntax : np.lagroots(c) Parameters: c :[array_like] 1-D arrays of Laguerre series coefficients ordered from low to high. Return : [ndarray] Array of the roots of the series. If all the roots ar 1 min read Python | Numpy np.legfromroots() method np.legfromroots() method is used to generate a legendre series with given roots. Syntax : np.legfromroots(roots) Parameters: roots :[array_like] Input sequence containing the roots. Return : [ndarray] 1-D array of coefficients of legendre series. Code #1 : Python3 # Python program explaining # numpy 1 min read Python | Numpy np.legzero() method np.legzero() method can be used instead of np.zeros for creating a array whose elements are 0. Syntax : np.legzero() Return : Return array([0]) Example #1 : Python3 1=1 # Python program explaining # numpy.legzero() method # import numpy and legzero import numpy as np from numpy.polynomial.legendre i 1 min read 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 : Python3 # Python program explaining # numpy 1 min read Python | Numpy np.legsub() method np.legub() method is used to subtract one Legendre series to another.It returns the difference of two Legendre series c1 - c2. Syntax : np.legub(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre series coeffici 1 min read Python | Numpy np.leg2poly() method np.leg2poly() method is used to convert a legendre series to a polynomial. Syntax : np.leg2poly(c) Parameters: c :[array_like] 1-D arrays of legendre series coefficients ordered from low to high. Return : [ndarray] 1-D array containing the coefficients of the equivalent polynomial. Code #1 : Python3 1 min read Like