root/trunk/special-functions/exponential-integrals.lisp

Revision 47, 4.5 kB (checked in by lhealy, 8 months ago)

Unification of errors and warnings using a single class
'gsl-condition. Each numbered GSL conditions is a subclass of this
condition, under the name given by GSL, e.g. 'EDOM.

  • Property svn:keywords set to Id
Line 
1;; Exponential integrals
2;; Liam Healy, Tue Mar 21 2006 - 17:37
3;; Time-stamp: <2008-03-27 21:29:32EDT exponential-integrals.lisp>
4;; $Id$
5
6(in-package :gsl)
7
8;;;;****************************************************************************
9;;;; Exponential Integral
10;;;;****************************************************************************
11
12(defmfun expint-E1 (x)
13  "gsl_sf_expint_E1_e" ((x :double) (ret sf-result))
14  :documentation                        ; FDL
15  "The exponential integral
16   E_1(x)}, E_1(x) := \Re \int_1^\infty dt \exp(-xt)/t..")
17
18(defmfun expint-E2 (x)
19  "gsl_sf_expint_E2_e" ((x :double) (ret sf-result))
20  :documentation                        ; FDL
21  "The second-order exponential integral
22   E_2(x)}, E_2(x) := \Re \int_1^\infty dt \exp(-xt)/t^2.")
23
24;;;;****************************************************************************
25;;;; Ei
26;;;;****************************************************************************
27
28(defmfun expint-Ei (x)
29    "gsl_sf_expint_Ei_e" ((x :double) (ret sf-result))
30  :documentation                        ; FDL
31  "The exponential integral Ei(x),
32   Ei(x) := - PV\left(\int_{-x}^\infty dt \exp(-t)/t\right).")
33
34;;;;****************************************************************************
35;;;; Hyperbolic Integrals
36;;;;****************************************************************************
37
38(defmfun Shi (x)
39  "gsl_sf_Shi_e" ((x :double) (ret sf-result))
40  :documentation                        ; FDL
41  "The integral Shi(x) = \int_0^x dt \sinh(t)/t.")
42
43(defmfun Chi (x)
44  "gsl_sf_Chi_e" ((x :double) (ret sf-result))
45  :documentation                        ; FDL
46  "The integral
47   Chi(x) := \Re[ \gamma_E + \log(x) + \int_0^x dt (\cosh[t]-1)/t],
48   where \gamma_E} is the Euler constant.")
49
50;;;;****************************************************************************
51;;;; Ei-3
52;;;;****************************************************************************
53
54(defmfun expint-3 (x)
55  "gsl_sf_expint_3_e" ((x :double) (ret sf-result))
56  :documentation                        ; FDL
57  "The third-order exponential integral Ei_3(x) = \int_0^xdt \exp(-t^3)
58  for x >= 0.")
59
60;;;;****************************************************************************
61;;;; Trigonometric Integrals
62;;;;****************************************************************************
63
64(defmfun Si (x)
65  "gsl_sf_Si_e" ((x :double) (ret sf-result))
66  :documentation                        ; FDL
67  "The Sine integral Si(x) = \int_0^x dt \sin(t)/t.")
68
69(defmfun Ci (x)
70  "gsl_sf_Ci_e" ((x :double) (ret sf-result))
71  :documentation                        ; FDL
72  "The Cosine integral Ci(x) = -\int_x^\infty dt \cos(t)/t
73   for x > 0.")
74
75;;;;****************************************************************************
76;;;; Trigonometric Integrals
77;;;;****************************************************************************
78
79(defmfun atanint (x)
80  "gsl_sf_atanint_e" ((x :double) (ret sf-result))
81  :documentation                        ; FDL
82  "The Arctangent integral, which is defined as
83   AtanInt(x) = \int_0^x dt \arctan(t)/t.")
84
85;;;;****************************************************************************
86;;;; Examples and unit test
87;;;;****************************************************************************
88
89#|
90;;; Macroexpanding in SLIME with slime-macroexpand-1 will produce the
91;;; wrong error type for the first test.  Instead, evaluate in
92;;; listener with (macroexpand-1 '(make-tests ... )).
93
94(make-tests exponential-integrals
95  (expint-E1 0.0d0)
96  (expint-E1 1.0d0)
97  (expint-Ei 2.0d0)
98  (Shi 1.25d0)
99  (Chi 1.25d0)
100  (expint-3 1.25d0)
101  (si 1.25d0)
102  (ci 1.25d0)
103  (atanint 1.25d0))
104|#
105
106(LISP-UNIT:DEFINE-TEST EXPONENTIAL-INTEGRALS
107  (LISP-UNIT:ASSERT-ERROR 'GSL-CONDITION (EXPINT-E1 0.0d0))
108  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
109   (LIST 0.21938393439552029d0 2.6541220085226265d-16)
110   (MULTIPLE-VALUE-LIST (EXPINT-E1 1.0d0)))
111  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
112   (LIST 4.954234356001891d0 7.64289440273947d-15)
113   (MULTIPLE-VALUE-LIST (EXPINT-EI 2.0d0)))
114  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
115   (LIST 1.363730673440693d0 4.275641706089105d-15)
116   (MULTIPLE-VALUE-LIST (SHI 1.25d0)))
117  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
118   (LIST 1.217317300914783d0 4.21062110717259d-15)
119   (MULTIPLE-VALUE-LIST (CHI 1.25d0)))
120  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
121   (LIST 0.8688926541262327d0 4.083149724141479d-16)
122   (MULTIPLE-VALUE-LIST (EXPINT-3 1.25d0)))
123  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
124   (LIST 1.1464464156732344d0 7.36847290397885d-16)
125   (MULTIPLE-VALUE-LIST (SI 1.25d0)))
126  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
127   (LIST 0.4343007240335524d0 1.2207688418479174d-15)
128   (MULTIPLE-VALUE-LIST (CI 1.25d0)))
129  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
130   (LIST 1.103619161676528d0 6.711588415833395d-16)
131   (MULTIPLE-VALUE-LIST (ATANINT 1.25d0))))
132
Note: See TracBrowser for help on using the browser.