s21cc returns the value of one of the Jacobian theta functions θ0x,q, θ1x,q, θ2x,q, θ3x,q or θ4x,q for a real argument x and non-negative q<1.

Syntax

C#
public static double s21cc(
	int k,
	double x,
	double q,
	out int ifail
)
Visual Basic
Public Shared Function s21cc ( _
	k As Integer, _
	x As Double, _
	q As Double, _
	<OutAttribute> ByRef ifail As Integer _
) As Double
Visual C++
public:
static double s21cc(
	int k, 
	double x, 
	double q, 
	[OutAttribute] int% ifail
)
F#
static member s21cc : 
        k : int * 
        x : float * 
        q : float * 
        ifail : int byref -> float 

Parameters

k
Type: System..::..Int32
On entry: denotes the function θkx,q to be evaluated. Note that k=4 is equivalent to k=0.
Constraint: 0k4.
x
Type: System..::..Double
On entry: the argument x of the function.
q
Type: System..::..Double
On entry: the argument q of the function.
Constraint: 0.0q<1.0.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Return Value

s21cc returns the value of one of the Jacobian theta functions θ0x,q, θ1x,q, θ2x,q, θ3x,q or θ4x,q for a real argument x and non-negative q<1.

Description

s21cc evaluates an approximation to the Jacobian theta functions θ0x,q, θ1x,q, θ2x,q, θ3x,q and θ4x,q given by
θ0x,q=1+2n=1-1nqn2cos2nπx,θ1x,q=2n=0-1nqn+122sin2n+1πx,θ2x,q=2n=0qn+122cos2n+1πx,θ3x,q=1+2n=1qn2cos2nπx,θ4x,q=θ0x,q,
where x and q (the nome) are real with 0q<1.
These functions are important in practice because every one of the Jacobian elliptic functions (see s21cb) can be expressed as the ratio of two Jacobian theta functions (see Whittaker and Watson (1990)). There is also a bewildering variety of notations used in the literature to define them. Some authors (e.g., Section 16.27 of Abramowitz and Stegun (1972)) define the argument in the trigonometric terms to be x instead of πx. This can often lead to confusion, so great care must therefore be exercised when consulting the literature. Further details (including various relations and identities) can be found in the references.
s21cc is based on a truncated series approach. If t differs from x or -x by an integer when 0t12, it follows from the periodicity and symmetry properties of the functions that θ1x,q=±θ1t,q and θ3x,q=±θ3t,q. In a region for which the approximation is sufficiently accurate, θ1 is set equal to the first term (n=0) of the transformed series
θ1t,q=2λπe-λt2n=0-1ne-λn+122sinh2n+1λt
and θ3 is set equal to the first two terms (i.e., n1) of
θ3t,q=λπe-λt21+2n=1e-λn2cosh2nλt,
where λ=π2/logeq. Otherwise, the trigonometric series for θ1t,q and θ3t,q are used. For all values of x, θ0 and θ2 are computed from the relations θ0x,q=θ312-x,q and θ2x,q=θ112-x,q.

References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Byrd P F and Friedman M D (1971) Handbook of Elliptic Integrals for Engineers and Scientists pp. 315–320 (2nd Edition) Springer–Verlag
Magnus W, Oberhettinger F and Soni R P (1966) Formulas and Theorems for the Special Functions of Mathematical Physics 371–377 Springer–Verlag
Tølke F (1966) Praktische Funktionenlehre (Bd. II) 1–38 Springer–Verlag
Whittaker E T and Watson G N (1990) A Course in Modern Analysis (4th Edition) Cambridge University Press

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry,k<0,
ork>4,
orq<0.0,
orq1.0,
ifail=2
The evaluation has been abandoned because the function value is infinite. The result is returned as the largest machine representable number (see x02al).
ifail=-9000
An error occured, see message report.

Accuracy

In principle the method 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.

Parallelism and Performance

None.

Further Comments

None.

Example

This example evaluates θ2x,q at x=0.7 when q=0.4, and prints the results.

Example program (C#): s21cce.cs

Example program data: s21cce.d

Example program results: s21cce.r

See Also