1math::special(n)               Tcl Math Library               math::special(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       math::special - Special mathematical functions
9

SYNOPSIS

11       package require Tcl  ?8.3?
12
13       package require math::special  ?0.2?
14
15       ::math::special::Beta x y
16
17       ::math::special::Gamma x y
18
19       ::math::special::erf x
20
21       ::math::special::erfc x
22
23       ::math::special::J0 x
24
25       ::math::special::J1 x
26
27       ::math::special::Jn n x
28
29       ::math::special::J1/2 x
30
31       ::math::special::J-1/2 x
32
33       ::math::special::I_n x
34
35       ::math::special::cn u k
36
37       ::math::special::dn u k
38
39       ::math::special::sn u k
40
41       ::math::special::elliptic_K k
42
43       ::math::special::elliptic_E k
44
45       ::math::special::exponential_Ei x
46
47       ::math::special::exponential_En n x
48
49       ::math::special::exponential_li x
50
51       ::math::special::exponential_Ci x
52
53       ::math::special::exponential_Si x
54
55       ::math::special::exponential_Chi x
56
57       ::math::special::exponential_Shi x
58
59       ::math::special::fresnel_C x
60
61       ::math::special::fresnel_S x
62
63       ::math::special::sinc x
64
65       ::math::special::legendre n
66
67       ::math::special::chebyshev n
68
69       ::math::special::laguerre alpha n
70
71       ::math::special::hermite n
72
73_________________________________________________________________
74

DESCRIPTION

76       This  package  implements several so-called special functions, like the
77       Gamma function, the Bessel functions and such.
78
79       Each function is implemented by a procedure that bears its name  (well,
80       in close approximation):
81
82       ·      J0 for the zeroth-order Bessel function of the first kind
83
84       ·      J1 for the first-order Bessel function of the first kind
85
86       ·      Jn for the nth-order Bessel function of the first kind
87
88       ·      J1/2 for the half-order Bessel function of the first kind
89
90       ·      J-1/2 for the minus-half-order Bessel function of the first kind
91
92       ·      I_n  for the modified Bessel function of the first kind of order
93              n
94
95       ·      Gamma for the Gamma function, erf and erfc for the  error  func‐
96              tion and the complementary error function
97
98       ·      fresnel_C and fresnel_S for the Fresnel integrals
99
100       ·      elliptic_K and elliptic_E (complete elliptic integrals)
101
102       ·      exponent_Ei  and  other functions related to the so-called expo‐
103              nential integrals
104
105       ·      legendre, hermite: some of the classical orthogonal polynomials.
106

OVERVIEW

108       In the following table several characteristics of the functions in this
109       package are summarized: the domain for the argument, the values for the
110       parameters and error bounds.
111
112       Family       | Function    | Domain x    | Parameter   | Error bound
113       -------------+-------------+-------------+-------------+--------------
114       Bessel       | J0, J1,     | all of R    | n = integer |   < 1.0e-8
115                    | Jn          |             |             |  (|x|<20, n<20)
116       Bessel       | J1/2, J-1/2,|  x > 0      | n = integer |   exact
117       Bessel       | I_n         | all of R    | n = integer |   < 1.0e-6
118                    |             |             |             |
119       Elliptic     | cn          | 0 <= x <= 1 |     --      |   < 1.0e-10
120       functions    | dn          | 0 <= x <= 1 |     --      |   < 1.0e-10
121                    | sn          | 0 <= x <= 1 |     --      |   < 1.0e-10
122       Elliptic     | K           | 0 <= x < 1  |     --      |   < 1.0e-6
123       integrals    | E           | 0 <= x < 1  |     --      |   < 1.0e-6
124                    |             |             |             |
125       Error        | erf         |             |     --      |
126       functions    | erfc        |             |             |
127                    | ierfc_n     |             |             |
128                    |             |             |             |
129       Exponential  | Ei          |  x != 0     |     --      |   < 1.0e-10 (relative)
130       integrals    | En          |  x >  0     |     --      |   as Ei
131                    | li          |  x > 0      |     --      |   as Ei
132                    | Chi         |  x > 0      |     --      |   < 1.0e-8
133                    | Shi         |  x > 0      |     --      |   < 1.0e-8
134                    | Ci          |  x > 0      |     --      |   < 2.0e-4
135                    | Si          |  x > 0      |     --      |   < 2.0e-4
136                    |             |             |             |
137       Fresnel      | C           |  all of R   |     --      |   < 2.0e-3
138       integrals    | S           |  all of R   |     --      |   < 2.0e-3
139                    |             |             |             |
140       general      | Beta        | (see Gamma) |     --      |   < 1.0e-9
141                    | Gamma       |  x != 0,-1, |     --      |   < 1.0e-9
142                    |             |  -2, ...    |             |
143                    | sinc        |  all of R   |     --      |   exact
144                    |             |             |             |
145       orthogonal   | Legendre    |  all of R   | n = 0,1,... |   exact
146       polynomials  | Chebyshev   |  all of R   | n = 0,1,... |   exact
147                    | Laguerre    |  all of R   | n = 0,1,... |   exact
148                    |             |             | alpha el. R |
149                    | Hermite     |  all of R   | n = 0,1,... |   exact
150
151       Note: Some of the error bounds are estimated,  as  no  "formal"  bounds
152       were  available  with the implemented approximation method, others hold
153       for the auxiliary functions used for estimating the primary functions.
154
155       The following well-known functions are currently missing from the pack‐
156       age:
157
158       ·      Bessel functions of the second kind (Y_n, K_n)
159
160       ·      Bessel  functions  of  arbitrary order (and hence the Airy func‐
161              tions)
162
163       ·      Chebyshev polynomials of the second kind (U_n)
164
165       ·      The digamma function (psi)
166
167       ·      The incomplete gamma and beta functions
168

PROCEDURES

170       The package defines the following public procedures:
171
172       ::math::special::Beta x y
173              Compute the Beta function for arguments "x" and "y"
174
175              x float First argument for the Beta function
176
177              y float Second argument for the Beta function
178
179
180       ::math::special::Gamma x y
181              Compute the Gamma function for argument "x"
182
183              x float Argument for the Gamma function
184
185
186       ::math::special::erf x
187              Compute the error function for argument "x"
188
189              x float Argument for the error function
190
191
192       ::math::special::erfc x
193              Compute the complementary error function for argument "x"
194
195              x float Argument for the complementary error function
196
197
198       ::math::special::J0 x
199              Compute the zeroth-order Bessel function of the first  kind  for
200              the argument "x"
201
202              x float Argument for the Bessel function
203
204       ::math::special::J1 x
205              Compute  the  first-order  Bessel function of the first kind for
206              the argument "x"
207
208              x float Argument for the Bessel function
209
210       ::math::special::Jn n x
211              Compute the nth-order Bessel function of the first kind for  the
212              argument "x"
213
214              n integer Order of the Bessel function
215
216              x float Argument for the Bessel function
217
218       ::math::special::J1/2 x
219              Compute the half-order Bessel function of the first kind for the
220              argument "x"
221
222              x float Argument for the Bessel function
223
224       ::math::special::J-1/2 x
225              Compute the minus-half-order Bessel function of the  first  kind
226              for the argument "x"
227
228              x float Argument for the Bessel function
229
230       ::math::special::I_n x
231              Compute  the modified Bessel function of the first kind of order
232              n for the argument "x"
233
234              x int Positive integer order of the function
235
236              x float Argument for the function
237
238       ::math::special::cn u k
239              Compute the elliptic function cn for the argument "u" and param‐
240              eter "k".
241
242              u float Argument for the function
243
244              k float Parameter
245
246       ::math::special::dn u k
247              Compute the elliptic function dn for the argument "u" and param‐
248              eter "k".
249
250              u float Argument for the function
251
252              k float Parameter
253
254       ::math::special::sn u k
255              Compute the elliptic function sn for the argument "u" and param‐
256              eter "k".
257
258              u float Argument for the function
259
260              k float Parameter
261
262       ::math::special::elliptic_K k
263              Compute the complete elliptic integral of the first kind for the
264              argument "k"
265
266              k float Argument for the function
267
268       ::math::special::elliptic_E k
269              Compute the complete elliptic integral of the  second  kind  for
270              the argument "k"
271
272              k float Argument for the function
273
274       ::math::special::exponential_Ei x
275              Compute  the  exponential  integral  of  the second kind for the
276              argument "x"
277
278              x float Argument for the function (x != 0)
279
280       ::math::special::exponential_En n x
281              Compute the exponential integral of the first kind for the argu‐
282              ment "x" and order n
283
284              n int Order of the integral (n >= 0)
285
286              x float Argument for the function (x >= 0)
287
288       ::math::special::exponential_li x
289              Compute the logarithmic integral for the argument "x"
290
291              x float Argument for the function (x > 0)
292
293       ::math::special::exponential_Ci x
294              Compute the cosine integral for the argument "x"
295
296              x float Argument for the function (x > 0)
297
298       ::math::special::exponential_Si x
299              Compute the sine integral for the argument "x"
300
301              x float Argument for the function (x > 0)
302
303       ::math::special::exponential_Chi x
304              Compute the hyperbolic cosine integral for the argument "x"
305
306              x float Argument for the function (x > 0)
307
308       ::math::special::exponential_Shi x
309              Compute the hyperbolic sine integral for the argument "x"
310
311              x float Argument for the function (x > 0)
312
313       ::math::special::fresnel_C x
314              Compute the Fresnel cosine integral for real argument x
315
316              x float Argument for the function
317
318       ::math::special::fresnel_S x
319              Compute the Fresnel sine integral for real argument x
320
321              x float Argument for the function
322
323       ::math::special::sinc x
324              Compute the sinc function for real argument x
325
326              x float Argument for the function
327
328       ::math::special::legendre n
329              Return  the  Legendre polynomial of degree n (see THE ORTHOGONAL
330              POLYNOMIALS)
331
332              n int Degree of the polynomial
333
334
335       ::math::special::chebyshev n
336              Return the Chebyshev polynomial of degree n (of the first kind)
337
338              n int Degree of the polynomial
339
340
341       ::math::special::laguerre alpha n
342              Return the Laguerre polynomial of degree n with parameter alpha
343
344              alpha float Parameter of the Laguerre polynomial
345
346              n int Degree of the polynomial
347
348
349       ::math::special::hermite n
350              Return the Hermite polynomial of degree n
351
352              n int Degree of the polynomial
353
354

THE ORTHOGONAL POLYNOMIALS

356       For dealing with the classical families of orthogonal polynomials,  the
357       package  relies on the math::polynomials package. To evaluate the poly‐
358       nomial at some coordinate, use the evalPolyn command:
359
360          set leg2 [::math::special::legendre 2]
361          puts "Value at x=$x: [::math::polynomials::evalPolyn $leg2 $x]"
362
363
364       The return value from the legendre and other commands is  actually  the
365       definition of the corresponding polynomial as used in that package.
366

REMARKS ON THE IMPLEMENTATION

368       It should be noted, that the actual implementation of J0 and J1 depends
369       on straightforward Gaussian quadrature formulas. The  (absolute)  accu‐
370       racy  of  the results is of the order 1.0e-4 or better. The main reason
371       to implement them like that was that it was fast to  do  (the  formulas
372       are simple) and the computations are fast too.
373
374       The implementation of J1/2 does not suffer from this: this function can
375       be expressed exactly in terms of elementary functions.
376
377       The functions J0 and J1 are the ones you will encounter most frequently
378       in practice.
379
380       The computation of I_n is based on Miller's algorithm for computing the
381       minimal function from recurrence relations.
382
383       The computation of the Gamma and Beta functions relies on the  combina‐
384       torics  package, whereas that of the error functions relies on the sta‐
385       tistics package.
386
387       The computation of the complete elliptic integrals uses the  AGM  algo‐
388       rithm.
389
390       Much information about these functions can be found in:
391
392       Abramowitz  and Stegun: Handbook of Mathematical Functions (Dover, ISBN
393       486-61272-4)
394

KEYWORDS

396       Bessel functions, error function, math, special functions
397
399       Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
400
401
402
403
404math                                  0.2                     math::special(n)
Impressum