next up previous index
Next: C348 Elliptic Integral Up: CERNLIB Previous: C346 Elliptic Integrals

C347 Complete Elliptic Integrals of First, Second, and Third Kind

Routine ID: C347
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 07.06.1992
Language: FortranRevised:

Function subprograms RELI1C, RELI2C, RELI3C and DELI1C, DELI2C, DELI3C calculate the complete elliptic integrals of the first, second and third kind, respectively.

Function subprograms RELIGC and DELIGC calculate a general complete elliptic integral.

Function subprograms RELIKC, RELIEC and DELIKC, DELIEC calculate the complete elliptic integrals K(k) and E(k) .

On CDC and Cray computers, the double-precision versions DELI1C etc. are not available.

Mainly for reasons of numerical stability, the algorithms are based on the following definitions:

First kind:
F1*(k') = ∫0&inf;{dξ(1+ξ2)(1+k'2ξ2)}(k'2> 0).

Second kind:
F2*(k',a,b) = ∫0&inf;{a+bξ2(1+ξ2)(1+ξ2)(1+k'2ξ2)} dξ(k'2> 0).

Third kind:
F3*(k',p) = ∫0&inf;{1+ξ2(1+pξ2)(1+ξ2)(1+k'2ξ2)} dξ(k'2> 0, p ≠0).

Note that F1*(k') = F2*(k',1,1) =F3*(k',1) . For p < 0, the integral F3* is defined by its principal value.

The general integral:
G(k',p,a,b) = 0&inf;{a+bξ2(1+pξ2)(1+ξ2)(1+k'2ξ2)} dξ

= 0π/2{a cos2φ+ b sin2φcos2φ+ p sin2φ}{dφcos2φ+ k'2sin2φ}(k'2> 0).

For p < 0, this integral is defined by its principal value. See Notes for special cases.

The functions K(k) and E(k):
K(k) = 0π/2{dψ1-k2sin2ψ}(|k| < 1),

E(k) = 0π/21-k2sin2ψ dψ(|k| ≤1).

Other common definitions of the complete elliptic integrals and their relations to F1* , F2* , F3* are listed here for convenience (k2+k'2= 1 ):
First kind:

F(k,π/2) = K(k) &quad;= &quad;F1*(k') (|k| < 1),

F(1,k) = 01{dη(1-η2)(1-k2η2)}&quad;= &quad;F1*(k') (|k| < 1).

Second kind:

E(k,π/2) = E(k) &quad;= &quad;F2*(k',1,k'2)(|k| ≤1),

E(1,k) = 01{1-k2η21-η2} dη&quad;= &quad;F2*(k',1,k'2) (|k| ≤1).

Third kind:

Π(π/2,h,k) = 0π/2{dψ(1+hsin2ψ)1-k2sin2ψ} = F3*(k',h+1) (|k| < 1),

Π(1,h,k) = 01{dη(1+hη2)(1-η2)(1-k2η2)} = F3*(k',h+1) (|k| < 1).

Structure:

FUNCTION subprograms
User Entry Names:
RELI1C, RELI2C, RELI3C, RELIGC, RELIKC, RELIEC
DELI1C, DELI2C, DELI3C, DELIGC, DELIKC, DELIEC

Obsolete User Entry Names:
ELLICK RELIKC, ELLICE RELIEC,
DELLIK DELIKC, DELLIE DELIEC

Files Referenced: Unit 6
External References: MTLMTR (N002), ABEND (Z035)

Usage:

In any arithmetic expression, with AK=k and AKP=k' ,
RELI1C(AKP)DELI1C(AKP)F1*(k') ,
RELI2C(AKP,A,B)DELI2C(AKP,A,B)F2*(k',A,B) ,
RELI3C(AKP,AK2,P)DELI3C(AKP,AK2,P)F3*(k',P) ,
RELIGC(AKP,P,A,B)DELIGC(AKP,P,A,B)G(k',P,A,B) ,
RELIKC(AK)DELIKC(AK)K(k) ,
RELIEC(AK)DELIEC(AK)E(k) ,

where RELI1C etc are of type REAL, DELI1C etc are of type DOUBLE PRECISION, and AKP, AK, AK2, A, B and P have the same type as the function name.

The redundant parameter AK2 in RELI3C and DELI3C permits improved accuracy when k2 is small, i.e. k' ≈1 . In this case, AK2= k2 should be calculated using higher-precision arithmetic and then truncated before calling the subprogram.

Method:

The evaluation of F1* , F2* , F3*

is based on the Landen transformation, that of G on the Bartky transformation. For details, see Ref. 1--3. For K(k) and E(k)

Chebyshev approximations are used (see Ref. 4).

Accuracy:

The REAL functions (except on CDC and Cray computers) have full single-precision accuracy. The REAL functions on CDC and Cray, and the DOUBLE PRECISION functions on all computers have an accuracy approximately two significant digits less than the machine precision.

Restrictions:

1. RELI1C and DELI1C: AKP ≠0 .
2. RELI2C and DELI2C: AKP ≠0 . or AKP = 0 and B = 0 .
3. RELI3C and DELI3C: AKP*P 0.
4. RELIGC and DELIGC: AKP ≠0 .
5. RELIKC and DELIKC: |AK| ≤1 , RELIEC and DELIEC: |AK| < 1 .

Error handling:

Error C347.1: Restriction 1 is not satisfied.
Error C347.2: Restriction 2 is not satisfied.
Error C347.3: Restriction 3 is not satisfied.
Error C347.4: Restriction 4 is not satisfied.
Error C347.5: Restriction 5 is not satisfied.
In all cases, the function value is set equal to zero, and a message is written on Unit 6, unless subroutine MTLSET (N002) has been called.

Notes:

Every linear combination of the three special complete elliptic integrals K(k) , E(k) , Π(h,k) may be expressed in terms of G(k',p,a,b) :

λK(k) + μE(k) = G(k',1,λ+μ,λ+μk'2)

λK(k) + μΠ(h,k) = G(k',h+1,λ+μ,λ(h+1)+μ)

Special examples are

K(k) = G(k',1,1,1),

E(k) = G(k',1,1,k'2)

(K(k)-E(k))/k2 = G(k',1,0,1),

(K(k)-k'2E(k))/k2 = G(k',1,1,0),

Π(h,k) = G(k',h+1,1,1),

(K(k)-Π(h,k))/h = G(k',h+1,0,1),

If ab ≥0 then G will evaluate any linear combination of K(k) , E(k) , Π(h,k) without cancellation (such as would occur, for example, if (K(k)- E(k))/k2 were to be computed from values of K(k) and E(k) which had been computed separately.

Other functions which can be represented by G are the Jacobian Zeta function Z(Φ,k) and the Heuman Lambda function Λ0(Φ,k) (see Ref. 5):

Z(Φ,k) = k2 {sinΦcosΦK(k)} G(k',q,0,q) (q = cos2Φ+ k'2sin2Φ)

Λ0(Φ,k) = {2π}qsinΦ G(k',q,1,k'2) (q = 1 + k2tan2Φ).

(Quoted from Ref. 3, slightly modified).

The subprograms for F1* , F2* are based on the Algol60 procedures cel1, cel2 in Ref. 1, those for F3* on cel3 in Ref. 2, and those for G

on cel in Ref. 3.

References:

  1. R. Bulirsch, Numerical calculation of elliptic integrals and elliptic functions, Numer. Math. 7 (1965) 78--90.
  2. R. Bulirsch, Numerical calculation of elliptic integrals and elliptic functions II, Numer. Math. 7 (1965) 353--354.
  3. R. Bulirsch, Numerical calculation of elliptic integrals and elliptic functions III, Numer. Math. 13 (1969) 305--315.
  4. W.J. Cody, Chebyshev approximations for the complete elliptic integrals K and E, Math. Comp. 19 (1965) 105--112.
  5. P.F. Byrd and M.D. Friedman, Handbook of elliptic integrals for engineers and scientists, 2nd ed., Springer-Verlag Berlin (1971) 33--37.

C348



next up previous index
Next: C348 Elliptic Integral Up: CERNLIB Previous: C346 Elliptic Integrals


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995