Python | Numpy np.leggauss() method Last Updated : 31 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report np.leggauss() Computes the sample points and weights for Gauss-legendre quadrature. These sample points and weights will correctly integrate polynomials of degree 2*deg - 1 or less over the interval [-1, 1] with the weight function f(x) = 1 Syntax : np.leggauss(deg) Parameters: deg :[int] Number of sample points and weights. It must be >= 1. Return : 1.[ndarray] 1-D ndarray containing the sample points. 2.[ndarray] 1-D ndarray containing the weights. Code #1 : Python3 # Python program explaining # numpy.leggauss() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # Input degree = 2 degree = 2 # using np.leggauss() method res = geek.leggauss(degree) # Resulting array of sample point and weight print (res) Output: (array([-0.57735027, 0.57735027]), array([ 1., 1.])) Code #2 : Python3 # Python program explaining # numpy.leggauss() method # importing numpy as np # and numpy.polynomial.legendre module as geek import numpy as np import numpy.polynomial.legendre as geek # Input degree degree = 3 # using np.leggauss() method res = geek.leggauss(degree) # Resulting array of sample point and weight print (res) Output: (array([-0.77459667, 0., 0.77459667]), array([ 0.55555556, 0.88888889, 0.55555556])) Comment More infoAdvertise with us Next Article Python | Numpy np.legadd() method J jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads Python | Numpy np.legmul() method np.legmul() method is used to multiply one Legendre series to another.It returns the product of two Legendre series c1 * c2. Syntax : np.legmul(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre series coefficie 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.legadd() method np.legadd() method is used to add one Legendre series to another.It returns the sum of two Legendre series c1 + c2. Syntax : np.legadd(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Array representing the Legendre se 1 min read Python | Numpy np.legroots() method 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 1 min read Python | Numpy np.legdiv() method np.legdiv() method is used to divide one Legendre series to another.It returns the quotient-with-remainder of two Legendre series c1 / c2. Syntax : np.legdiv(c1, c2) Parameters: c1, c2 :[ array_like ] 1-D arrays of Legendre series coefficients ordered from low to high. Return : [ndarray] Legendre se 1 min read Python | Numpy np.legvander() method np.legvander() method is used to returns the Vandermonde matrix of degree deg and sample points x. Syntax : np.legvander(x, deg) Parameters: x :[ array_like ] Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is c 1 min read Like