Numerical integration · CMNA Laboratory

Put function evaluations where they matter most.

Gauss-Legendre quadrature does not chop the interval into equal pieces. It chooses special nodes and weights so surprisingly few evaluations can integrate polynomials very accurately.

The nodes are the method.

CMNA's Gaussian integration driver multiplies each function value by a corresponding weight and sums the result. This lab maps standard Gauss-Legendre nodes from [-1,1] onto your interval so you can see exactly where R samples the function.

Bring your own integrand

Let the nodes choose themselves.

Write f(x) in R, choose an interval and a 5-, 10-, or 20-point rule, then inspect every weighted evaluation.

RuntimePreparing R…
RDefine f(x)

nodexf(x)weightcontribution
Book§5.3 · Gaussian Integration · pp. 141–144Book details
CMNA packagegaussintgauss.legendre
TeachingInstructor notes and chapter contextOpen teaching material
Numerical ZooWorked problems