chaospy.quadrature.legendre

chaospy.quadrature.legendre(order, lower=- 1.0, upper=1.0, physicist=False)[source]

Gauss-Legendre quadrature rule.

Compute the sample points and weights for Gauss-Legendre quadrature. The sample points are the roots of the N-th degree Legendre polynomial. These sample points and weights correctly integrate polynomials of degree \(2N-1\) or less over the interval [lower, upper].

Gaussian quadrature come in two variants: physicist and probabilist. For Gauss-Legendre physicist means a weight function constant 1 and weights sum to upper-lower, and probabilist means weight function constant 1/(upper-lower) while weights sum to 1.

Args:
order (int):

The quadrature order.

lower (float):

Lower bound for the integration interval.

upper (float):

Upper bound for the integration interval.

physicist (bool):

Use physicist weights instead of probabilist.

Returns:
abscissas (numpy.ndarray):

The order+1 quadrature points for where to evaluate the model function with.

weights (numpy.ndarray):

The quadrature weights associated with each abscissas.

Examples:
>>> abscissas, weights = chaospy.quadrature.legendre(2)
>>> abscissas
array([[-0.77459667,  0.        ,  0.77459667]])
>>> weights
array([0.27777778, 0.44444444, 0.27777778])
See also:

chaospy.quadrature.gaussian() chaospy.quadrature.legendre_proxy()