nag_specfun_erf_real (s15ae) calculates an approximate value for the error function
Let
be the root of the equation
(then
). For
the value of
is based on the following rational Chebyshev expansion for
:
where
denotes a rational function of degree
in the numerator and
in the denominator.
For
the value of
is based on a rational Chebyshev expansion for
: for
the value is based on the expansion
and for
it is based on the expansion
For each expansion, the specific values of
and
are selected to be minimal such that the maximum relative error in the expansion is of the order
, where
is the maximum number of decimal digits that can be accurately represented for the particular implementation (see
nag_machine_decimal_digits (x02be)).
None.
There are no failure exits from
nag_specfun_erf_real (s15ae). The argument
ifail has been included for consistency with other functions in this chapter.
None.
function s15ae_example
fprintf('s15ae example results\n\n');
x = [-6 -4.5 -1 1 4.5 6];
n = size(x,2);
result = x;
for j=1:n
[result(j), ifail] = s15ae(x(j));
end
disp(' x erf(x)');
fprintf('%12.3e%12.3e\n',[x; result]);