Sint cl05
Sint cl05
2. Accuracy
The majority of the functions in this chapter evaluate real-valued functions of a single real variable
x. The accuracy of the computed value is discussed in each function document, along the following
lines.
Let ∆ be the absolute error in the argument x, and δ be the relative error in x.
If we ignore errors that arise in the argument by propagation of data errors etc. and consider only
those errors that result from the fact that a real number is being represented in the computer in
floating-point form with finite precision, then δ is bounded and this bound is independent of the
magnitude of x; for example, on an n-digit machine
|δ| ≤ 10−n .
(This of course implies that the absolute error ∆ = xδ is also bounded but the bound is now
dependent on x.)
Let E be the absolute error in the computed function value f (x), and be the relative error. Then
E |f (x)|∆
E |xf (x)|δ
|xf (x)/f (x)|δ.
If possible, the function documents discuss the last of these relations, that is the propagation of
relative error, in terms of the error amplification factor |xf (x)/f (x)|. But in some cases, such as
near zeros of the function which cannot be extracted explicitly, absolute error in the result is the
quantity of significance and here the factor |xf (x)| is described.
In general, testing of the functions has shown that the behaviour of the actual errors follows fairly
well these theoretical relations. In regions where the error amplification factors are less than one,
or of the order of one, the errors are slightly larger than the above predictions. The errors are here
limited largely by the finite precision of arithmetic in the machine, but is normally no more than
a few times greater than the bound on δ. In regions where the amplification factors are large, of
order of ten or greater, the theoretical analysis gives a good measure of the accuracy obtainable.
[NP3275/5/pdf] 3.intro-s.1
Introduction – s NAG C Library Manual
where x, y, z ≥ 0 and at most one may be equal to zero. The normalisation factor, 12 , is chosen so
as to make
√
RF (x, x, x) = 1/ x.
If any two of the variables are equal, RF degenerates into the function RC , which is computed by
nag elliptic integral rc (s21bac):
∞
dt
RC (x, y) = RF (x, y, y) = 12 √
0 t + x(t + y)
with ρ = 0, x, y, z ≥ 0 with at most one equality holding. Thus RD (x, y, z) = RJ (x, y, z, z). The
normalisation of both these functions is chosen so that
√
RD (x, x, x) = RJ (x, x, x, x) = 1/(x x).
3.intro-s.2 [NP3275/5/pdf]
s – Approximations of Special Functions Introduction – s
The function RC is related to the logarithm or inverse hyperbolic functions if 0 < y < x, and to
the inverse circular functions if 0 ≤ x ≤ y. For example
2
1+x
ln x = (x − 1)RC , x , x > 0;
2
In general this method of calculating elementary functions is not recommended as there are usually
much more efficient specific functions available. However RC may be used, for example, to compute
ln x/(x − 1) when x is close to 1, without the loss of significant figures that occurs when ln x and
x − 1 are computed separately.
4. Available Functions
Airy function, Ai(x) s17agc
Airy function, Ai (x) s17ajc
Airy function, Bi(x) s17ahc
Airy function, Bi (x) s17akc
Arccosh(x) s11acc
Arcsinh(x) s11abc
Arctanh(x) s11aac
Bessel function, J0 (x) s17aec
Bessel function, J1 (x) s17afc
Bessel function, Y0 (x) s17acc
Bessel function, Y1 (x) s17adc
Complementary error function, erfc(x) s15adc
Cosh(x) s10acc
Cosine Integral, Ci(x) s13acc
Cumulative Normal distribution s15abc
Cumulative Normal distribution complement s15acc
Elliptic integral, symmetrised, degenerate of 1st kind, RC s21bac
Elliptic integral, symmetrised, of 1st kind, RF s21bbc
Elliptic integral, symmetrised, of 2nd kind, RD s21bcc
Elliptic integral, symmetrised, of 3rd kind, RJ s21bdc
Error function, erf(x) s15aec
Exponential Integral, E1 (x) s13aac
Fresnel Integral, C(x) s20adc
Fresnel Integral, S(x) s20acc
Gamma function, Γ(x) s14aac
Incomplete Gamma function, P (a, x) and Q(a, x) s14bac
Kelvin function, bei x s19abc
Kelvin function, ber x s19aac
Kelvin function, kei x s19adc
Kelvin function, ker x s19acc
Logarithm of Gamma function, ln Γ(x) s14abc
Modified Bessel function, I0 (x) s18aec
Modified Bessel function, I1 (x) s18afc
Modified Bessel function, K0 (x) s18acc
Modified Bessel function, K1 (x) s18adc
Scaled modified Bessel function, e−|x|I0 (x) s18cec
[NP3275/5/pdf] 3.intro-s.3
Introduction – s NAG C Library Manual
3.intro-s.4 [NP3275/5/pdf]