# Theta Functions

 Function Library Home Theta Functions

## Table of Available Theta Functions

• Theta Functions
θ1(ν, x) = 2 Σj=0 (-1) jexp[-(j + ½)² π² x] sin[(2j+1)π ν]
θ2(ν, x) = 2 Σj=0 exp[-(j + ½)² π² x] cos[(2j+1)π ν]
θ3(ν, x) = 1 + 2 Σj=0 exp[-j² π² x] cos[2j π ν]
θ4(ν, x) = 1 + 2 Σj=0(-1) j exp[-j² π² x] cos[2j π ν]
• Theta Functions - Expansion in Terms of the Nome.
ϑ1(z, q) = θ1(z / π, -ln(q) / π²)
ϑ2(z, q) = θ2(z / π, -ln(q) / π²)
ϑ3(z, q) = θ3(z / π, -ln(q) / π²)
ϑ4(z, q) = θ4(z / π, -ln(q) / π²)
• Neville Theta Functions
ϑs(u, k) = (2K / π) ϑ1(z, q) / ϑ'1(0, q)
ϑc(u, k) = ϑ2(z, q) / ϑ2(0, q)
ϑd(u, k) = ϑ3(z, q) / ϑ3(0, q)
ϑn(u, k) = ϑ4(z, q) / ϑ4(0, q)
where z = π u / 2 K,
K is the complete elliptic integral of the first kind with modulus k,
and q is the nome with modulus k.
• Theta Functions with Zero Parameter
θ1(0, x) = 0
θ2(0, x) = 2 Σj=0 exp[-(j + ½)² π² x]
θ3(0, x) = 1 + 2 Σj=0 exp[-j² π² x]
θ4(0, x) = 1 + 2 Σj=0(-1) j exp[-j² π² x]
• Nome Expanded Theta Functions with Zero Argument
ϑ1(0, q) = θ1(0, -ln(q) / π²)
ϑ2(0, q) = θ2(0, -ln(q) / π²)
ϑ3(0, q) = θ3(0, -ln(q) / π²)
ϑ4(0, q) = θ4(0, -ln(q) / π²)
• d Theta Functions / dν
(dθ1/dν)(ν, x) = 2π Σj=0 (-1) j(2j+1) exp[-(j + ½)² π² x] cos[(2j+1)π ν]
(dθ2/dν)(ν, x) = - 2π Σj=0(2j+1) exp[-(j + ½)² π² x] sin[(2j+1)π ν]
(dθ3/dν)(ν, x) = - 4π Σj=0j exp[-j² π² x] sin[2j π ν]
(dθ4/dν)(ν, x) = - 4π Σj=0(-1) j j exp[-j² π² x] sin[2j π ν]
• d Theta Functions / dz
(dϑ1 / dz)(z, q) = 2 q 1/4 Σn=0 (-1) nq n(n+1)(2n+1) cos[(2n+1)z]
(dϑ2 / dz)(z, q) = - 2 q 1/4 Σn=0 q n(n+1)(2n+1) sin[(2n+1)z]
(dϑ3 / dz)(z, q) = - 4 Σn=1 qn sin[2nz]
(dϑ4 / dz)(z, q) = - 4 Σn=1 (-1) nqn sin[2nz]
• d Neville Theta Functions / du
(d ϑs / du)(u, k) = (d ϑ1 / dz)(z, q) / ϑ'1(0, q)
(d ϑc / du)(u, k) = (π / 2K) (d ϑ2 / dz)(z, q) / ϑ2(0, q)
(d ϑd / du)(u, k) = (π / 2K) (d ϑ3 / dz)(z, q) / ϑ3(0, q)
(d ϑn / du)(u, k) = (π / 2K) (d ϑ4 / dz)(z, q) / ϑ4(0, q)

### Theta Functions

The forms of the theta functions as given in Spanier's and Oldham's “ An Atlas of Functions” are
θ1(ν, x) = (1 / √(π x) Σj=- ∞ (-1) jexp[-(ν + j - ½)² / x]
θ2(ν, x) = (1 / √(π x) Σj=- ∞ (-1) jexp[-(ν + j)² / x]
θ3(ν, x) = (1 / √(π x) Σj=- ∞ exp[-(ν + j)² / x]
θ4(ν, x) = (1 / √(π x) Σj=- ∞ exp[-(ν + j + ½)² / x]
and
θ1(ν, x) = 2 Σj=0 (-1) jexp[-(j + ½)² π² x] sin[(2j+1)π ν]
θ2(ν, x) = 2 Σj=0 exp[-(j + ½)² π² x] cos[(2j+1)π ν]
θ3(ν, x) = 1 + 2 Σj=0 exp[-j² π² x] cos[2j π ν]
θ4(ν, x) = 1 + 2 Σj=0(-1) j exp[-j² π² x] cos[2j π ν]
where ν is called the parameter and x is called the argument.
The four theta functions are periodic in the parameter ν, where θ(ν + 2, x) = -θ(ν + 1, x) = &theta(ν, x) for θ = θ1 or θ = θ2 and θ(ν + 1, x) = &theta(ν, x) for θ = θ3 or θ = θ4. The first form of the four theta functions converge rapidly for x ≤ 1 / π and the second form converges rapidly for x ≥ 1 / π.

#### Function List

• void Theta_Functions(double nu, double x, double *theta_1, double *theta_2, double *theta_3, double *theta_4 )

This function returns the four theta functions, θ1(ν,x), θ2(ν,x), θ3(ν,x), and θ4(ν,x) evaluated at ν = nu and x = x. θ1(ν,x) is returned in theta_1, θ2(ν,x) is returned in theta_2, θ3(ν,x) is returned in theta_3, and θ4(ν,x) is returned in theta_4.

#### Source Code

C source code is available for this routine:
• The file, theta_functions.c, contains the routine Theta_Functions( ).

Dependencies: No external dependencies.

### Theta Functions - Expansion in Terms of the Nome.

The form of the theta functions as given in Abramowitz and Steguns' “ Handbook of Mathematical Functions” is
ϑ1(z, q) = 2 q 1/4 Σn=0 (-1) nq n(n+1) sin[(2n+1)z]
ϑ2(z, q) = 2 q 1/4 Σn=0 q n(n+1) cos[(2n+1)z]
ϑ3(z, q) = 1 + 2 Σn=1 q cos[2nz]
ϑ4(z, q) = 1 + 2 Σn=1 (-1) nq cos[2nz]
where 0 ≤ q < 1 is the nome.
In terms of the theta functions given in Spanier's and Oldham's “ An Atlas of Functions”
ϑ1(z, q) = θ1(z / π, -ln(q) / π²)
ϑ2(z, q) = θ2(z / π, -ln(q) / π²)
ϑ3(z, q) = θ3(z / π, -ln(q) / π²)
ϑ4(z, q) = θ4(z / π, -ln(q) / π²)

#### Function List

• void Jacobian_Theta_Functions(double z, double q, double *theta_1, double *theta_2, double *theta_3, double *theta_4 )

This function returns the four theta functions, ϑ1(z,q), ϑ2(z,q), ϑ3(z,q), and ϑ4(z,q) evaluated at z,q. ϑ1(z,q) is returned in theta_1, ϑ2(z,q) is returned in theta_2, ϑ3(z,q) is returned in theta_3, and ϑ4(z,q) is returned in theta_4. Note that 0 ≤ q < 1.

#### Source Code

C source code is available for this routine:
• The file, jacobian_theta_functions.c, contains the routine
Jacobian_Theta_Functions( ).

Dependencies: In addition to the file jacobian_theta_functions.c, the routine Jacobian_Theta_Functions() requires the following file:

### Neville Theta Functions

Neville's form of the theta functions as given in Abramowitz and Steguns' “ Handbook of Mathematical Functions” is
ϑs(u, k) = (2K / π) ϑ1(z, q) / ϑ'1(0, q)
ϑc(u, k) = ϑ2(z, q) / ϑ2(0, q)
ϑd(u, k) = ϑ3(z, q) / ϑ3(0, q)
ϑn(u, k) = ϑ4(z, q) / ϑ4(0, q)
where z = π u / 2 K, K is the complete elliptic integral of the first kind with modulus k and 0 ≤ q < 1 is the nome with modulus k. where 0 ≤ q < 1 is the nome.

#### Function List

• void Neville_Theta_Functions(double u, double k, double K, double r_tau, double *theta_s, double *theta_c, double *theta_d, double *theta_n )

This function returns the four Neville theta functions, ϑs(u,k), ϑc(u,k), ϑd(u,k), and ϑn(u,k) evaluated at (u,k), where K is the complete elliptic integral of the first kind with modulus k and r_tau is the ratio K / K' where K' is the complete elliptic integral of the first kind with modulus k' = √(1 - k²), if k = 0, then r_tau = 0. ϑs(u,k) is returned in theta_s, ϑc(u,k) is returned in theta_c, ϑd(u,k) is returned in theta_d, and ϑn(u,k) is returned in theta_n. Note that 0 ≤ q < 1

#### Source Code

C source code is available for these routines:
• The file, neville_theta_functions.c, contains the routine
Neville_Theta_Functions( ).

Dependencies: In addition to the file neville_theta_functions.c, the routine Neville_Theta_Functions() requires the following files:

### Theta Functions with Zero Parameter

The forms of the theta functions as given in Spanier's and Oldham's “ An Atlas of Functions” in which the parameter ν = 0 are
θ1(0, x) = 0
θ2(0, x) = (1 / √(π x) Σj=- ∞ (-1) jexp[-j² / x]
θ3(0, x) = (1 / √(π x) Σj=- ∞ exp[-j² / x]
θ4(0, x) = (1 / √(π x) Σj=- ∞ exp[-(j + ½)² / x]
and
θ1(0, x) = 0
θ2(0, x) = 2 Σj=0 exp[-(j + ½)² π² x]
θ3(0, x) = 1 + 2 Σj=0 exp[-j² π² x]
θ4(0, x) = 1 + 2 Σj=0(-1) j exp[-j² π² x].
The first form of the four theta functions converge rapidly for x ≤ 1 / π and the second form converges rapidly for x ≥ 1 / π.

#### Function List

• void Theta_Functions_at_zero(double x, double *theta_1, double *theta_2, double *theta_3, double *theta_4)

This function returns the four theta functions with zero parameter, θ1(0,x), θ2(0,x), θ3(0,x), and θ4(0,x) evaluated at x. θ1(0,x) is returned in theta_1, θ2(0,x) is returned in theta_2, θ3(0,x) is returned in theta_3, and θ4(0,x) is returned in theta_4.

#### Source Code

C source code is available for this routine:
• The file, theta_functions_at_zero.c, contains the routine Theta_Functions_at_zero( ).

Dependencies: No external dependencies.

### Nome Expanded Theta Functions with Zero Argument

The form of the theta functions as given in Abramowitz and Steguns' “ Handbook of Mathematical Functions” for z = 0 is
ϑ1(0, q) = 0
ϑ2(0, q) = 2 q 1/4 Σn=0 q n(n+1)
ϑ3(0, q) = 1 + 2 Σn=1 q
ϑ4(0, q) = 1 + 2 Σn=1 (-1) nq
where 0 ≤ q < 1 is the nome.

#### Function List

• void Jacobian_Theta_Functions_at_zero(double q, double *theta_1, double *theta_2, double *theta_3, double *theta_4 )

This function returns the four theta functions, ϑ1(z,q), ϑ2(z,q), ϑ3(z,q), and ϑ4(z,q) evaluated at z = 0. ϑ1(0,q) is returned in theta_1, ϑ2(0,q) is returned in theta_2, ϑ3(0,q) is returned in theta_3, and ϑ4(0,q) is returned in theta_4. Note that 0 ≤ q < 1.

#### Source Code

C source code is available for these routines:
• The file, jacobian_theta_functions_at_zero.c, contains the routine
Jacobian_Theta_Functions_at_zero( ).

Dependencies: In addition to the file jacobian_theta_functions_at_zero.c, the routine Jacobian_Theta_Functions_at_zero() requires the following file:

### d Theta Functions / dν

The derivative with respect to ν of the forms of the theta functions as given in Spanier's and Oldham's “ An Atlas of Functions” are
(dθ1/dν)(ν, x) = - (2 / x √(π x) Σj=- ∞ (-1) j(ν + j - ½) exp[-(ν + j - ½)² / x]
(dθ2/dν)(ν, x) = - (2 / x √(π x) Σj=- ∞ (-1) j(ν + j) exp[-(ν + j)² / x]
(dθ3/dν)(ν, x) = - (2 / x √(π x) Σj=- ∞(ν + j) exp[-(ν + j)² / x]
(dθ4/dν)(ν, x) = - (2 / x √(π x) Σj=- ∞(ν + j + ½) exp[-(ν + j + ½)² / x]
and
(dθ1/dν)(ν, x) = 2π Σj=0 (-1) j(2j+1) exp[-(j + ½)² π² x] cos[(2j+1)π ν]
(dθ2/dν)(ν, x) = - 2π Σj=0(2j+1) exp[-(j + ½)² π² x] sin[(2j+1)π ν]
(dθ3/dν)(ν, x) = - 4π Σj=0j exp[-j² π² x] sin[2j π ν]
(dθ4/dν)(ν, x) = - 4π Σj=0(-1) j j exp[-j² π² x] sin[2j π ν]
where ν is called the parameter and x is called the argument.
The first form of the four theta functions converge rapidly for x ≤ 1 / π and the second form converges rapidly for x ≥ 1 / π.

#### Function List

• void DTheta_Functions(double nu, double x, double *dtheta_1, double *dtheta_2, double *dtheta_3, double *dtheta_4 )

This function returns the derivative with respect to ν of the four theta functions,
(dθ1 / dν)(ν,x), (dθ2 / dν)(ν,x), (dθ3 / dν)(ν,x), and (dθ4 / dν)(ν,x) evaluated at ν = nu and x = x. (dθ1 / dν)(ν,x) is returned in dtheta_1, (dθ2 / dν)(ν,x) is returned in dtheta_2, (dθ3 / dν)(ν,x) is returned in dtheta_3, and (dθ4 / dν)(ν,x) is returned in dtheta_4.

#### Source Code

C source code is available for this routine:
• The file, dtheta_functions.c, contains the routine DTheta_Functions( ).

Dependencies: No external dependencies.

### D Jacobi Theta Functions

The form of the derivative with respect to z of the theta functions as given in Abramowitz and Steguns' “ Handbook of Mathematical Functions” is
(dϑ1 / dz)(z, q) = 2 q 1/4 Σn=0 (-1) nq n(n+1)(2n+1) cos[(2n+1)z]
(dϑ2 / dz)(z, q) = - 2 q 1/4 Σn=0 q n(n+1)(2n+1) sin[(2n+1)z]
(dϑ3 / dz)(z, q) = - 4 Σn=1 qn sin[2nz]
(dϑ4 / dz)(z, q) = - 4 Σn=1 (-1) nqn sin[2nz]
where 0 ≤ q < 1 is the nome.
In terms of the theta functions given in Spanier's and Oldham's “ An Atlas of Functions”
(dϑ1 / dz)(z, q) = (dθ1 / dν)(z / π, -ln(q) / π²) / π
(dϑ2 / dz)(z, q) = (dθ2 / dν)(z / π, -ln(q) / π²) / π
(dϑ3 / dz)(z, q) = (dθ3 / dν)(z / π, -ln(q) / π²) / π
(dϑ4 / dz)(z, q) = (dθ4 / dν)(z / π, -ln(q) / π²) / π

#### Function List

• void DJacobian_Theta_Functions(double z, double q, double *dtheta_1, double *dtheta_2, double *dtheta_3, double *dtheta_4 )

This function returns the derivative with respect to z of the four theta functions, (dϑ1 / dz)(z,q), (dϑ2 / dz)(z,q), (dϑ3 / dz)(z,q), and (dϑ4 / dz)(z,q) evaluated at z,q. (dϑ1 / dz)(z,q) is returned in dtheta_1, (dϑ2 / dz)(z,q) is returned in theta_2, (dϑ3 / dz)(z,q) is returned in theta_3, and (dϑ4 / dz)(z,q) is returned in theta_4. Note that 0 ≤ q < 1.

#### Source Code

C source code is available for this routine:
• The file, djacobian_theta_functions.c, contains the routine DJacobian_Theta_Functions( ).

Dependencies: In addition to the file djacobian_theta_functions.c, the routine DJacobian_Theta_Functions() requires the following file:

### d Neville Theta Functions / du

The derivative of Neville's form of the theta functions as given in Abramowitz and Steguns' “ Handbook of Mathematical Functions” is
(d ϑs / du)(u, k) = (d ϑ1 / dz)(z, q) / ϑ'1(0, q)
(d ϑc / du)(u, k) = (π / 2K) (d ϑ2 / dz)(z, q) / ϑ2(0, q)
(d ϑd / du)(u, k) = (π / 2K) (d ϑ3 / dz)(z, q) / ϑ3(0, q)
(d ϑn / du)(u, k) = (π / 2K) (d ϑ4 / dz)(z, q) / ϑ4(0, q)
where z = π u / 2 K, K is the complete elliptic integral of the first kind with modulus k and 0 ≤ q < 1 is the nome with modulus k. where 0 ≤ q < 1 is the nome.

#### Function List

• void DNeville_Theta_Functions(double u, double k, double K, double r_tau, double *dtheta_s, double *dtheta_c, double *dtheta_d, double *dtheta_n )

This function returns the derivative with respect to u of the four Neville theta functions, (d ϑs / du)(u,k), (d ϑc / du)(u,k), (d ϑd / du)(u,k), and (d ϑn / du)(u,k) evaluated at (u,k), where K is the complete elliptic integral of the first kind with modulus k and r_tau is the ratio K / K' where K' is the complete elliptic integral of the first kind with modulus k' = √(1 - k²), if k = 0, then r_tau = 0. (d ϑs / du)(u,k) is returned in dtheta_s, (d ϑc / du)(u,k) is returned in dtheta_c, (d ϑd / du)(u,k) is returned in dtheta_d, and (d ϑn / du)(u,k) is returned in dtheta_n. Note that 0 ≤ q < 1

#### Source Code

C source code is available for this routine:
• The file, dneville_theta_functions.c, contains the routine
DNeville_Theta_Functions( ).

Dependencies: In addition to the file dneville_theta_functions.c, the routine DNeville_Theta_Functions() requires the following files: