S21DAF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

NAG Library Routine Document

S21DAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

S21DAF returns the value of the general elliptic integral of the second kind Fz,k,a,b for a complex argument z, via the function name.

2  Specification

FUNCTION S21DAF ( Z, AKP, A, B, IFAIL)
COMPLEX (KIND=nag_wp) S21DAF
INTEGER  IFAIL
REAL (KIND=nag_wp)  AKP, A, B
COMPLEX (KIND=nag_wp)  Z

3  Description

S21DAF evaluates an approximation to the general elliptic integral of the second kind Fz,k,a,b given by
Fz,k,a,b=0za+bζ2 1+ζ21+ζ21+k2ζ2 dζ,
where a and b are real parameters, z is a complex argument whose real part is non-negative and k is a real parameter (the complementary modulus). The evaluation of F is based on the Gauss transformation. Further details, in particular for the conformal mapping provided by F, can be found in Bulirsch (1960).
Special values include
F z, k ,1,1 = 0 z d ζ 1 + ζ 2 1 + k 2 ζ 2 ,
or F1z,k (the elliptic integral of the first kind) and
Fz,k,1,k2=0z1+k2ζ2 1+ζ21+ζ2 dζ,
or F2z,k (the elliptic integral of the second kind). Note that the values of F1z,k and F2z,k are equal to tan-1z in the trivial case k=1.
S21DAF is derived from an Algol 60 procedure given by Bulirsch (1960). Constraints are placed on the values of z and k in order to avoid the possibility of machine overflow.

4  References

Bulirsch R (1960) Numerical calculation of elliptic integrals and elliptic functions Numer. Math. 7 76–90

5  Parameters

1:     Z – COMPLEX (KIND=nag_wp)Input
On entry: the argument z of the function.
Constraints:
  • 0.0Re(Z)λ;
  • absIm(Z)λ, where λ6=1/X02AMF.
2:     AKP – REAL (KIND=nag_wp)Input
On entry: the argument k of the function.
Constraint: absAKP λ .
3:     A – REAL (KIND=nag_wp)Input
On entry: the argument a of the function.
4:     B – REAL (KIND=nag_wp)Input
On entry: the argument b of the function.
5:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,ReZ<0.0,
orReZ>λ,
orImZ>λ,
orAKP>λ, where λ6=1/X02AMF.
IFAIL=2
The iterative procedure used to evaluate the integral has failed to converge. The result is returned as zero.

7  Accuracy

In principle the routine 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 atan2 and log.

8  Further Comments

None.

9  Example

This example evaluates the elliptic integral of the first kind F1z,k given by
F1z,k=0zdζ 1+ζ21+k2ζ2 ,
where z=1.2+3.7i and k=0.5, and prints the results.

9.1  Program Text

Program Text (s21dafe.f90)

9.2  Program Data

Program Data (s21dafe.d)

9.3  Program Results

Program Results (s21dafe.r)


S21DAF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012