PDF version (NAG web site
, 64bit version, 64bit version)
NAG Toolbox: nag_specfun_airy_bi_complex (s17dh)
Purpose
nag_specfun_airy_bi_complex (s17dh) returns the value of the Airy function $\mathrm{Bi}\left(z\right)$ or its derivative ${\mathrm{Bi}}^{\prime}\left(z\right)$ for complex $z$, with an option for exponential scaling.
Syntax
Description
nag_specfun_airy_bi_complex (s17dh) returns a value for the Airy function $\mathrm{Bi}\left(z\right)$ or its derivative ${\mathrm{Bi}}^{\prime}\left(z\right)$, where $z$ is complex, $\pi <\mathrm{arg}z\le \pi $. Optionally, the value is scaled by the factor ${e}^{\left\mathrm{Re}\left(2z\sqrt{z}/3\right)\right}$.
The function is derived from the function CBIRY in
Amos (1986). It is based on the relations
$\mathrm{Bi}\left(z\right)=\frac{\sqrt{z}}{\sqrt{3}}\left({I}_{1/3}\left(w\right)+{I}_{1/3}\left(w\right)\right)$, and
${\mathrm{Bi}}^{\prime}\left(z\right)=\frac{z}{\sqrt{3}}\left({I}_{2/3}\left(w\right)+{I}_{2/3}\left(w\right)\right)$, where
${I}_{\nu}$ is the modified Bessel function and
$w=2z\sqrt{z}/3$.
For very large
$\leftz\right$, argument reduction will cause total loss of accuracy, and so no computation is performed. For slightly smaller
$\leftz\right$, the computation is performed but results are accurate to less than half of
machine precision. If
$\mathrm{Re}\left(z\right)$ is too large, and the unscaled function is required, there is a risk of overflow and so no computation is performed. In all the above cases, a warning is given by the function.
References
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Amos D E (1986) Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order ACM Trans. Math. Software 12 265–273
Parameters
Compulsory Input Parameters
 1:
$\mathrm{deriv}$ – string (length ≥ 1)

Specifies whether the function or its derivative is required.
 ${\mathbf{deriv}}=\text{'F'}$
 $\mathrm{Bi}\left(z\right)$ is returned.
 ${\mathbf{deriv}}=\text{'D'}$
 ${\mathrm{Bi}}^{\prime}\left(z\right)$ is returned.
Constraint:
${\mathbf{deriv}}=\text{'F'}$ or $\text{'D'}$.
 2:
$\mathrm{z}$ – complex scalar

The argument $z$ of the function.
 3:
$\mathrm{scal}$ – string (length ≥ 1)

The scaling option.
 ${\mathbf{scal}}=\text{'U'}$
 The result is returned unscaled.
 ${\mathbf{scal}}=\text{'S'}$
 The result is returned scaled by the factor ${e}^{\left\mathrm{Re}\left(2z\sqrt{z}/3\right)\right}$.
Constraint:
${\mathbf{scal}}=\text{'U'}$ or $\text{'S'}$.
Optional Input Parameters
None.
Output Parameters
 1:
$\mathrm{bi}$ – complex scalar

The required function or derivative value.
 2:
$\mathrm{ifail}$ – int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
 ${\mathbf{ifail}}=1$

On entry,  ${\mathbf{deriv}}\ne \text{'F'}$ or $\text{'D'}$. 
or  ${\mathbf{scal}}\ne \text{'U'}$ or $\text{'S'}$. 
 ${\mathbf{ifail}}=2$

No computation has been performed due to the likelihood of overflow, because real(
z) is too large – how large depends on the overflow threshold of the machine. This error exit can only occur when
${\mathbf{scal}}=\text{'U'}$.
 W ${\mathbf{ifail}}=3$

The computation has been performed, but the errors due to argument reduction in elementary functions make it likely that the result returned by
nag_specfun_airy_bi_complex (s17dh) is accurate to less than half of
machine precision. This error exit may occur if
$\mathrm{abs}\left({\mathbf{z}}\right)$ is greater than a machinedependent threshold value.
 ${\mathbf{ifail}}=4$

No computation has been performed because the errors due to argument reduction in elementary functions mean that all precision in the result returned by nag_specfun_airy_bi_complex (s17dh) would be lost. This error exit may occur if $\mathrm{abs}\left({\mathbf{z}}\right)$ is greater than a machinedependent threshold value.
 ${\mathbf{ifail}}=5$

No result is returned because the algorithm termination condition has not been met. This may occur because the arguments supplied to nag_specfun_airy_bi_complex (s17dh) would have caused overflow or underflow.
 ${\mathbf{ifail}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
 ${\mathbf{ifail}}=399$
Your licence key may have expired or may not have been installed correctly.
 ${\mathbf{ifail}}=999$
Dynamic memory allocation failed.
Accuracy
All constants in nag_specfun_airy_bi_complex (s17dh) are given to approximately $18$ digits of precision. Calling the number of digits of precision in the floatingpoint arithmetic being used $t$, then clearly the maximum number of correct digits in the results obtained is limited by $p=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(t,18\right)$. Because of errors in argument reduction when computing elementary functions inside nag_specfun_airy_bi_complex (s17dh), the actual number of correct digits is limited, in general, by $ps$, where $s\approx \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\left{\mathrm{log}}_{10}\leftz\right\right\right)$ represents the number of digits lost due to the argument reduction. Thus the larger the value of $\leftz\right$, the less the precision in the result.
Empirical tests with modest values of $z$, checking relations between Airy functions $\mathrm{Ai}\left(z\right)$, ${\mathrm{Ai}}^{\prime}\left(z\right)$, $\mathrm{Bi}\left(z\right)$ and ${\mathrm{Bi}}^{\prime}\left(z\right)$, have shown errors limited to the least significant $3$ – $4$ digits of precision.
Further Comments
Note that if the function is required to operate on a real argument only, then it may be much cheaper to call
nag_specfun_airy_bi_real (s17ah) or
nag_specfun_airy_bi_deriv (s17ak).
Example
This example prints a caption and then proceeds to read sets of data from the input data stream. The first datum is a value for the argument
deriv, the second is a complex value for the argument,
z, and the third is a character value
to set the argument
scal. The program calls the function and prints the results. The process is repeated until the end of the input data stream is encountered.
Open in the MATLAB editor:
s17dh_example
function s17dh_example
fprintf('s17dh example results\n\n');
z = [0.3 + 0.4i; 0.2 + 0i; 1.1  6.6i; 1.1  6.6i; 1 + 0i];
deriv = {'F'; 'F'; 'F'; 'F'; 'D'};
scal = {'U'; 'U'; 'U'; 'S'; 'U'};
fprintf('deriv z scaled? Bi(z)\n');
for i=1:numel(z)
[cy, ifail] = s17dh(deriv{i}, complex(z(i)), scal{i});
fprintf(' %s %7.3f%+7.3fi', deriv{i}, real(z(i)), imag(z(i)));
if scal{i} == 'U'
fprintf(' unscaled');
else
fprintf(' scaled');
end
fprintf(' %7.3f%+8.3fi\n', real(cy), imag(cy));
end
s17dh example results
deriv z scaled? Bi(z)
F 0.300 +0.400i unscaled 0.736 +0.183i
F 0.200 +0.000i unscaled 0.705 +0.000i
F 1.100 6.600i unscaled 47.904 +43.663i
F 1.100 6.600i scaled 0.130 +0.119i
D 1.000 +0.000i unscaled 0.592 +0.000i
PDF version (NAG web site
, 64bit version, 64bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015