NAG CL Interface
s21cbc (jacellip_​complex)

1 Purpose

s21cbc evaluates the Jacobian elliptic functions snz, cnz and dnz for a complex argument z.

2 Specification

#include <nag.h>
void  s21cbc (Complex z, double ak2, Complex *sn, Complex *cn, Complex *dn, NagError *fail)
The function may be called by the names: s21cbc, nag_specfun_jacellip_complex or nag_jacobian_elliptic.

3 Description

s21cbc evaluates the Jacobian elliptic functions snzk, cnzk and dnzk given by
snzk = sinϕ cnzk = cosϕ dnzk = 1-k2sin2ϕ,  
where z is a complex argument, k is a real argument (the modulus) with k21 and ϕ (the amplitude of z) is defined by the integral
z=0ϕdθ 1-k2sin2θ .  
The above definitions can be extended for values of k2>1 (see Salzer (1962)) by means of the formulae
snzk = k1snkzk1 cnzk = dnkzk1 dnzk = cnkzk1,  
where k1=1/k.
Special values include
snz0 = sinz cnz0 = cosz dnz0 = 1 snz1 = tanhz cnz1 = sechz dnz1 = sechz.  
These functions are often simply written as snz, cnz and dnz, thereby avoiding explicit reference to the argument k. They can also be expressed in terms of Jacobian theta functions (see s21ccc).
Another nine elliptic functions may be computed via the formulae
cdz = cnz/dnz sdz = snz/dnz ndz = 1/dnz dcz = dnz/cnz ncz = 1/cnz scz = snz/cnz nsz = 1/snz dsz = dnz/snz csz = cnz/snz  
(see Abramowitz and Stegun (1972)).
The values of snz, cnz and dnz are obtained by calls to s21cac. Further details can be found in Section 9.

4 References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Salzer H E (1962) Quick calculation of Jacobian elliptic functions Comm. ACM 5 399

5 Arguments

1: z Complex Input
On entry: the argument z of the functions.
Constraints:
  • absz.re=λ;
  • absz.imλ, where λ=1/nag_real_safe_small_number.
2: ak2 double Input
On entry: the value of k2.
Constraint: 0.0ak21.0.
3: sn Complex * Output
4: cn Complex * Output
5: dn Complex * Output
On exit: the values of the functions snz, cnz and dnz, 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_COMPLEX
On entry, z.im is too large: z.im=value. It must be less than value.
On entry, z.re is too large: z.re=value. It must be less than 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, ak2=value.
Constraint: ak21.0.
On entry, ak2=value.
Constraint: ak20.0.

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

s21cbc is not threaded in any implementation.

9 Further Comments

The values of snz, cnz and dnz are computed via the formulae
snz = snu,kdnv,k 1-dn2u,ksn2v,k + i cnu,kdnu,ksnv,kcnv,k 1-dn2u,ksn2v,k cnz = cnu,kcnv,k 1-dn2u,ksn2v,k - i snu,kdnu,ksnv,kdnv,k 1-dn2u,ksn2v,k dnz = dnu,kcnv,kdnv,k 1-dn2u,ksn2v,k - i k2snu,kcnu,ksnv,k 1-dn2u,ksn2v,k ,  
where z=u+iv and k=1-k2 (the complementary modulus).

10 Example

This example evaluates snz, cnz and dnz at z=-2.0+3.0i when k=0.5, and prints the results.

10.1 Program Text

Program Text (s21cbce.c)

10.2 Program Data

Program Data (s21cbce.d)

10.3 Program Results

Program Results (s21cbce.r)