Friday, October 3, 2025
HomeLanguagesPython | Numpy np.laggauss() method

Python | Numpy np.laggauss() method

np.laggauss() Computes the sample points and weights for Gauss-Laguerre quadrature. These sample points and weights will correctly integrate polynomials of degree 2*deg - 1 or less over the interval [0, inf] with the weight function f(x) = exp(-x)

Syntax : np.laggauss(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 :




# Python program explaining
# numpy.laggauss() method 
    
# importing numpy as np  
# and numpy.polynomial.laguerre module as geek 
import numpy as np 
import numpy.polynomial.laguerre as geek
    
# Input degree = 2
  
degree = 2 
     
# using np.laggauss() method 
res = geek.laggauss(degree) 
  
# Resulting array of sample point and weight
print (res) 


Output:

(array([ 0.58578644,  3.41421356]), array([ 0.85355339,  0.14644661]))

 

Code #2 :




# Python program explaining
# numpy.laggauss() method 
    
# importing numpy as np  
# and numpy.polynomial.laguerre module as geek 
import numpy as np 
import numpy.polynomial.laguerre as geek
    
# Input degree
degree = 3
    
# using np.laggauss() method 
res = geek.laggauss(degree) 
  
# Resulting array of sample point and weight
print (res) 


Output:

(array([ 0.41577456,  2.29428036,  6.28994508]), array([ 0.71109301,  0.27851773,  0.01038926]))

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32332 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11868 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11929 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7080 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS