chaospy.quadrature.patterson¶
- chaospy.quadrature.patterson(order, domain)[source]¶
Generate Gauss-Patterson quadrature abscissa and weights.
The Gauss-Patterson quadrature is a nested family which begins with the Gauss-Legendre rules of orders 1 and 3, and then successively inserts one new abscissa in each subinterval. Thus, after the second rule, the Gauss-Patterson rules do not have the super-high precision of the Gauss-Legendre rules. They trade this precision in exchange for the advantages of nestedness. This means that Gauss-Patterson rules are only available for orders of 0, 2, 6, 14, 30, 62, 126, 254 or 510.
- Args:
- order (int):
The quadrature order. Must be in the interval (0, 8).
- domain (chaospy.Distribution, numpy.ndarray):
Either distribution or bounding of interval to integrate over.
- Returns:
- abscissas: (numpy.ndarray):
The quadrature points for where to evaluate the model function with
abscissas.shape == (len(dist), N)
whereN
is the number of samples.- weights: (numpy.ndarray):
The quadrature weights with
weights.shape == (N,)
.
- Notes:
This code is an adapted of John Burkardt’s implementation in Fortran. The algorithm is taken from “Handbook of Computational Methods for Integration”[6], and “The Optimal Addition of Points to Quadrature Formulae”[7].
- Example:
>>> distribution = chaospy.Iid(chaospy.Uniform(0, 1), 2) >>> abscissas, weights = chaospy.quadrature.patterson(1, distribution) >>> abscissas.round(3) array([[0.113, 0.113, 0.113, 0.5 , 0.5 , 0.5 , 0.887, 0.887, 0.887], [0.113, 0.5 , 0.887, 0.113, 0.5 , 0.887, 0.113, 0.5 , 0.887]]) >>> weights.round(3) array([0.077, 0.123, 0.077, 0.123, 0.198, 0.123, 0.077, 0.123, 0.077])