QuadratureRules
This package provides quadrature rules for numerical integration, e.g., in finite element methods or variational integrators. It provides a unified interface for quadrature rules from different sources and algorithms for the computation of quadrature rules with an arbitrary number of nodes and weights in arbitrary precision.
Installation
QuadratureRules.jl and all of its dependencies can be installed via the Julia REPL by typing
]add QuadratureRulesBasic Usage
After loading the Quadrature Rule module by
julia> using QuadratureRulesa QuadratureRule can be created by calling any one of the provided constructors, for example
julia> quad = TrapezoidalQuadrature()
QuadratureRule{Float64,2}(2, [0.0, 1.0], [0.5, 0.5])The QuadratureRule type has the following fields:
orderthe order of the method,nodesthe nodes,weightsthe weights.
A functor is defined, which integrates functions f(x) using the quadrature rule:
julia> quad(x -> x^2)
0.5There are several convenience functions for accessing the fields:
nnodes(::QuadratureRule{T,N}) where {T,N} = Nnodes(quad::QuadratureRule) = quad.nodesorder(quad::QuadratureRule) = quad.orderweights(quad::QuadratureRule) = quad.weights
as well as a function for looping over all nodes and weights:
Base.eachindex(quad::QuadratureRule) = eachindex(quad.nodes, quad.weights)
Quadrature Rules
There are several pre-tabulated quadrature rules:
as well as functions for generating quadrature rules on the fly:
ClenshawCurtisQuadratureGaussChebyshevQuadratureGaussLegendreQuadratureLobattoChebyshevQuadratureLobattoLegendreQuadrature
References
If you use QuadratureRules.jl in your work, please consider citing it by
@misc{Kraus:2020:QuadratureRules,
title={QuadratureRules.jl: A Collection of Quadrature Rules in Julia},
author={Kraus, Michael},
year={2020},
howpublished={\url{https://github.com/JuliaGNI/QuadratureRules.jl}},
doi={10.5281/zenodo.4310382}
}