diff options
-rw-r--r-- | examples/tests.hs | 4 | ||||
-rw-r--r-- | lib/GSL/Special.hs | 11 | ||||
-rw-r--r-- | lib/GSL/gsl-aux.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/examples/tests.hs b/examples/tests.hs index eb8f50d..66afca6 100644 --- a/examples/tests.hs +++ b/examples/tests.hs | |||
@@ -298,9 +298,13 @@ exponentialTest = do | |||
298 | let expected = exp 30.0 | 298 | let expected = exp 30.0 |
299 | assertBool "exp_e10_e" ( abs (v*10^e - expected) < 4E-2 ) | 299 | assertBool "exp_e10_e" ( abs (v*10^e - expected) < 4E-2 ) |
300 | 300 | ||
301 | gammaTest = do | ||
302 | assertBool "gamma" (gamma 5 == 24.0) | ||
303 | |||
301 | tests = TestList | 304 | tests = TestList |
302 | [ TestCase $ besselTest | 305 | [ TestCase $ besselTest |
303 | , TestCase $ exponentialTest | 306 | , TestCase $ exponentialTest |
307 | , TestCase $ gammaTest | ||
304 | , TestCase $ polySolveTest | 308 | , TestCase $ polySolveTest |
305 | , TestCase $ integrateTest | 309 | , TestCase $ integrateTest |
306 | ] | 310 | ] |
diff --git a/lib/GSL/Special.hs b/lib/GSL/Special.hs index 643c499..fec96eb 100644 --- a/lib/GSL/Special.hs +++ b/lib/GSL/Special.hs | |||
@@ -19,7 +19,8 @@ module GSL.Special ( | |||
19 | erf, | 19 | erf, |
20 | erf_Z, | 20 | erf_Z, |
21 | bessel_J0_e, | 21 | bessel_J0_e, |
22 | exp_e10_e | 22 | exp_e10_e, |
23 | gamma | ||
23 | ) | 24 | ) |
24 | where | 25 | where |
25 | 26 | ||
@@ -45,6 +46,14 @@ foreign import ccall "gsl-aux.h gsl_sf_erf" erf :: Double -> Double | |||
45 | -} | 46 | -} |
46 | foreign import ccall "gsl-aux.h gsl_sf_erf_Z" erf_Z :: Double -> Double | 47 | foreign import ccall "gsl-aux.h gsl_sf_erf_Z" erf_Z :: Double -> Double |
47 | 48 | ||
49 | {- | The gamma function (/gsl_sf_gamma/), described in <http://www.gnu.org/software/gsl/manual/html_node/Gamma-Functions.html> | ||
50 | |||
51 | >> gamma 5 | ||
52 | >24.0 | ||
53 | |||
54 | -} | ||
55 | foreign import ccall "gsl-aux.h gsl_sf_gamma" gamma :: Double -> Double | ||
56 | |||
48 | ---------------------------------------------------------------- | 57 | ---------------------------------------------------------------- |
49 | -- the sf_result struct is equivalent to an array of two doubles | 58 | -- the sf_result struct is equivalent to an array of two doubles |
50 | 59 | ||
diff --git a/lib/GSL/gsl-aux.h b/lib/GSL/gsl-aux.h index 89bd75e..2be07c1 100644 --- a/lib/GSL/gsl-aux.h +++ b/lib/GSL/gsl-aux.h | |||
@@ -61,6 +61,7 @@ int deriv(int code, double f(double, void*), double x, double h, double * result | |||
61 | 61 | ||
62 | double gsl_sf_erf(double); | 62 | double gsl_sf_erf(double); |
63 | double gsl_sf_erf_Z(double); | 63 | double gsl_sf_erf_Z(double); |
64 | double gsl_sf_gamma(double); | ||
64 | 65 | ||
65 | int gsl_sf_bessel_J0_e(double, double*); // hmmm... | 66 | int gsl_sf_bessel_J0_e(double, double*); // hmmm... |
66 | int gsl_sf_exp_e10_e(double, double*); // HMMMMM... | 67 | int gsl_sf_exp_e10_e(double, double*); // HMMMMM... |