Reference
IteratedIntegration.AbstractIteratedLimits
— TypeAbstractIteratedLimits{d,T}
Supertype for limits of integration over a domain with elements of type SVector{d,T}
. In order to work with iterated integration, the following methods must be implemented
Interface
segments
: returns an iterator over intervals to integrate in the current dimensionfixandeliminate
: return another limit object with one of the variables of integration eliminated
the domain of integration must be convex.
IteratedIntegration.CubicLimits
— TypeCubicLimits(a, b)
Store integration limit information for a hypercube with vertices a
and b
. which can be can be real numbers, tuples, or AbstractVector
s. The outermost variable of integration corresponds to the last entry.
IteratedIntegration.ProductLimits
— TypeProductLimits(lims::AbstractIteratedLimits...)
Construct a collection of limits which yields the first limit followed by the second, and so on. The inner limits are not allowed to depend on the outer ones. The outermost variable of integration should be placed first, i.e. $\int_{\Omega} \int_{\Gamma}$ should be ProductLimits(Ω, Γ)
. Although changing the order of the limits should not change the results, putting the shortest limits first may save nested_quadgk
some work.
IteratedIntegration.TetrahedralLimits
— TypeTetrahedralLimits(a::NTuple{d}) where d
A parametrization of the integration limits for a tetrahedron whose vertices are
( 0.0, 0.0, ..., 0.0)
( 0.0, 0.0, ..., a[d])
…
( 0.0, a[2], ..., a[d])
(a[1], a[2], ..., a[d])
IteratedIntegration.TranslatedLimits
— TypeTranslatedLimits(lims::AbstractIteratedLimits{d}, t::NTuple{d}) where d
Returns the limits of lims
translated by offsets in t
.
IteratedIntegration.fixandeliminate
— Functionfixandeliminate(l::AbstractIteratedLimits, x)
Fix the outermost variable of integration and return the inner limits.
Realizations of type T<:AbstractIteratedLimits
only have to implement a method with signature fixandeliminate(::T, ::Number)
. The result must also have dimension one less than the input, and this should only be called when ndims
= 1
IteratedIntegration.load_limits
— Functionload_limits(obj)
Load integration limits from an object. Serves as an api hook for package extensions with specialized limit types.
IteratedIntegration.nested_quad
— Methodnested_quad(f, a, b; kwargs...)
nested_quad(f, l::AbstractIteratedLimits{d,T}; routine=quadgk, kwargs...) where {d,T}
Calls QuadGK
to perform iterated 1D integration of f
over a compact domain parametrized by AbstractIteratedLimits
l
. In the case two points a
and b
are passed, the integration region becomes the hypercube with those extremal vertices (which mimics hcubature
).
Returns a tuple (I, E)
of the estimated integral and estimated error.
Keyword options include a relative error tolerance rtol
(if atol==0
, defaults to sqrt(eps)
in the precision of the norm of the return type), an absolute error tolerance atol
(defaults to 0), a maximum number of function evaluations maxevals
for each nested integral (defaults to 10^7
), and the order
of the integration rule (defaults to 7).
The algorithm is an adaptive Gauss-Kronrod integration technique: the integral in each interval is estimated using a Kronrod rule (2*order+1
points) and the error is estimated using an embedded Gauss rule (order
points). The interval with the largest error is then subdivided into two intervals and the process is repeated until the desired error tolerance is achieved. This 1D procedure is applied recursively to each variable of integration in an order determined by l
to obtain the multi-dimensional integral.
IteratedIntegration.segments
— Functionsegments(::AbstractLimits, dim)
Return an iterator over endpoints and breakpoints in the limits along dimension dim
. They must be sorted.