hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_specfun_dawson (s15af)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_specfun_dawson (s15af) returns a value for Dawson's Integral, Fx, via the function name.


[result, ifail] = s15af(x)
[result, ifail] = nag_specfun_dawson(x)


nag_specfun_dawson (s15af) evaluates an approximation for Dawson's Integral
The function is based on two Chebyshev expansions:
For 0<x4,
Fx=xr=0arTrt,   where  t=2 x4 2-1.  
For x>4,
Fx=1xr=0brTrt,   where  t=2 4x 2-1.  
For x near zero, Fxx, and for x large, Fx 12x . These approximations are used for those values of x for which the result is correct to machine precision.


Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications


Compulsory Input Parameters

1:     x – double scalar
The argument x of the function.

Optional Input Parameters


Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

There are no failure exits from this routine.


Let δ and ε be the relative errors in the argument and result respectively.
If δ is considerably greater than the machine precision (i.e., if δ is due to data errors etc.), then ε and δ are approximately related by:
ε x 1-2xFx Fx δ.  
The following graph shows the behaviour of the error amplification factor x 1-2xFx Fx :
Figure 1
Figure 1
However if δ is of the same order as machine precision, then rounding errors could make ε somewhat larger than the above relation indicates. In fact ε will be largely independent of x or δ, but will be of the order of a few times the machine precision.

Further Comments



This example reads values of the argument x from a file, evaluates the function at each value of x and prints the results.
function s15af_example

fprintf('s15af example results\n\n');

x = [-2   -0.5   1   1.5   2  5  10];
n = size(x,2);
result = x;

for j=1:n
  [result(j), ifail] = s15af(x(j));

disp('      x           F(x)');
fprintf('%12.3e%12.3e\n',[x; result]);

s15af example results

      x           F(x)
  -2.000e+00  -3.013e-01
  -5.000e-01  -4.244e-01
   1.000e+00   5.381e-01
   1.500e+00   4.282e-01
   2.000e+00   3.013e-01
   5.000e+00   1.021e-01
   1.000e+01   5.025e-02

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015