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_jacellip_real (s21ca)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_specfun_jacellip_real (s21ca) evaluates the Jacobian elliptic functions sn, cn and dn.

Syntax

[sn, cn, dn, ifail] = s21ca(u, m)
[sn, cn, dn, ifail] = nag_specfun_jacellip_real(u, m)

Description

nag_specfun_jacellip_real (s21ca) evaluates the Jacobian elliptic functions of argument u and argument m,
snum = sinϕ, cnum = cosϕ, dnum = 1-msin2ϕ,  
where ϕ, called the amplitude of u, is defined by the integral
u=0ϕdθ 1-msin2θ .  
The elliptic functions are sometimes written simply as snu, cnu and dnu, avoiding explicit reference to the argument m.
Another nine elliptic functions may be computed via the formulae
cdu = cnu/dnu sdu = snu/dnu ndu = 1/dnu dcu = dnu/cnu ncu = 1/cnu scu = snu/cnu nsu = 1/snu dsu = dnu/snu csu = cnu/snu  
(see Abramowitz and Stegun (1972)).
nag_specfun_jacellip_real (s21ca) is based on a procedure given by Bulirsch (1960), and uses the process of the arithmetic-geometric mean (16.9 in Abramowitz and Stegun (1972)). Constraints are placed on the values of u and m in order to avoid the possibility of machine overflow.

References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Bulirsch R (1960) Numerical calculation of elliptic integrals and elliptic functions Numer. Math. 7 76–90

Parameters

Compulsory Input Parameters

1:     u – double scalar
2:     m – double scalar
The argument u and the argument m of the functions, respectively.
Constraints:
  • absu λ , where λ = 1 / x02am;
  • if absu < 1 / λ , absm λ .

Optional Input Parameters

None.

Output Parameters

1:     sn – double scalar
2:     cn – double scalar
3:     dn – double scalar
The values of the functions snu, cnu and dnu, respectively.
4:     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
On entry,absu>λ, where λ=1/x02am.
   ifail=2
On entry,absm>λ and absu<1/λ.
   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 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 SIN and COS.

Further Comments

None.

Example

This example reads values of the argument u and argument m from a file, evaluates the function and prints the results.
function s21ca_example


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

u = [0.2   5  -0.5   10];
m = [0.3  -1  -0.1   11];
sn = u; cn = u; dn = u;

for j=1:numel(u)
  [sn(j), cn(j), dn(j), ifail] = s21ca(u(j),m(j));
end

disp('       u         m         sn        cn        dn');
fprintf('%10.2f%10.2f%10.4f%10.4f%10.4f\n',[u; m; sn; cn; dn]);


s21ca example results

       u         m         sn        cn        dn
      0.20      0.30    0.1983    0.9801    0.9941
      5.00     -1.00   -0.2440    0.9698    1.0293
     -0.50     -0.10   -0.4812    0.8766    1.0115
     10.00     11.00    0.2512    0.9679    0.5528

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