
gaussLaguerre(n, a = 0)
[0, Inf[
.x
in the integrand: must be greater or equal
to 0, otherwise the integral would not converge.x
, the nodes or points in[0, Inf[
, and
w
, the weights applied at these nodes. x
and w
are obtained from a tridiagonal eigenvalue problem.
The value of such an integral is then sum(w*f(x))
.
Trefethen, L. N. (2000). Spectral Methods in Matlab. SIAM, Society for Industrial and Applied Mathematics.
gaussLegendre
, gaussHermite
cc <- gaussLaguerre(7)
# integrate exp(-x) from 0 to Inf
sum(cc$w) # 1
# integrate x^2 * exp(-x) # integral x^n * exp(-x) is n!
sum(cc$w) # 2
# integrate sin(x) * exp(-x)
cc <- gaussLaguerre(17, 0) # we need more nodes
sum(cc$w * sin(cc$x)) #=> 0.499999999994907 , should be 0.5
Run the code above in your browser using DataLab