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_legendre_2 (s21bf)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_specfun_ellipint_legendre_2 (s21bf) returns a value of the classical (Legendre) form of the incomplete elliptic integral of the second kind, via the function name.

Syntax

[result, ifail] = s21bf(phi, dm)
[result, ifail] = nag_specfun_ellipint_legendre_2(phi, dm)

Description

nag_specfun_ellipint_legendre_2 (s21bf) calculates an approximation to the integral
Eϕm = 0ϕ 1-m sin2θ 12 dθ ,  
where 0ϕ π2  and msin2ϕ1 .
The integral is computed using the symmetrised elliptic integrals of Carlson (Carlson (1979) and Carlson (1988)). The relevant identity is
Eϕm = sinϕ RF q,r,1 - 13 m sin3ϕ RD q,r,1 ,  
where q=cos2ϕ , r=1-m sin2ϕ , RF  is the Carlson symmetrised incomplete elliptic integral of the first kind (see nag_specfun_ellipint_symm_1 (s21bb)) and RD  is the Carlson symmetrised incomplete elliptic integral of the second kind (see nag_specfun_ellipint_symm_2 (s21bc)).

References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Carlson B C (1979) Computing elliptic integrals by duplication Numerische Mathematik 33 1–16
Carlson B C (1988) A table of elliptic integrals of the third kind Math. Comput. 51 267–280

Parameters

Compulsory Input Parameters

1:     phi – double scalar
2:     dm – double scalar
The arguments ϕ and m of the function.
Constraints:
  • 0.0phi π2;
  • dm× sin2phi 1.0 .

Optional Input Parameters

None.

Output Parameters

1:     result – double 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:
   ifail=1
Constraint: 0phiπ2.
   ifail=2
Constraint: dm×sin2phi1.0.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

In principle nag_specfun_ellipint_legendre_2 (s21bf) is capable of producing full machine precision. However round-off errors in internal arithmetic will result in slight loss of accuracy. This loss should never be excessive as the algorithm does not involve any significant amplification of round-off error. It is reasonable to assume that the result is accurate to within a small multiple of the machine precision.

Further Comments

You should consult the S Chapter Introduction, which shows the relationship between this function and the Carlson definitions of the elliptic integrals. In particular, the relationship between the argument-constraints for both forms becomes clear.
For more information on the algorithms used to compute RF  and RD , see the function documents for nag_specfun_ellipint_symm_1 (s21bb) and nag_specfun_ellipint_symm_2 (s21bc), respectively.
If you wish to input a value of phi outside the range allowed by this function you should refer to Section 17.4 of Abramowitz and Stegun (1972) for useful identities. For example, E-ϕ|m=-Eϕ|m. A parameter m>1 can be replaced by one less than unity using Eϕ|m=mEϕm|1m-m-1ϕ.

Example

This example simply generates a small set of nonextreme arguments that are used with the function to produce the table of results.
function s21bf_example


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

phi = [pi/6  pi/3   pi/2];
dm  = [1/4   1/2    3/4];
result = phi;

for j = 1:numel(phi)
  [result(j), ifail] = s21bf(phi(j), dm(j));
end

fprintf('    phi      m        E(phi|m)\n');
fprintf(' %7.2f %7.2f %12.4f\n', [phi; dm; result]);

s21bf_plot;



function s21bf_plot
  phi = [1:0.02:1.56];
  m = [0.5:0.02:0.98,0.982:0.002:1];
  F = zeros(numel(phi),numel(m));
  for i = 1:numel(phi)
    for j = 1:numel(m)
      [F(i,j), ifail] = s21bf(phi(i), m(j));
    end
  end

  fig1 = figure;
  [Y,X] = meshgrid(m,phi);
  surf(X,Y,F);
  xlabel('\Phi');
  ylabel('m');
  zlabel('F(\Phi,n)');
  title({'Incomplete Elliptic Integral of the second kind', ...
         'Classical (Legendre) form'});

s21bf example results

    phi      m        E(phi|m)
    0.52    0.25       0.5179
    1.05    0.50       0.9650
    1.57    0.75       1.2111
s21bf_fig1.png

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