s21cac is based on a procedure given by Bulirsch (1960), and uses the process of the arithmetic-geometric mean ( in Abramowitz and Stegun (1972)). Constraints are placed on the values of and in order to avoid the possibility of machine overflow.
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Bulirsch R (1960) Numerical calculation of elliptic integrals and elliptic functions Numer. Math.7 76–90
1: – doubleInput
2: – doubleInput
On entry: the argument and the argument of the functions, respectively.
, where ;
if , .
3: – double *Output
4: – double *Output
5: – double *Output
On exit: the values of the functions , and , respectively.
6: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL 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 CL Interface for further information.
On entry, is too large when used in conjunction with the supplied argument u: it must be less than .
On entry, is too large: it must be less than .
In principle the function is capable of achieving full relative precision in the computed values. However, the accuracy obtainable in practice depends on the accuracy of the standard elementary functions such as SIN and COS.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
s21cac is not threaded in any implementation.
This example reads values of the argument and argument from a file, evaluates the function and prints the results.