hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_specfun_ellipint_general_2 (s21da)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_specfun_ellipint_general_2 (s21da) 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.


[result, ifail] = s21da(z, akp, a, b)
[result, ifail] = nag_specfun_ellipint_general_2(z, akp, a, b)


nag_specfun_ellipint_general_2 (s21da) 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 arguments, z is a complex argument whose real part is non-negative and k is a real argument (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.
nag_specfun_ellipint_general_2 (s21da) 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.


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


Compulsory Input Parameters

1:     z – complex scalar
The argument z of the function.
  • 0.0Re(z)λ;
  • absIm(z)λ, where λ6=1/x02am.
2:     akp – double scalar
The argument k of the function.
Constraint: absakp λ .
3:     a – double scalar
The argument a of the function.
4:     b – double scalar
The argument b of the function.

Optional Input Parameters


Output Parameters

1:     result – complex scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry,Rez<0.0,
orakp>λ, where λ6=1/x02am.
The iterative procedure used to evaluate the integral has failed to converge. The result is returned as zero.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


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 atan2 and log.

Further Comments



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.
function s21da_example

fprintf('s21da example results\n\n');

z =  1.2 + 3.7i;
kp = 0.5;
a = 1;
b = 1;

[result, ifail] = s21da(z, kp, a, b);

fprintf('%5.1f%+5.1fi  %7.2f%7.2f%7.2f%10.5f%+10.5fi\n', real(z), imag(z), ...
        kp, a, b, real(result), imag(result));

s21da example results

     z           k'      a      b       F(z,k',a,b)
  1.2 +3.7i     0.50   1.00   1.00   1.97126  +0.50538i

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015