hmatrix-gsl-0.19.0.1: Numerical computation

Copyright(c) Alberto Ruiz 2006
LicenseGPL
MaintainerAlberto Ruiz
Stabilityprovisional
Safe HaskellNone
LanguageHaskell2010

Numeric.GSL.Integration

Description

Synopsis

Documentation

integrateQNG Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> (Double -> Double)

function to be integrated on the interval (a,b)

-> Double

a

-> Double

b

-> (Double, Double)

result of the integration and error

Numerical integration using gsl_integration_qng (useful for fast integration of smooth functions). For example:

>>> let quad = integrateQNG 1E-6
>>> quad (\x -> 4/(1+x*x)) 0 1
(3.141592653589793,3.487868498008632e-14)

integrateQAGS Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> Int

size of auxiliary workspace (e.g. 1000)

-> (Double -> Double)

function to be integrated on the interval (a,b)

-> Double

a

-> Double

b

-> (Double, Double)

result of the integration and error

Numerical integration using gsl_integration_qags (adaptive integration with singularities). For example:

>>> let quad = integrateQAGS 1E-9 1000
>>> let f a x = x**(-0.5) * log (a*x)
>>> quad (f 1) 0 1
(-3.999999999999974,4.871658632055187e-13)

integrateQAGI Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> Int

size of auxiliary workspace (e.g. 1000)

-> (Double -> Double)

function to be integrated on the interval (-Inf,Inf)

-> (Double, Double)

result of the integration and error

Numerical integration using gsl_integration_qagi (integration over the infinite integral -Inf..Inf using QAGS). For example:

>>> let quad = integrateQAGI 1E-9 1000
>>> let f a x = exp(-a * x^2)
>>> quad (f 0.5)
(2.5066282746310002,6.229215880648858e-11)

integrateQAGIU Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> Int

size of auxiliary workspace (e.g. 1000)

-> (Double -> Double)

function to be integrated on the interval (a,Inf)

-> Double

a

-> (Double, Double)

result of the integration and error

Numerical integration using gsl_integration_qagiu (integration over the semi-infinite integral a..Inf). For example:

>>> let quad = integrateQAGIU 1E-9 1000
>>> let f a x = exp(-a * x^2)
>>> quad (f 0.5) 0
(1.2533141373155001,3.114607940324429e-11)

integrateQAGIL Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> Int

size of auxiliary workspace (e.g. 1000)

-> (Double -> Double)

function to be integrated on the interval (a,Inf)

-> Double

b

-> (Double, Double)

result of the integration and error

Numerical integration using gsl_integration_qagil (integration over the semi-infinite integral -Inf..b). For example:

>>> let quad = integrateQAGIL 1E-9 1000
>>> let f a x = exp(-a * x^2)
>>> quad (f 0.5) 0
(1.2533141373155001,3.114607940324429e-11)

integrateCQUAD Source #

Arguments

:: Double

precision (e.g. 1E-9)

-> Int

size of auxiliary workspace (e.g. 1000)

-> (Double -> Double)

function to be integrated on the interval (a, b)

-> Double

a

-> Double

b

-> (Double, Double, Int)

result of the integration, error and number of function evaluations performed

Numerical integration using gsl_integration_cquad (quadrature for general integrands). From the GSL manual:

CQUAD is a new doubly-adaptive general-purpose quadrature routine
which can handle most types of singularities, non-numerical function
values such as Inf or NaN, as well as some divergent integrals. It
generally requires more function evaluations than the integration
routines in QUADPACK, yet fails less often for difficult integrands.

For example:

>>> let quad = integrateCQUAD 1E-12 1000
>>> let f a x = exp(-a * x^2)
>>> quad (f 0.5) 2 5
(5.7025405463957006e-2,9.678874441303705e-16,95)

Unlike other quadrature methods, integrateCQUAD also returns the number of function evaluations required.