Gauss-Legendre quadrature rules
This library computes Gauss-Legendre quadrature points and weights for numerical integration. For more information, see:
var gaussQ = require"gauss-quadrature"console.loggaussQ2//Prints://// [ [ -0.5773502691896257, 0.5773502691896257 ], [ 1, 1 ] ]//
npm install gauss-quadrature
Computes the Gaussian quadrature points and weights for the interval [a, b].
nis the number of quartature points
ais the start of the interval (default -1)
bis the end of the interval (default +1)
b is unspecified, the interval defaults to
Returns An array with two elements,
[x, w] where:
xis the list of quadrature points
wis the list of quadrature weights
Currently numeric.js' eigen decomposition code has some bugs, so this library may fail for high numbers of quadrature points. In theory this could be avoided by using a better set of routines for computing eigenvalues/vectors or some other method for finding roots (or even by just hard coding some of the quadrature weights into a table). Until this issue gets fixed, this library is of limited use.
(c) 2013 Mikola Lysenko. MIT License