NAG CL Interface
s21cac (jacellip_​real)

Settings help

CL Name Style:


1 Purpose

s21cac evaluates the Jacobian elliptic functions sn, cn and dn.

2 Specification

#include <nag.h>
void  s21cac (double u, double m, double *sn, double *cn, double *dn, NagError *fail)
The function may be called by the names: s21cac, nag_specfun_jacellip_real or nag_real_jacobian_elliptic.

3 Description

s21cac evaluates the Jacobian elliptic functions of argument u and argument m,
sn(um) = sinϕ, cn(um) = cosϕ, dn(um) = 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)).
s21cac 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.

4 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

5 Arguments

1: u double Input
2: m double Input
On entry: the argument u and the argument m of the functions, respectively.
Constraints:
  • abs(u) λ , where λ = 1 / nag_real_safe_small_number;
  • if abs(u) < 1 / λ , abs(m) λ .
3: sn double * Output
4: cn double * Output
5: dn double * Output
On exit: the values of the functions snu, cnu and dnu, respectively.
6: 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_BAD_PARAM
On entry, argument value had an illegal 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_2
On entry, |m| is too large when used in conjunction with the supplied argument u: |m|=value it must be less than value.
On entry, |u| is too large: |u|=value it must be less than value.

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 SIN and COS.

8 Parallelism and Performance

s21cac is not threaded in any implementation.

9 Further Comments

None.

10 Example

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

10.1 Program Text

Program Text (s21cace.c)

10.2 Program Data

Program Data (s21cace.d)

10.3 Program Results

Program Results (s21cace.r)