# 3.5.1.3.45 Jacobian_theta

## Definition:

The y = jacobian_theta(k, x, q) computes the value of one of the Jacobian theta functions $\theta _0 (x, q)$, $\theta _1 (x, q)$, $\theta _2 (x, q)$, $\theta _3 (x, q)$ or $\theta _4 (x, q)$ for a real argument x and non-negative q ≤ 1.

The routine evaluates an approximation to the Jacobian theta functions $\theta _0 (x, q)$, $\theta _1 (x, q)$, $\theta _2 (x, q)$, $\theta _3 (x, q)$ and $\theta _4 (x, q)$ given by

$\theta _0\left( x,q\right) =1+2\sum_{n=1}^\infty \left( -1\right) ^nq^{n^2}\cos (2n\pi x)$,
$\theta _1\left( x,q\right) =2\sum_{n=0}^\infty \left( -1\right)^nq^{(n+0.5)^2}\sin((2n+1)\pi x)$,
$\theta _2\left( x,q\right) =2\sum_{n=0}^\infty q^{(n+0.5)^2}\cos ((2n+1)\pi x)$,
$\theta _3\left( x,q\right) =1+2\sum_{n=1}^\infty q^{n^2}\cos (2n\pi x)$,
$\theta _4\left( x,q\right) =\theta _0\left( x,q\right)$,

where x and q are real with 0 ≤ q ≤ 1. Note that $\theta _1 (x-0.5, 1)$ is undefined if $(x-0.5)$ is an integer, as is $\theta _2 (x, 1)$ if x is an integer. Otherwise, $\theta _i (x, 1)=0$, for $i=0, 1, ..., 4$.

## Parameters:

k (input, integer)
The function $\theta _k$ (x,q) to be evaluated. Note that k=4 is equivalent to k=0.
Constraint: 0 ≤ k ≤ 4.
x (input, double)
The argument x of the function.
Constraints: x must not be an integer when q=1.0 and k=2; (x-0.5) must not be an integer when q=1.0 and k=1.
q (input, double)
The argument q of the function.
Constraint: 0.0 ≤ q ≤ 1.0.
y (output, double)
The return value of one of the Jacobian theta functions.