-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast robust numeric integration via tanh-sinh quadrature -- -- Fast robust numeric integration via tanh-sinh quadrature @package integration @version 0.1 -- | An implementation of Takahashi and Mori's Tanh-Sinh quadrature. -- -- http://en.wikipedia.org/wiki/Tanh-sinh_quadrature -- -- Tanh-Sinh provides good results across a wide-range of functions and -- is pretty much as close to a universal quadrature scheme as is -- possible. It is also robust against error in the presence of -- singularities at the endpoints of the integral. -- -- The change of basis is precomputed, and information is gained -- quadratically in the number of digits. -- --
-- ghci> absolute 1e-6 $ parTrap sin (pi/2) pi
-- Result {result = 0.9999999999999312, errorEstimate = 2.721789573237518e-10, evalutions = 25}
--
--
-- -- ghci> confidence $ absolute 1e-6 $ trap sin (pi/2) pi -- (0.9999999997277522,1.0000000002721101) ---- -- Unlike most quadrature schemes, this method is also fairly robust -- against singularities at the end points. -- --
-- ghci> absolute 1e-6 $ trap (recip . sqrt . sin) 0 1
-- Result {result = 2.03480500404275, errorEstimate = 6.349514558579017e-8, evalutions = 49}
--
--
-- See
-- http://www.johndcook.com/blog/2012/02/21/care-and-treatment-of-singularities/
-- for a sense of how more naive quadrature schemes fare.
module Numeric.Integration.TanhSinh
-- | Integration using a truncated trapezoid rule under tanh-sinh
-- quadrature
trap :: (Double -> Double) -> Double -> Double -> [Result]
-- | Integration using a truncated Simpson's rule under tanh-sinh
-- quadrature
simpson :: (Double -> Double) -> Double -> Double -> [Result]
-- | Integration using a truncated trapezoid rule and tanh-sinh quadrature
-- with a specified evaluation strategy
trap' :: Strategy [Double] -> (Double -> Double) -> Double -> Double -> [Result]
-- | Integration using a truncated Simpson's rule under tanh-sinh
-- quadrature with a specified evaluation strategy
simpson' :: Strategy [Double] -> (Double -> Double) -> Double -> Double -> [Result]
-- | Integration using a truncated trapezoid rule under tanh-sinh
-- quadrature with buffered parallel evaluation
parTrap :: (Double -> Double) -> Double -> Double -> [Result]
-- | Integration using a truncated Simpson's rule under tanh-sinh
-- quadrature with buffered parallel evaluation
parSimpson :: (Double -> Double) -> Double -> Double -> [Result]
data Result
Result :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Int -> Result
result :: Result -> {-# UNPACK #-} !Double
errorEstimate :: Result -> {-# UNPACK #-} !Double
evalutions :: Result -> {-# UNPACK #-} !Int
absolute :: Double -> [Result] -> Result
relative :: Double -> [Result] -> Result
confidence :: Result -> (Double, Double)
instance Read Result
instance Show Result
instance Eq Result
instance Ord Result
instance Show DD