root/trunk/special-functions/hypergeometric.lisp

Revision 26, 6.6 kB (checked in by lhealy, 9 months ago)

Subversion version stamp.

  • Property svn:keywords set to Id
Line 
1;; Hypergeometric function
2;; Liam Healy, Fri Apr 28 2006 - 23:00
3;; Time-stamp: <2008-02-17 18:30:53EST hypergeometric.lisp>
4;; $Id$
5
6(in-package :gsl)
7
8(defmfun hypergeometric-0F1 (c x)
9  "gsl_sf_hyperg_0F1_e" ((c :double) (x :double) (ret sf-result))
10  :documentation                        ; FDL
11  "The hypergeometric function 0F1(c,x).")
12
13(defgeneric hypergeometric-1F1 (m n x)
14  (:documentation                       ; FDL
15   "The confluent hypergeometric function 1F1(m,n,x) = M(m,n,x)."))
16
17(defmfun hypergeometric-1F1 ((m integer) (n integer) x)
18  "gsl_sf_hyperg_1F1_int_e" ((m :int) (n :int) (x :double) (ret sf-result))
19  :type :method
20  :export t
21  :documentation                        ; FDL
22  "The confluent hypergeometric function 1F1(m,n,x) = M(m,n,x)
23   for integer parameters m, n.")
24
25(defmfun hypergeometric-1F1 ((a float) (b float) x)
26  "gsl_sf_hyperg_1F1_e" ((a :double) (b :double) (x :double) (ret sf-result))
27  :type :method
28  :documentation                        ; FDL
29  "The confluent hypergeometric function
30  1F1(a,b,x) = M(a,b,x) for general parameters a, b.")
31
32(defgeneric hypergeometric-U (m n x)
33  (:documentation                       ; FDL
34   "The confluent hypergeometric function U(m,n,x)."))
35
36(defmfun hypergeometric-U ((m integer) (n integer) x)
37  "gsl_sf_hyperg_U_int_e" ((m :int) (n :int) (x :double) (ret sf-result))
38  :type :method
39  :export t
40  :documentation                        ; FDL
41  "The confluent hypergeometric function U(m,n,x) for integer parameters m, n.")
42
43(defmfun hypergeometric-U ((a float) (b float) x)
44  "gsl_sf_hyperg_U_e" ((a :double) (b :double) (x :double) (ret sf-result))
45  :type :method
46  :documentation "The confluent hypergeometric function U(a,b,x).")
47
48(defgeneric hypergeometric-U-e10 (m n x)
49  (:documentation                       ; FDL
50   "The confluent hypergeometric function
51   U(m,n,x) that returns a result with extended range."))
52
53(defmfun hypergeometric-U-e10 ((m integer) (n integer) x)
54  "gsl_sf_hyperg_U_int_e10_e"
55  ((m :int) (n :int) (x :double) (ret sf-result-e10))
56  :type :method
57  :export t
58  :documentation                        ; FDL
59  "The confluent hypergeometric function
60   U(m,n,x) for integer parameters m, n that returns a
61   result with extended range.")
62
63(defmfun hypergeometric-U-e10 ((a float) (b float) x)
64  "gsl_sf_hyperg_U_e10_e"
65  ((a :double) (b :double) (x :double) (ret sf-result-e10))
66  :type :method
67  :documentation                        ; FDL
68  "The confluent hypergeometric function
69  U(a,b,x) using that returns a result with extended range.")
70
71(defmfun hypergeometric-2F1 (a b c x)
72  "gsl_sf_hyperg_2F1_e"
73  ((a :double) (b :double) (c :double) (x :double) (ret sf-result))
74  :documentation                        ; FDL
75  "The Gauss hypergeometric function
76  2F1(a,b,c,x) for |x| < 1. If the arguments
77  (a,b,c,x) are too close to a singularity then the function can
78  return the error code :EMAXITER when the series
79  approximation converges too slowly.  This occurs in the region of
80  x=1, c - a - b = m for integer m.")
81
82(defmfun hypergeometric-2F1-conj (a c x)
83  "gsl_sf_hyperg_2F1_conj_e"
84  (((realpart a) :double) ((imagpart a) :double)
85   (c :double) (x :double) (ret sf-result))
86  :documentation                        ; FDL
87  "The Gauss hypergeometric function 2F1(a, a*, c, x) with complex parameters
88  for |x| < 1.")
89
90(defmfun hypergeometric-2F1-renorm (a b c x)
91  "gsl_sf_hyperg_2F1_renorm_e"
92  ((a :double) (b :double) (c :double) (x :double) (ret sf-result))
93  :documentation                        ; FDL
94  "The renormalized Gauss hypergeometric function
95  2F1(a,b,c,x) / Gamma(c) for |x| < 1.")
96
97(defmfun hypergeometric-2F1-conj-renorm (a c x)
98  "gsl_sf_hyperg_2F1_conj_renorm_e"
99  (((realpart a) :double) ((imagpart a) :double)
100   (c :double) (x :double) (ret sf-result))
101  :documentation                        ; FDL
102  "The renormalized Gauss hypergeometric function
103  2F1(a, a*, c, x) / Gamma(c) for |x| < 1.")
104
105(defmfun hypergeometric-2F0 (a b x)
106  "gsl_sf_hyperg_2F0_e"
107  ((a :double) (b :double) (x :double) (ret sf-result))
108  :documentation                        ; FDL
109  "The hypergeometric function
110  2F0(a,b,x).  The series representation
111  is a divergent hypergeometric series.  However, for x < 0 we
112  have 2F0(a,b,x) = (-1/x)^a U(a,1+a-b,-1/x)")
113
114;;;;****************************************************************************
115;;;; Examples and unit test
116;;;;****************************************************************************
117
118#|
119(make-tests hypergeometric
120  (hypergeometric-0f1 0.5d0 1.0d0)
121  (hypergeometric-1F1 2 1 1.0d0)
122  (hypergeometric-1F1 2.0d0 1.0d0 1.0d0)
123  (hypergeometric-U 2.0d0 1.0d0 1.0d0)
124  (hypergeometric-U 2 1 1.0d0)
125  (hypergeometric-U-e10 2.0d0 1.0d0 1.0d0)
126  (hypergeometric-U-e10 2 1 1.0d0)
127  (hypergeometric-2F1 1.0d0 1.2d0 1.0d0 0.5d0)
128  (hypergeometric-2F1-conj #C(1.0d0 0.5d0) 0.5d0 0.6d0)
129  (hypergeometric-2F1-conj-renorm #C(1.0d0 0.5d0) 0.5d0 0.6d0)
130  (hypergeometric-2F1-renorm 1.0d0 1.2d0 1.0d0 0.5d0)
131  (hypergeometric-2F0 1.0d0 2.0d0 -20.0d0))
132|#
133
134(LISP-UNIT:DEFINE-TEST HYPERGEOMETRIC
135  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
136   (LIST 3.7621956910836287d0 9.207469176703522d-14)
137   (MULTIPLE-VALUE-LIST (HYPERGEOMETRIC-0F1 0.5d0 1.0d0)))
138  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
139   (LIST 5.43656365691809d0 6.0357981467508045d-15)
140   (MULTIPLE-VALUE-LIST (HYPERGEOMETRIC-1F1 2 1 1.0d0)))
141  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
142   (LIST 5.43656365691809d0 6.0357981467508045d-15)
143   (MULTIPLE-VALUE-LIST
144    (HYPERGEOMETRIC-1F1 2.0d0 1.0d0 1.0d0)))
145  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
146   (LIST 0.19269472464638984d0 2.5468520714552053d-12)
147   (MULTIPLE-VALUE-LIST
148    (HYPERGEOMETRIC-U 2.0d0 1.0d0 1.0d0)))
149  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
150   (LIST 0.19269472464638984d0 2.5468520714552053d-12)
151   (MULTIPLE-VALUE-LIST (HYPERGEOMETRIC-U 2 1 1.0d0)))
152  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
153   (LIST 0.19269472464638984d0 0 2.5468520714552053d-12)
154   (MULTIPLE-VALUE-LIST
155    (HYPERGEOMETRIC-U-E10 2.0d0 1.0d0 1.0d0)))
156  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
157   (LIST 0.19269472464638984d0 0 2.5468520714552053d-12)
158   (MULTIPLE-VALUE-LIST (HYPERGEOMETRIC-U-E10 2 1 1.0d0)))
159  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
160   (LIST 2.29739670999407d0 2.0404981793068d-15)
161   (MULTIPLE-VALUE-LIST
162    (HYPERGEOMETRIC-2F1 1.0d0 1.2d0 1.0d0 0.5d0)))
163  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
164   (LIST 6.629594934547447d0 5.761143589129193d-14)
165   (MULTIPLE-VALUE-LIST
166    (HYPERGEOMETRIC-2F1-CONJ #C(1.0d0 0.5d0) 0.5d0
167                             0.6d0)))
168  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
169   (LIST 3.7403484052126372d0 5.884558632199498d-14)
170   (MULTIPLE-VALUE-LIST
171    (HYPERGEOMETRIC-2F1-CONJ-RENORM #C(1.0d0 0.5d0) 0.5d0
172                                    0.6d0)))
173  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
174   (LIST 2.29739670999407d0 3.0607472689602005d-15)
175   (MULTIPLE-VALUE-LIST
176    (HYPERGEOMETRIC-2F1-RENORM 1.0d0 1.2d0 1.0d0 0.5d0)))
177  (LISP-UNIT::ASSERT-NUMERICAL-EQUAL
178   (LIST 0.043513924125598485d0 3.81571654717325d-15)
179   (MULTIPLE-VALUE-LIST
180    (HYPERGEOMETRIC-2F0 1.0d0 2.0d0 -20.0d0))))
Note: See TracBrowser for help on using the browser.