summaryrefslogtreecommitdiff
path: root/lib/GSL/Special.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/GSL/Special.hs')
-rw-r--r--lib/GSL/Special.hs52
1 files changed, 4 insertions, 48 deletions
diff --git a/lib/GSL/Special.hs b/lib/GSL/Special.hs
index 9eaf733..bdee1b2 100644
--- a/lib/GSL/Special.hs
+++ b/lib/GSL/Special.hs
@@ -41,6 +41,7 @@ module GSL.Special (
41, module GSL.Special.Synchrotron 41, module GSL.Special.Synchrotron
42, module GSL.Special.Trig 42, module GSL.Special.Trig
43, module GSL.Special.Zeta 43, module GSL.Special.Zeta
44, setErrorHandlerOff
44) 45)
45where 46where
46 47
@@ -74,51 +75,6 @@ import GSL.Special.Trig
74import GSL.Special.Zeta 75import GSL.Special.Zeta
75 76
76 77
77-------------------- simple functions -------------------------- 78-- | This action removes the GSL default error handler which aborts the program, so that
78 79-- GSL errors can be handled by Haskell (using Control.Exception) and ghci doesn't abort.
79{- | The error function (/gsl_sf_erf/), defined as 2\/ \\sqrt \\pi * \int\_0\^t \\exp -t\^2 dt. 80foreign import ccall "gsl-aux.h no_abort_on_error" setErrorHandlerOff :: IO ()
80
81@> erf 1.5
820.9661051464753108@
83
84-}
85foreign import ccall "gsl-aux.h gsl_sf_erf" erf :: Double -> Double
86
87{- | The Gaussian probability density function (/gsl_sf_erf_Z/), defined as (1\/\\sqrt\{2\\pi\}) \\exp(-x\^2\/2).
88
89>> erf_Z 1.5
90>0.12951759566589172
91
92-}
93foreign import ccall "gsl-aux.h gsl_sf_erf_Z" erf_Z :: Double -> Double
94
95-------------------- functions returning sf_result -------------
96
97{- | The regular cylindrical Bessel function of zeroth order, J_0(x). This is
98 the example in the GSL manual, returning the value of the function and
99 the error term:
100
101@\> bessel_J0_e 5.0
102(-0.1775967713143383,1.9302109579684196e-16)@
103
104-}
105bessel_J0_e :: Double -> (Double,Double)
106bessel_J0_e x = createSFR "bessel_J0_e" (gsl_sf_bessel_J0_e x)
107foreign import ccall "gsl-aux.h gsl_sf_bessel_J0_e" gsl_sf_bessel_J0_e :: Double -> Ptr Double -> IO Int
108
109-------------------- functions returning sf_result_e10 -------------
110
111{- | (From the GSL manual) \"This function computes the exponential \exp(x) using the @gsl_sf_result_e10@ type to return a result with extended range. This function may be useful if the value of \exp(x) would overflow the numeric range of double\".
112
113For example:
114
115@\> exp_e10_e 30.0
116(1.0686474581524432,1.4711818964275088e-14,13)@
117
118@\> exp 30.0
1191.0686474581524463e13@
120
121-}
122exp_e10_e :: Double -> (Double,Int,Double)
123exp_e10_e x = createSFR_E10 "exp_e10_e" (gsl_sf_exp_e10_e x)
124foreign import ccall "gsl-aux.h gsl_sf_exp_e10_e" gsl_sf_exp_e10_e :: Double -> Ptr Double -> IO Int