# §23.22 Methods of Computation

## §23.22(i) Function Values

Given and , with , the nome is computed from . For we apply (23.6.2) and (23.6.5), generating all needed values of the theta functions by the methods described in §20.14.

The functions and are computed in a similar manner: the former by replacing and in (23.6.13) by and , respectively, and also referring to (23.6.8); the latter by applying (23.6.9).

The modular functions , , and are also obtainable in a similar manner from their definitions in §23.15(ii).

## §23.22(ii) Lattice Calculations

### ¶ Starting from Lattice

Suppose that the lattice is given. Then a pair of generators and can be chosen in an almost canonical way as follows. For choose a nonzero point of of smallest absolute value. (There will be 2, 4, or 6 possible choices.) For choose a nonzero point that is not a multiple of and is such that and is as small as possible, where . (There will be either 1 or 2 possible choices.) This yields a pair of generators that satisfy , , . In consequence, satisfies . The corresponding values of , , are calculated from (23.6.2)–(23.6.4), then and are obtained from (23.3.6) and (23.3.7).

### ¶ Starting from Invariants

Suppose that the invariants , , are given, for example in the differential equation (23.3.10) or via coefficients of an elliptic curve (§23.20(ii)). The determination of suitable generators and is the classical inversion problem (Whittaker and Watson (1927, §21.73), McKean and Moll (1999, §2.12); see also §20.9(i) and McKean and Moll (1999, §2.16)). This problem is solvable as follows:

1. (a)

In the general case, given by , we compute the roots , , , say, of the cubic equation ; see §1.11(iii). These roots are necessarily distinct and represent , , in some order.

If and are real, then , , can be identified via (23.5.1), and , obtained from (23.6.16).

If and are not both real, then we label , , so that the triangle with vertices , , is positively oriented and is its longest side (chosen arbitrarily if there is more than one). In particular, if , , are collinear, then we label them so that is on the line segment . In consequence, , satisfy (with strict inequality unless , , are collinear); also , .

Finally, on taking the principal square roots of and we obtain values for and that lie in the 1st and 4th quadrants, respectively, and , are given by

where denotes the arithmetic-geometric mean (see §§19.8(i) and 22.20(ii)). This process yields 2 possible pairs (, ), corresponding to the 2 possible choices of the square root.

2. (b)

If , then

There are 4 possible pairs (, ), corresponding to the 4 rotations of a square lattice. The lemniscatic case occurs when and .

3. (c)

If , then

There are 6 possible pairs (, ), corresponding to the 6 rotations of a lattice of equilateral triangles. The equianharmonic case occurs when and .

### ¶ Example

Assume and . Then , , ; , and . Working to 6 decimal places we obtain