S21CBF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

NAG Library Routine Document

S21CBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+− Contents

    1  Purpose
    7  Accuracy

1  Purpose

S21CBF evaluates the Jacobian elliptic functions sn⁡z, cn⁡z and dn⁡z for a complex argument z.

2  Specification

SUBROUTINE S21CBF ( Z, AK2, SN, CN, DN, IFAIL)
INTEGER  IFAIL
REAL (KIND=nag_wp)  AK2
COMPLEX (KIND=nag_wp)  Z, SN, CN, DN

3  Description

S21CBF evaluates the Jacobian elliptic functions snz∣k, cnz∣k and dnz∣k given by
snz∣k = sin⁡ϕ cnz∣k = cos⁡ϕ dnz∣k = 1-k2sin2⁡ϕ,
where z is a complex argument, k is a real parameter (the modulus) with k2≤1 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
snz∣k = k1snkz∣k1 cnz∣k = dnkz∣k1 dnz∣k = cnkz∣k1,
where k1=1/k.
Special values include
snz∣0 = sin⁡z cnz∣0 = cos⁡z dnz∣0 = 1 snz∣1 = tanh⁡z cnz∣1 = sech⁡z dnz∣1 = sech⁡z.
These functions are often simply written as sn⁡z, cn⁡z and dn⁡z, thereby avoiding explicit reference to the parameter k. They can also be expressed in terms of Jacobian theta functions (see S21CCF).
Another nine elliptic functions may be computed via the formulae
cd⁡z = cn⁡z/dn⁡z sd⁡z = sn⁡z/dn⁡z nd⁡z = 1/dn⁡z dc⁡z = dn⁡z/cn⁡z nc⁡z = 1/cn⁡z sc⁡z = sn⁡z/cn⁡z ns⁡z = 1/sn⁡z ds⁡z = dn⁡z/sn⁡z cs⁡z = cn⁡z/sn⁡z
(see Abramowitz and Stegun (1972)).
The values of sn⁡z, cn⁡z and dn⁡z are obtained by calls to S21CAF. Further details can be found in Section 8.

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  Parameters

1:     Z – COMPLEX (KIND=nag_wp)Input
On entry: the argument z of the functions.
Constraints:
  • absRe(Z)≤=λ;
  • absIm(Z)≤λ, where λ=1/X02AMF.
2:     AK2 – REAL (KIND=nag_wp)Input
On entry: the value of k2.
Constraint: 0.0≤AK2≤1.0.
3:     SN – COMPLEX (KIND=nag_wp)Output
4:     CN – COMPLEX (KIND=nag_wp)Output
5:     DN – COMPLEX (KIND=nag_wp)Output
On exit: the values of the functions sn⁡z, cn⁡z and dn⁡z, respectively.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,AK2<0.0,
orAK2>1.0,
orabsReZ>λ,
orabsImZ>λ, where λ=1/X02AMF.

7  Accuracy

In principle the routine 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  Further Comments

The values of sn⁡z, cn⁡z and dn⁡z are computed via the formulae
sn⁡z = snu,kdnv,k′ 1-dn2u,ksn2v,k′ + i cnu,kdnu,ksnv,k′cnv,k′ 1-dn2u,ksn2v,k′ cn⁡z = cnu,kcnv,k′ 1-dn2u,ksn2v,k′ - i snu,kdnu,ksnv,k′dnv,k′ 1-dn2u,ksn2v,k′ dn⁡z = dnu,kcnv,k′dnv,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).

9  Example

This example evaluates sn⁡z, cn⁡z and dn⁡z at z=-2.0+3.0i when k=0.5, and prints the results.

9.1  Program Text

Program Text (s21cbfe.f90)

9.2  Program Data

Program Data (s21cbfe.d)

9.3  Program Results

Program Results (s21cbfe.r)


S21CBF (PDF version)
S Chapter Contents
S Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012