All Projects → JuliaMath → HCubature.jl

JuliaMath / HCubature.jl

Licence: other
pure-Julia multidimensional h-adaptive integration

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to HCubature.jl

Cuba.jl
Library for multidimensional numerical integration with four independent algorithms: Vegas, Suave, Divonne, and Cuhre.
Stars: ✭ 65 (-45.38%)
Mutual labels:  integration, math, numerical-integration, cubature
Angourimath
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET
Stars: ✭ 266 (+123.53%)
Mutual labels:  integration, math
Cubature.jl
One- and multi-dimensional adaptive integration routines for the Julia language
Stars: ✭ 79 (-33.61%)
Mutual labels:  integration, math
Nerdamer
a symbolic math expression evaluator for javascript
Stars: ✭ 322 (+170.59%)
Mutual labels:  integration, math
Mathnet Numerics
Math.NET Numerics
Stars: ✭ 2,688 (+2158.82%)
Mutual labels:  integration, math
AlgebraicPetri.jl
Build Petri net models compositionally
Stars: ✭ 49 (-58.82%)
Mutual labels:  math
vec-la-fp
↗️ A tiny (functional) 2d linear algebra library
Stars: ✭ 21 (-82.35%)
Mutual labels:  math
decimal-eval
A tiny, safe, fast JavaScript library for decimal arithmetic expressions.
Stars: ✭ 18 (-84.87%)
Mutual labels:  math
Machine-Learning-Explained
Learn the theory, math and code behind different machine learning algorithms and techniques.
Stars: ✭ 30 (-74.79%)
Mutual labels:  math
slack-robot
Simple robot for your slack integration
Stars: ✭ 29 (-75.63%)
Mutual labels:  integration
multitrainer
A math game for children to help them learning multiplication
Stars: ✭ 22 (-81.51%)
Mutual labels:  math
panasonic smart app
Panasonic Smart App integration for Home Assistant.
Stars: ✭ 22 (-81.51%)
Mutual labels:  integration
hass-amplifi
A home assistant integration for Ubiquiti Amplifi
Stars: ✭ 17 (-85.71%)
Mutual labels:  integration
zig-gamedev
Building game development ecosystem for @ziglang!
Stars: ✭ 1,059 (+789.92%)
Mutual labels:  math
tukey
Mini stats toolkit for Clojure/Script
Stars: ✭ 17 (-85.71%)
Mutual labels:  math
mish
A no-std libm implementation in Rust
Stars: ✭ 14 (-88.24%)
Mutual labels:  math
Data-Science-Resources
A guide to getting started with Data Science and ML.
Stars: ✭ 17 (-85.71%)
Mutual labels:  math
cli
Do not program API integrations! Install them.
Stars: ✭ 14 (-88.24%)
Mutual labels:  integration
mathblog
A package for managing a static, mathematically-inclined web log
Stars: ✭ 25 (-78.99%)
Mutual labels:  math
mimesis-factory
Mimesis integration with factory_boy
Stars: ✭ 42 (-64.71%)
Mutual labels:  integration

HCubature

The HCubature module is a pure-Julia implementation of multidimensional "h-adaptive" integration. That is, given an n-dimensional integral

n-dimensional integral

then hcubature(f, a, b) computes the integral, adaptively subdividing the integration volume into smaller and smaller pieces until convergence is achieved to the desired tolerance (specified by optional rtol and atol keyword arguments, described in more detail below.

Because hcubature is written purely in Julia, the integrand f(x) can return any vector-like object (technically, any type supporting +, -, * real, and norm: a Banach space). You can integrate real, complex, and matrix-valued integrands, for example.

Usage

Assuming you've installed the HCubature package (via Pkg.add) and loaded it with using HCubature, you can then use it by calling the hcubature function:

hcubature

hcubature(f, a, b; norm=norm, rtol=sqrt(eps), atol=0, maxevals=typemax(Int), initdiv=1)

This computes the n-dimensional integral of f(x), where n == length(a) == length(b), over the hypercube whose corners are given by the vectors (or tuples) a and b. That is, dimension x[i] is integrated from a[i] to b[i]. The return value of hcubature is a tuple (I, E) of the estimated integral I and an estimated error E.

f should be a function f(x) that takes an n-dimensional vector x and returns the integrand at x. The integrand can be any type that supports +, -, * real, and norm functions. For example, the integrand can be real or complex numbers, vectors, matrices, etcetera. (For performance, the StaticArrays package is recommended for use with vector/matrix-valued integrands.)

The integrand f(x) will be always be passed an SVector{n,T}, where SVector is an efficient vector type defined in the StaticArrays package and T is a floating-point type determined by promoting the endpoint a and b coordinates to a floating-point type. (Your integrand f should be type-stable: it should always return a value of the same type, given this type of x.)

The integrand will never be evaluated exactly at the boundaries of the integration volume. (So, for example, it is possible to have an integrand that blows up at the boundaries, as long as the integral is finite, though such singularities will slow convergence.)

The integration volume is adaptively subdivided, using a cubature rule due to Genz and Malik (1980), until the estimated error E satisfies E ≤ max(rtol*norm(I), atol), i.e. rtol and atol are the relative and absolute tolerances requested, respectively. It also stops if the number of f evaluations exceeds maxevals. If neither atol nor rtol are specified, the default rtol is the square root of the precision eps(T) of the coordinate type T described above. Initially, the volume is divided into initdiv segments along each dimension.

The error is estimated by norm(I - I′), where I′ is an alternative estimated integral (via an "embedded" lower-order cubature rule.) By default, the norm function used (for both this and the convergence test above) is norm, but you can pass an alternative norm by the norm keyword argument. (This is especially useful when f returns a vector of integrands with different scalings.)

hquadrature

hquadrature(f, a, b; norm=norm, rtol=sqrt(eps), atol=0, maxevals=typemax(Int), initdiv=1)

Compute the (1d) integral of f(x) from a to b. The return value of hcubature is a tuple (I, E) of the estimated integral I and an estimated error E.

The other parameters are the same as hcubature (above). hquadrature is just a convenience wrapper around hcubature so that you can work with scalar x, a, and b, rather than 1-component vectors.

Alternatively, for 1d integrals you can import the QuadGK module and call the quadgk function, which provides additional flexibility e.g. in choosing the order of the quadrature rule. (QuadGK is used internally anyway by HCubature to compute the quadrature rule.)

Algorithm

The algorithm of hcubature is based on the one described in:

Author and Copyright

HCubature was written by Steven G. Johnson (SGJ), and is free/open-source software under the MIT/expat license.

SGJ also wrote an earlier C implementation of a similar algorithm that is also callable from Julia via the Cubature.jl package. The HCubature package is a from-scratch re-implementation, not a translation, of this code, both to take advantage of unique features of Julia and to eliminate licensing restrictions arising from the use of C code taken from the HIntLib library. (In both cases, the original DCUHRE Fortran code of Genz was not examined, only the mathematical description in the papers.)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].