## Evaluation of toroidal harmonics. J. Segura, A. Gil.

PROGRAM SUMMARY
Title of program: DTORH1, DTORH2, DTORH3
Ref. in CPC: 124(2000)104
Distribution format: tar gzip file
Operating system: UNIX, Linux
Number of lines in distributed program, including test data, etc: 1439
Programming language used: Fortran
Computer: HP Model 715/100

Nature of physical problem:
We include three codes to evaluate toroidal harmonics: DTORH1: This code evaluates toroidal harmonics (TH) of the first and second kinds for a given order m, from the lowest (positive) degreee (n=0) to a maximum degree n = N in the same run. DTORH2: This code evaluates toroidal harmonics of the first and second kinds Pm(n-1/2)(x) and Qm(n-1/2)(x) for orders m = 0,...,M and degrees n = 0,...,N. In this code, for each given order m, TH up to the maximum degree reached by the computer for such order m (N(m)) can be calculated. DTORH3: This code evaluates toroidal harmonics of the first and second kinds for orders m = 0,...,M and degrees n = 0,...,N. TH up to the smallest maximum degree reachable for the different values of m = 0,1,...,M can be calculated. The algorithms find their application in problems with toroidal geometry. In particular, the potential problem for a torus is solved using both Ps and Qs.

Method of solution
The codes are based on the application of recurrence relations both over m and n. The recurrence over n is applied forward for the Ps and backward for the Qs while, over m, the situation is the contrary: the Ps are evaluated backwards and the Qs forward. The forward and backward recursions (over n or over m) are linked through continued fractions for the ratio of minimal solutions and Wronskian relations. The recurrences are fed with the two starting values Q0(1/2) and Q1(-1/2), which are evaluated using Carlson's duplication formula for elliptic integrals.

Restrictions on the complexity of the problem
The maximum degree (order) that can be reached with our method, for a given order (degree) m (n) and for a fixed real positive value of x, is provided by the maximum real number defined in our machine. The user can choose two different relative accuracies (10**-8 or 10**-12) in the interval 1.001 < x < 1000 for all available values of the orders and degrees. For more details see text: LONG WRITE-UP, section 3.

Typical running time
Depends on the values of the argument x, the orders (m) and the degrees (n). As an example, to evaluate the set {Pm(n-1/2)(1.1), Qm(n-1/2)(1.1), m = 0,...,10, n = 0,...,50,} the code DTORH3 spends 2.6 ms in a HP 715/100. For more details see text: LONG WRITE-UP, section 5.