NAG CL Interface
s21dac (ellipint_​general_​2)

Settings help

CL Name Style:


1 Purpose

s21dac returns the value of the general elliptic integral of the second kind F(z,k,a,b) for a complex argument z.

2 Specification

#include <nag.h>
Complex  s21dac (Complex z, double akp, double a, double b, NagError *fail)
The function may be called by the names: s21dac, nag_specfun_ellipint_general_2 or nag_general_elliptic_integral_f.

3 Description

s21dac evaluates an approximation to the general elliptic integral of the second kind F(z,k,a,b) given by
F(z,k,a,b)=0za+bζ2 (1+ζ2)(1+ζ2)(1+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+k2 ζ 2 ) ,  
or F1(z,k) (the elliptic integral of the first kind) and
F(z,k,1,k2)=0z1+k2ζ2 (1+ζ2)1+ζ2 dζ,  
or F2(z,k) (the elliptic integral of the second kind). Note that the values of F1(z,k) and F2(z,k) are equal to tan-1(z) in the trivial case k=1.
s21dac 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 Arguments

1: z Complex Input
On entry: the argument z of the function.
Constraints:
  • 0.0z.reλ;
  • abs(z.im)λ, where λ6=1/nag_real_safe_small_number.
2: akp double Input
On entry: the argument k of the function.
Constraint: abs(akp) λ .
3: a double Input
On entry: the argument a of the function.
4: b double Input
On entry: the argument b of the function.
5: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_COMPLEX
On entry, |z.im| is too large: |z.im|=value. It must not exceed value.
On entry, z.re<0.0: z.re=value.
On entry, z.re is too large: z.re=value. It must not exceed value.
NE_INTERNAL_ERROR
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.
NE_NO_LICENCE
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.
NE_REAL
On entry, |akp| is too large: |akp|=value. It must not exceed value.
NE_S21_CONV
The iterative procedure used to evaluate the integral has failed to converge.

7 Accuracy

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.

8 Parallelism and Performance

s21dac is not threaded in any implementation.

9 Further Comments

None.

10 Example

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

10.1 Program Text

Program Text (s21dace.c)

10.2 Program Data

Program Data (s21dace.d)

10.3 Program Results

Program Results (s21dace.r)