s17dg returns the value of the Airy function or its derivative for complex , with an option for exponential scaling.
Public Shared Sub s17dg ( _ deriv As String, _ z As Complex, _ scal As String, _ <OutAttribute> ByRef ai As Complex, _ <OutAttribute> ByRef nz As Integer, _ <OutAttribute> ByRef ifail As Integer _ )
public: static void s17dg( String^ deriv, Complex z, String^ scal, [OutAttribute] Complex% ai, [OutAttribute] int% nz, [OutAttribute] int% ifail )
- Type: System..::..StringOn entry: specifies whether the function or its derivative is required.
Constraint: or .
- is returned.
- is returned.
- Type: NagLibrary..::..ComplexOn entry: the argument of the function.
- Type: System..::..StringOn entry: the scaling option.
Constraint: or .
- The result is returned unscaled.
- The result is returned scaled by the factor .
- Type: NagLibrary..::..Complex%On exit: the required function or derivative value.
- Type: System..::..Int32%
s17dg returns a value for the Airy function or its derivative , where is complex, . Optionally, the value is scaled by the factor .
The method is derived from the method CAIRY 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 method.
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 non-negative order ACM Trans. Math. Software 12 265–273
Errors or warnings detected by the method:
On entry, or . or or .
- No computation has been performed due to the likelihood of overflow, because is too large, where – how large depends on z and the overflow threshold of the machine. This error exit can only occur when .
- The computation has been performed, but the errors due to argument reduction in elementary functions make it likely that the result returned by s17dg is accurate to less than half of machine precision. This error exit may occur if is greater than a machine-dependent threshold value (given in the Users' Note for your implementation).
- No computation has been performed because the errors due to argument reduction in elementary functions mean that all precision in the result returned by s17dg would be lost. This error exit may occur if is greater than a machine-dependent threshold value (given in the Users' Note for your implementation).
- No result is returned because the algorithm termination condition has not been met. This may occur because the parameters supplied to s17dg would have caused overflow or underflow.
All constants in s17dg 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 s17dg, 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.
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 parameter deriv, the second is a complex value for the argument, z, and the third is a character value to set the parameter scal. The program calls the method and prints the results. The process is repeated until the end of the input data stream is encountered.