adaptive-cubature: Multidimensional integration

[ gpl, library, numerical ] [ Propose Tags ] [ Report a vulnerability ]

Adaptive integration of a multivariate function on a hyperrectangle.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5) [details]
License GPL-3.0-only
Copyright 2023 Stéphane Laurent
Author Stéphane Laurent
Maintainer laurent_step@outlook.fr
Category Numerical
Home page https://github.com/stla/adaptive-cubature#readme
Source repo head: git clone https://github.com/stla/adaptive-cubature
Uploaded by stla at 2023-09-15T13:16:11Z
Distributions NixOS:0.1.1.0
Downloads 109 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-15 [all 1 reports]

Readme for adaptive-cubature-0.1.0.0

[back to package description]

adaptive-cubature

Adaptive integration of a multivariate function on an axis-aligned hyperrectangle.


This package is powered by the C library cubature. Follow the link for details.

Usage

cubature :: Char                 -- ^ cubature version, 'h' or 'p'
         -> ([Double] -> Double) -- ^ integrand
         -> Int                  -- ^ dimension (number of variables)
         -> [Double]             -- ^ lower limits of integration
         -> [Double]             -- ^ upper limits of integration
         -> Double               -- ^ desired relative error
         -> IO Result            -- ^ output: integral value and error estimate

Example

fExample :: [Double] -> Double
fExample x = exp (-0.5 * (sum $ zipWith (*) x x))

example :: IO Result -- should give 2pi ≈ 6.283185307179586
example = cubature 'h' fExample 2 [-6, -6] [6, 6] 1e-10 
-- Result {_integral = 6.283185282383672, _error = 6.280185128024888e-10}