Beruflich Dokumente
Kultur Dokumente
Nico M. Temme
Nico.Temme@cwi.nl
CWI, Amsterdam
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.1/65
Contents
Literature
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerical methods
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerical methods
New approaches
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerical methods
New approaches
Why is new software needed ?
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerical methods
New approaches
Why is new software needed ?
What has to be done ?
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Contents
Literature
Some simple experiences
Numerical aspects
Numerical methods
New approaches
Why is new software needed ?
What has to be done ?
Present project
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.2/65
Literature
W. Gautschi (1975): Computational methods in special
functions - A survey.
Y.L. Luke (1969): The special functions and their
approximations.
Y.L. Luke (1977): Algorithms for the computation of
special functions.
C.G. van der Laan & N.M. Temme (1984): Calculation
of special functions.
D.W. Lozier & F.W.J Olver (1994) (and updates):
Numerical evaluation of special functions.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.3/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.4/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.5/65
t +2i t2 +1
dt.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.6/65
t +2i t2 +1
dt.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.6/65
t2 +2i t2 +1
t2 +2it
F () =
e
dt = G() =
e
dt.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.7/65
t2 +2i t2 +1
t2 +2it
F () =
e
dt = G() =
e
dt.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.7/65
t2 +2i t2 +1
t2 +2it
F () =
e
dt = G() =
e
dt.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.7/65
The message is: one should have some feeling about the
computed result.
Otherwise a completely incorrect answer can be accepted.
Mathematica is more reliable here, and says:
"NIntegrate failed to converge to prescribed accuracy after
7 recursive bisections in t near t = 2.9384615384615387".
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.8/65
2
t +2i t2
H() =
e
dt,
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.9/65
Another integral
Consider
F (u) =
uit
dt
,
t1i
u > 0.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.10/65
Maple:
F (u) = eiuu Ei(1, iu u) = eiuu (0, iu u)],
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.12/65
Exponential integral:
Ei(x) or Ei(z) ?
E1 (z) =
z
et
dt,
t
|ph z| < ,
Ei(x) =
x
Ei(x) =
x
x et
et
dt =
dt,
t
t
et
dt = E1 (x),
t
x > 0,
x < 0.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.13/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.14/65
Scaling
The function (z) defined by
2z z1/2 ez .
32 z 3/2
f
Ai(z)
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.16/65
ln x,
arctan x,
ex , . . .
ln(1 + x)
,
x
arctan x x
,
3
x
ex 1
,...
x
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.17/65
(p + q)
pq (p + q)
When p + q is large, all quantities at the right-hand side can
be computed in good relative precision if codes for ln(1 + x)
(for small x) and (x) (for large x) are available.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.18/65
1 F1 (a; c; z)
1c 1 F1 (1 + a c; 2 c; z)
z
U (a, c, z) =
.
sin c (1 + a c)(c)
(a)(2 c)
For small z this can be used for computations.
However, for integer values of c, problems arise.
A careful analysis is needed to avoid numerical
cancellations.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.19/65
We have
U (a, c, z) =
fk xk ,
k=0
where
(1 c)
1
=
,
f0 =
sin c (1 + a c)(c)
(1 + a c)
and
z c
a
f1 =
.
sin c (1 + c)(1 + a c) (a)(2 c)
1
, or
( ) ( + )
( )
for small values of ||, C.
The remaining fk can be obtained from recursions, if f1 is
available.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.21/65
Numerical aspects
Fixed precision or variable precision
Insight in function behavior
Selecting analytical tools
Selecting numerical methods
Stability of the algorithms
Efficiency of the algorithms
Underflow, overflow, scaling
Testing
High quality software
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.22/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.23/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.24/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.25/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.26/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.27/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.28/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.29/65
Testing
Wronskian relations
Contiguous relations
Other functional identities
Testing by using overlapping domains
Testing with multiple-precision algorithms
Comparison against a standard
Lozier (1996) Test service and reference software
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.30/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.31/65
Numerical methods
Power series: convergent, asymptotic
Recursions, linear difference equations
Chebyshev expansions
Continued fractions
Quadrature, Gauss, trapezoidal
Uniform asymptotic expansions
Differential equations
Rational approximations, Pad, Chebyshev sense
Convergence acceleration
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.32/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.33/65
"S1
X (1)n (a)n (1 + a c)n
n=0
n! z n
+ O |z|S
#
eia ,
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.34/65
"S1
X (1)n (a)n (1 + a c)n
n=0
n! z n
+ O |z|S
#
eia
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.34/65
"S1
X (1)n (a)n (1 + a c)n
n=0
n! z n
+ O |z|S
#
eia
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.35/65
Chebyshev expansions
Clenshaw, Luke: one variable, tabled coefficients
Luke: hypergeometric functions
(z)a U (a, c, z) =
Cn (z)Tn (1/),
n=0
Continued fractions
Upper and lower approximations
Transformations
Stopping criterion
Anomalous convergence (Gautschi (1977))
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.37/65
t +2it
dt = e
s2
ds.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.38/65
0
Ai( 2/3 ) X As () Ai ( 2/3 ) X Bs ()
J (z) ()
+
,
2s
2s
1/3
5/3
s=0
s=0
() =
4
1 z2
1/4
2 3/2
1 + 1 z2 p
= ln
1 z2.
z
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.39/65
Differential equations
Stability
Direction of integration
Parallel integration (Lozier & Olver (1993))
Higher order linear equations
Lanczos method (Coleman, Rappoport)
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.40/65
Chebyshev sense
Rational approximations, Pade,
Cody and co-workers: one variable rational
approximations
Pad: applicable when coefficients can be obtained
easily
Luke: tabled coefficients
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.41/65
Convergence acceleration
Summing slowly convergent series
Summing divergent asymptotic series
Brezinski, Weniger
Special examples show impressive results
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.42/65
New approaches
Elementary functions: rigorous bounds
Multiple-precision computations
Unrestricted algorithms, error analysis
Methods for computing symmetric integrals
New packages for special functions
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.43/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.44/65
Multiple-precision computations
Brent (1978): Fortran
Several packages in C, C++
Maple, Mathematica, ...
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.45/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.46/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.47/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.48/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.49/65
Present project
(In collaboration with Amparo Gil and Javier Segura,
Madrid).
Airy functions
Scorer functions
Kia (x), <Iia (x), x > 0, a IR
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.50/65
Quadrature of integrals
A simple example is:
Z
Z
t2 +2it
2
G() =
e
dt = e
s2
ds.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.51/65
Consider the case 0 a < x for which values Kia (x) > 0,
although strong oscillations occur in the integral when a, x
are both large.
Deform the contour such that no oscillations occur.
Write w = u + iv ; we have
x cosh w + iaw = x cosh u cos v av + i(x sinh u sin v + au).
/2
v0
where
(u) = x cosh u cos v + av,
and f (u) =
dw
du
dv
= 1 + i du
.
(0) =
x2 a2 + a arcsin(a/x),
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.54/65
Trapezoidal rule
b
a
n1
1
f (t) dt = h[f (a) + f (b)] + h
f (h j) + Rn ,
2
j=1
h=
ba
.
n
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.55/65
Trapezoidal rule
b
a
n1
1
f (t) dt = h[f (a) + f (b)] + h
f (h j) + Rn ,
2
j=1
h=
ba
.
n
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.55/65
Trapezoidal rule
b
a
n1
1
f (t) dt = h[f (a) + f (b)] + h
f (h j) + Rn ,
2
j=1
h=
ba
.
n
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.55/65
cos(x sin t) dt = h + h
n1
X
j=1
Rn
.12 100
.48 106
16
.11 1021
32
.13 1062
64
.13 10163
128
.53 10404
(x/2)2n
,
(2n)!
f (t) dt = h
f (hj + d) + Rd (h)
j=
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.58/65
|f (x ia)| dx =
|f (x ib)| dx < .
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.59/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.60/65
ex(cosh(hj)1) + R0 (h).
j=1
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.61/65
j0
2
5
12
29
67
156
355
R0 (h)
.18 101
.24 106
.65 1015
.44 1032
.19 1066
.55 10136
.17 10272
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.62/65
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.63/65
Concluding remarks
There is a need for refereed software in the open
literature; further activities are needed.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.64/65
Concluding remarks
There is a need for refereed software in the open
literature; further activities are needed.
Maple and Mathematica are doing a great job, in
particular in connection with multiple-precision
numerics for special functions.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.64/65
Concluding remarks
There is a need for refereed software in the open
literature; further activities are needed.
Maple and Mathematica are doing a great job, in
particular in connection with multiple-precision
numerics for special functions.
Sometimes the approaches in M&M are too general;
the user should be alert when using these packages.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.64/65
Concluding remarks
There is a need for refereed software in the open
literature; further activities are needed.
Maple and Mathematica are doing a great job, in
particular in connection with multiple-precision
numerics for special functions.
Sometimes the approaches in M&M are too general;
the user should be alert when using these packages.
For large variables and complex variables, quadrature
methods for contour integrals are useful tools; ideas
from asymptotic analysis are very fruitful here.
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.64/65
Thanks to ...
Thanks to
Frdric Goualard,
who developed
prosper
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.65/65
Thanks to ...
Thanks to
Frdric Goualard,
who developed
prosper
Numerics of Special Functions, IMA, Special Functions in the Digital Age, July 2002 p.65/65