nag_general_elliptic_integral_f (s21dac) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_general_elliptic_integral_f (s21dac)

## 1  Purpose

nag_general_elliptic_integral_f (s21dac) returns the value of the general elliptic integral of the second kind $F\left(z,{k}^{\prime },a,b\right)$ for a complex argument $z$.

## 2  Specification

 #include #include
 Complex nag_general_elliptic_integral_f (Complex z, double akp, double a, double b, NagError *fail)

## 3  Description

nag_general_elliptic_integral_f (s21dac) evaluates an approximation to the general elliptic integral of the second kind $F\left(z,{k}^{\prime },a,b\right)$ given by
 $Fz,k′,a,b=∫0za+bζ2 1+ζ21+ζ21+k′2ζ2 dζ,$
where $a$ and $b$ are real arguments, $z$ is a complex argument whose real part is non-negative and ${k}^{\prime }$ 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 ${F}_{1}\left(z,{k}^{\prime }\right)$ (the elliptic integral of the first kind) and
 $Fz,k′,1,k′2=∫0z1+k′2ζ2 1+ζ21+ζ2 dζ,$
or ${F}_{2}\left(z,{k}^{\prime }\right)$ (the elliptic integral of the second kind). Note that the values of ${F}_{1}\left(z,{k}^{\prime }\right)$ and ${F}_{2}\left(z,{k}^{\prime }\right)$ are equal to ${\mathrm{tan}}^{-1}\left(z\right)$ in the trivial case ${k}^{\prime }=1$.
nag_general_elliptic_integral_f (s21dac) is derived from an Algol 60 procedure given by Bulirsch (1960). Constraints are placed on the values of $z$ and ${k}^{\prime }$ 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

## 5  Arguments

1:    $\mathbf{z}$ComplexInput
On entry: the argument $z$ of the function.
Constraints:
• $0.0\le {\mathbf{z}}\mathbf{.}\mathbf{re}\le \lambda$;
• $\mathrm{abs}\left({\mathbf{z}}\mathbf{.}\mathbf{im}\right)\le \lambda$, where ${\lambda }^{6}=1/{\mathbf{nag_real_safe_small_number}}$.
2:    $\mathbf{akp}$doubleInput
On entry: the argument ${k}^{\prime }$ of the function.
Constraint: $\mathrm{abs}\left({\mathbf{akp}}\right)\le \lambda$.
3:    $\mathbf{a}$doubleInput
On entry: the argument $a$ of the function.
4:    $\mathbf{b}$doubleInput
On entry: the argument $b$ of the function.
5:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_COMPLEX
On entry, $\left|{\mathbf{z}}\mathbf{.}\mathbf{im}\right|$ is too large: $\left|{\mathbf{z}}\mathbf{.}\mathbf{im}\right|=〈\mathit{\text{value}}〉$. It must not exceed $〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{z}}\mathbf{.}\mathbf{re}<0.0$: ${\mathbf{z}}\mathbf{.}\mathbf{re}=〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{z}}\mathbf{.}\mathbf{re}$ is too large: ${\mathbf{z}}\mathbf{.}\mathbf{re}=〈\mathit{\text{value}}〉$. It must not exceed $〈\mathit{\text{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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_REAL
On entry, $\left|{\mathbf{akp}}\right|$ is too large: $\left|{\mathbf{akp}}\right|=〈\mathit{\text{value}}〉$. It must not exceed $〈\mathit{\text{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

nag_general_elliptic_integral_f (s21dac) is not threaded in any implementation.

None.

## 10  Example

This example evaluates the elliptic integral of the first kind ${F}_{1}\left(z,{k}^{\prime }\right)$ given by
 $F1z,k′=∫0zdζ 1+ζ21+k′2ζ2 ,$
where $z=1.2+3.7i$ and ${k}^{\prime }=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)

nag_general_elliptic_integral_f (s21dac) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual