Python | Numpy np.leggauss() method
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
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 :
(array([-0.57735027, 0.57735027]), array([ 1., 1.]))
Code #2 :
(array([-0.77459667, 0., 0.77459667]), array([ 0.55555556, 0.88888889, 0.55555556]))
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course