FastGaussQuadrature.jl

Abstract

FastGaussQuadrature.jl is a Julia package to compute n-point Gauss quadrature nodes and weights to 16-digit accuracy and in O(n) time. So far the package includes gausschebyshev(), gausslegendre(), gaussjacobi(), gaussradau(), gausslobatto(), gausslaguerre(), and gausshermite(). This package is heavily influenced by Chebfun.

An introduction to Gauss quadrature can be found here. For a quirky account on the history of computing Gauss-Legendre quadrature, see [6].

Our Aims

  • The fastest Julia code for Gauss quadrature nodes and weights (without tabulation).
  • Change the perception that Gauss quadrature rules are expensive to compute.

First example

To check an integral

\[\int_{-1}^{1} x^4 dx = \frac{2}{5}\]

by numerically, try following code.

julia> using FastGaussQuadrature, LinearAlgebra
julia> x, w = gausslegendre(3)([-0.7745966692414834, 0.0, 0.7745966692414834], [0.5555555555555556, 0.8888888888888888, 0.5555555555555556])
julia> f(x) = x^4f (generic function with 1 method)
julia> I = dot(w, f.(x))0.4000000000000001
julia> I ≈ 2/5true