NAG FL Interface
s17dhf (airy_bi_complex)
1
Purpose
s17dhf returns the value of the Airy function or its derivative for complex , with an option for exponential scaling.
2
Specification
Fortran Interface
Integer, Intent (Inout) |
:: |
ifail |
Complex (Kind=nag_wp), Intent (In) |
:: |
z |
Complex (Kind=nag_wp), Intent (Out) |
:: |
bi |
Character (1), Intent (In) |
:: |
deriv, scal |
|
C++ Header Interface
#include <nag.h> extern "C" {
}
|
The routine may be called by the names s17dhf or nagf_specfun_airy_bi_complex.
3
Description
s17dhf returns a value for the Airy function or its derivative , where is complex, . Optionally, the value is scaled by the factor .
The routine is derived from the routine CBIRY in
Amos (1986). It is based on the relations
, and
, where
is the modified Bessel function and
.
For very large , argument reduction will cause total loss of accuracy, and so no computation is performed. For slightly smaller , the computation is performed but results are accurate to less than half of machine precision. If 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 routine.
4
References
Amos D E (1986) Algorithm 644: A portable package for Bessel functions of a complex argument and non-negative order ACM Trans. Math. Software 12 265–273
5
Arguments
-
1:
– Character(1)
Input
-
On entry: specifies whether the function or its derivative is required.
- is returned.
- is returned.
Constraint:
or .
-
2:
– Complex (Kind=nag_wp)
Input
-
On entry: the argument of the function.
-
3:
– Character(1)
Input
-
On entry: the scaling option.
- The result is returned unscaled.
- The result is returned scaled by the factor .
Constraint:
or .
-
4:
– Complex (Kind=nag_wp)
Output
-
On exit: the required function or derivative value.
-
5:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry,
deriv has an illegal value:
.
On entry,
scal has an illegal value:
.
-
No computation because is too large when .
-
Results lack precision because .
-
No computation because .
-
No computation – algorithm termination condition not met.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
All constants in s17dhf are given to approximately digits of precision. Calling the number of digits of precision in the floating-point arithmetic being used , then clearly the maximum number of correct digits in the results obtained is limited by . Because of errors in argument reduction when computing elementary functions inside s17dhf, the actual number of correct digits is limited, in general, by , where represents the number of digits lost due to the argument reduction. Thus the larger the value of , the less the precision in the result.
Empirical tests with modest values of , checking relations between Airy functions , , and , have shown errors limited to the least significant – digits of precision.
8
Parallelism and Performance
s17dhf is not threaded in any implementation.
Note that if the function is required to operate on a real argument only, then it may be much cheaper to call
s17ahf or
s17akf.
10
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 routine and prints the results. The process is repeated until the end of the input data stream is encountered.
10.1
Program Text
10.2
Program Data
10.3
Program Results