%
% 462
%
\chapter{The Theta Functions}

\Section{21}{1}{The definition of a Theta-function.}

When it is desired to obtain definite numerical results in problems
involving Elliptic functions, the calculations are most simply
performed with the aid of certain auxiliary functions known as
Thetafunctions. These functions are of considerable intrinsic
interest, apart from their connexion with Elliptic functions, and we
shall now give an account of their funda- mental properties.

The Theta-functions were first systematically studied by Jacobi*, who
obtained their properties by purely algebraical methods; and his
analysis was so complete that practically all the results contained in
this chapter (with the exception of the discussion of the problem of
inversion in §§ 21-7 et seq.) are to be found in his works. In
accordance with the general scheme of this book, we shall not employ
the methods of Jacobi, but the more powerful methods based on the use
of Cauchy's theorem. These methods Avere first employed in the theory
of Elliptic and allied functions by Liouville in his lectures and have
since been given in several treatises on Elliptic functions, the
earliest of these works being that by Briot and Bouquet.

[Note. The first function of the Theta-function type to appear in
Analysis was the

Partition function U (l-.*'" )" of Euler, Introductio in Anaiysin
Infinitorum, i.

(Lausanne, 1748), § 304; by means of the results given in 5 21-3, it
is easy to express Theta-functions in terms of Partition functions.
Euler also obtained properties of products of the type

n (i±A-"), n (i±a;2 ), n (i± -2 -i).

n=l n = l n=\

The associated series 2 ?n "('*+ \ 2 m-" ""* and 2 m ' had previously
occurred in the

>i=0 n=0 M=0

posthumous work of Jakob Bei'nouUi, Ars Conjectandi (1713), p. 55.

* Fundamenta Nova Theoriae Fimctionum Ellipticarum (Konigsberg, 1829),
and Ges. Werke, I. pp. 497-538.

t The Partition function and as-sociated functions have been studied
by Gauss, Comm. Soc. reg. sci. Gottinnensis rec. i. (1811), pp. 7-l'2
[Werke, ii. pp. 16-21] and Werke, iii. pp. 433-480 and Cauchy,
Coviptes liendus, x. (1840), pp. 178-181. For a discussion of
properties of various functions involving what are known as Basic
lumbers (which are closely connected with Partition functions) see
Jackson, Froc. Roijal Soc. Lxxiv. (1905), pp. 64-72, Froc. London
Math. Soc. (1) xxviii. (1897), pp. 475-486 and (2) i. (1904), pp.
63-88, ii. (1904), pp. 192-220; and Watson, Camb. Fhil. Trails. XXI.
(1912), pp. 281-299. A fundamental formula in the tlieory of Basic
numbers was given by Heine, Kugelfunktionen (Berlin, 1878), i. p. 107.

%
% 463
%

Theta-functions also occur in Fourier's La Theorie Analytique de la
Chaleur (Paris, 1822), cf. p. 265 of Freeman's translation (Cambridge,
1878).

The theory of Theta-functions was developed from the theory of
elliptic functions by Jacobi in his Fundameata Nova Theoriae
Functionum Ellipticarum (1829), reprinted in his Ges. Werke, i. pp.
49-239; the notation there employed is explained in \hardsubsectionref{21}{6}{2}. In his
subsequent lectures, he introduced the functions discussed in this
chapter; an account of these lectures (1838) is given by Borchardt in
Jacobi's Ges. Werl-e, i. pp. 497-538. The most important results
contained in them seem to have been discovered in 1835, cf. Kronecker,
Sitzungsherichte der ALad. zu Berlin (1891), pp. 653-659.]

Let T be a (constant) complex number whose imaginary part is positive
; and write q = e' '", so that q\ < l.

Consider the function z, q), defined by the series

00

qua function of the variable z.

If A be any positive constant, then, when \ 2\ \ A, we have

I qII' Q-k2.niz i < I (7 i '*'" QinA

n being a positive integer.

00

Now d'Alembert's ratio \hardsubsectionref{2}{3}{6}) for the series S | q ["'e ji is j q
|2n+ig2

  = - 00

which tends to zero as ?i x . The series for z, q) is therefore a
series of analytic functions, uniformly convergent (§ 334) in any
bounded domain of values of vS", and so it is an integral function (§§
5"3, 5*64).

It is evident that

 70

  (, 5) - 1 + 2 S -y'q" ' COS 2nz,

 =i

and that

 ( + 7r,g) = (ir, g);

further

'z + 'TTT,q)= S (\ ) 5"- 2ng2nw

 - - 00

-- \ Q-1 Q-2iz y (\ \ n+iQ(n+i)-Q'i n+ ) iz

and SO z + ttt, q) = ~ q~ e~ ' ' (z, q).

In consequence of these results, z, q) is called a quasi doubly
-periodic function of z. The effect of increasing 2 by tt or ttt is
the same as the effect of multiplying z, q) by 1 or - q~ e~', and
accordingly 1 and - q~ e~' are called the multipliers or periodicity
factors associated with the periods ir and TTT respectively.

\Subsection{21}{1}{1}{The four types of Theta functions.}

It is customary to write 4 z, q) in place of z, q); the other three
types of Theta-functions are then defined as follows :

%
% 464
%

The function 3(2', ) is defined by the equation

/ 1 \ ",

 3 (, g) = 4 ( + 2 TT, 9 1 = 1 + 2 1 7"- COS 2)12.

Next, %(z, q) is defined in terms of 4(2, q) by the equation

 i = - 00

and hence* % 2, q) = 2 t (-)"(/(" + *)' sin (2 n + l)z.

71 =

Lastly, 2 ( . q) is defined by the equation

' ., z,q = %(z + l7r,q) = 2 t q'<" + - ' cos 2n+ ) z.

V / H=0

Writing down the series at length, we have

 1 ( ) q) = q* sin z - 2q* sin 3 + 25"*"" sin bz - ..., 2 z, q) = 2q*
cos z + 2g' cos Sz + 2q' '' cos 5 + . . ., 3 (z, fy) = 1 + 2 ' cos 2z
+ 2q* cos 4 + 29 cos 62 + ..., 4 ( > ) = 1 ~ 2g cos 22 + 2q* cos 4 -
S *" cos Qz + -

It is obvious that j (2, q) is an odd function of 2 and that the other
Theta-functions are even functions of z.

The notation which has now been introduced is a modified form of that
employed in the treatise of Tannery and Molk; the only difference
between it and Jacobi's notation is that 4 (2, q) is written where
Jacobi would have written (2, q). There are, unfortunately, several
notations in use; a scheme, giving the connexions between them, will
be found in \hardsectionref{2}{9}.TODO:verifyref

For brevity, the parameter q will usually not be specified, so that 1
(2), ... will be written for 1 (2, q), .... When it is desired to
exhibit the dependence of a Theta-function on the parameter r, it will
be written (2 j t). Also 2(0), 3(0), ' 4(0) will be replaced by 2> 3,
' 4 respectively; and / will denote the result of making 2 equal to
zero in the derivate of 1(2). Example 1. Shew that

3i z, q) = 9s 2z, q )-h 2z, q*). Example 2. 01)tain the results

Bi z)= -B.2 z + i ) =-iMB-i z + n + UT)=-iMSi z + !TT\

\$2(2)= MS3 z + Ut)= mi z + \ n + nr)= S Z + hTr),

 3(2)= 3i z+U) = .l/,(3 + W+i7rr)= m, z + UT),

3i (2) = - iJfSi (2 + 777") = im.2 z+U+ i rr) = 3 (2 + U), where M=q*
e".

* Throughout the chapter, the many-valued function q is to be
interpreted to mean exp (Xttit).

%
% 465
%

Example 3. Shew that the multipliers of the Theta-functions associated
with the periods tt, ttt are given by the scheme

S,iz)

 2 Z)

h z)

3, z)

n

-1

- 1

N

1

1

TTT

-N-

iV" .

-N

where iV = q~ e ' .

Example 4. If -9 (2) be any one of the four Theta-functions and d' (2)
its derivate with respect to z, shew that

 9'(2+7r) \ .9'(2) (0 +,r) ~T £)'

\Subsection{21}{1}{2}{The reros of the Theta-functions.}

From the quasi-periodic properties of the Theta-functions it is
obvious that if z) be any one of them, and if o be any zero of z),
then

z - - riiTT + niTT

is also a zero of z), for all integral values of in and n.

It will now be shewn that if G be a cell with corners i, t -f- vr, -I-
vr + ttt, t - TTT, then z) has one and only one zero inside G.

Since z) is analytic throughout the finite part of the -plane, it
follows, from \hardsubsectionref{6}{3}{1}, that the number of its zeros inside G is

 ' z)

dz.

27riJc ( ) Treating the contour after the manner of § 2012, we see
that 1 f " '(z)

Inriir ( )

dz

1 / +-| ( ) '( + 7 rT)) \ J\ 27rtj, l ( ) (s-f-TTT) " " 27n

dz

t + T

2idz,

27rij t by \hardsubsectionref{21}{1}{1}, example 4. Therefore

1 r y( )

27ri J c ( )

C? = 1,

that is to say, z) has one simple zero only inside G; this is the
theorem stated.

W. M. A.

30

%
% 466
%

Since one zero of i z) is obviously z = 0, it follows that the zeros
of i( ), %(z), %, z), 4( ) are the points congruent respectively to 0,
,

Itt-I-Ittt, Ittt. The reader will observe that these four points form
the corners of a parallelogram described counter-clockwise.

\Section{21}{2}{The relations between the squares uf the Theta-f unctions.}

It is evident that, if the Thcsta-functions be regarded as functions
of a single variable z, this variable can be eliminated from the
equations defining any pair of Theta-functions, the result being a
relation* between the functions which might be expected, on general
grounds, to be non-algebraic; there are, however, extremely simple
relations connecting any three of the Theta- functions; these
relations will now be obtained.

Each of the four functions i" z), " z), 3- z), V z) is analytic for
all values of z and has periodicity factors 1, q-" e-* associated with
the periods IT, TTT; and each has a double zero (and no other zeros)
in any cell.

From these considerations it is obvious that, if a, b, a' and b' are
suitably chosen constants, each of the functions

aV(g)-h6V ( ) a'% '(z)+b'X'(z) V( ) ' V( )

is a doubly-periodic function (with periods tt, ttt) having at most
only a simple pole in each cell. By \hardsubsectionref{20}{1}{3}, such a function is merely
a constant; and obviously we can adjust a, b, a, b' so as to make the
constants, in each of the cases under consideration, equal to unity.

There exist, therefore, relations of the form

     z) = a%' (z) + 6V (z), %' (z) = a%' (z) + b'X' (z).

To determine a, b, a, b', give z the special values ttt and; since

we have ' 3- = - (( 4-, 2" = 4"; %- = - a", ' 3- = 6" 4-.

Consequently, we have obtained the relations

X' z) 4' = 4 z) X' - X' (z) %', % (z) %' = X' z) %' - %' z),1 If we
write z + - ir for z, we get the additional relations

%' (z) V = %' (z) %' - . (z) 3% V (z) V = %' (z) V - X' (z) V. By
means of these results it is possible to express any Theta-function in
terms of any other pair of Theta-functions.

* The analoo;ou.s relation for the fuuctions sinz and cos 2 is, of
course, (sin2)"''+(cos,:)2= 1.

%
% 467
%

Corollary. Writing z=0 in the last relation, we have that is to say

\Subsection{21}{2}{1}{The addition-formulae for the Theta functions.}

The results just obtained are particular cases of formulae containing
two variables; these formulae are not addition-theorems in the strict
sense, as they do not express Theta-functions of 2 + y algebraically
in terms of Theta- functions of z and y, but all involve
Theta-functions of z - y as well as of z - -y, z and y.

To obtain one of these formulae, consider 3 z -h y) ' 3 z - y) qua
function of z. The periodicity factors of this function associated
with the periods tt and TTT are 1 and (f e-2''2+!/) . q- Q-iiKz-y) =
q-2 -Hz

But the function a j- z) + 6 1- z) has the same periodicity factors,
and we can obviously choose the ratio a:b so that the doubly -periodic
function

a%' z) + fh Hz) % z + y)% z-y) has no poles at the zeros of 3 z - y);
it then has, at most, a single simple pole in any cell, namely the
zero of 3(2:4- y) in that cell, and consequently \hardsubsectionref{20}{1}{3}) it is a
constant, i.e. independent of z; and, as only the ratio a : 6 is so
far fixed, we may choose a and b so that the constant is unity. We
then have to determine a and b from the identity in z,

a%' (z) + b -' (z) =%(z-h y) X (z - y). To do this, put z in turn
equal to and - ir + - ttt, and we get

aX' = Hy\ h '( 7r + rTT = % ir + \ 7rr + y)% 'rr + rrT-y

and so a = 3- y)l ., b = " i y)l 3\

We have therefore obtained an addition-formula, namely

 3 ( + y) % z - y) / = V y) V z) + i iy) X' z).

The set of formulae, of which this is typical, will be found in
examples 1 and 2 at the end of this chapter.

21 '22. Jacobi's fundameMal formulae *.

The addition-formulae just obtained are particular cases of a set of
identities first given by Jacobi, who obtained them by purely
algebraical methods; each identity involves as many as four
independent variables, w, x, y, z.

Let iv', x\ y\ z' be defined in terms of lu, x, y, z by the set of
equations

2w' = -w- x- y- z 2x' = iv - x+y + z, 2?/' = w+x - y + z, 22' = tv- x-
y - z.

* Ges. Werke, i. p. 505.

30-2

%
% 468
%

The re<\ der will easily verify that the connexion between w, x, y, z
and iv\ x\ y\ z' is a reciprocal one*.

For brevity t, write [? ] for 5, (w) 5 (.r) 5 y) 3 z) and [r]' for S,
(to') \$, (x') \$, (if) S, (z').

Consider [3], [1]', [2]', [3]', [4J qua functions of z. The effect of
increasing by tt or nr is to transform the functions in the first row
of the following table into those in the second or third row
respectively.

[3]

[1]'

[2]'

[3]'

[4]'

in)

[3]

-[ J

-[I]'

[4]'

[3]'

(rrr)

 [3J

-iy[4]'

iV[3]'

iV[2]'

-.V[l]'

For brevity, iV has been written in place of q~ e~- .

Hence both -[l]' + [2]' + [3]'-|-[4]' and [3] have periodicity factors
1 and N, and so their quotient is a doubly-periodic function with, at
most, a single simple pole in any cell, namely the zero of 3 (z) in
that cell.

By \hardsubsectionref{20}{1}{3}, this quotient is merely a constant, i.e. independent of 2;
and considerations of symmetry shew that it is also independent of w,
x and y.

We have thus obtained the result

J[3]=-[l]' + [2]' + [3]' + [4]',

where A is independent of w, x, y, z; to determine A put w=x=y=z= and
we get

J g - .-' + V + i and so, by \hardsectionref{21}{2} corollary, we see that 4 = 2.

Therefore 2 [3]= -[l]' + [2]' + [3]' + [4j' (i).

This is one of Jacobi's formulae; to obtain another, increase if, .r,
y, z (and therefore also tp', x\ y', z) by w; and we get

2[4] = [lJ-[2]' + :3]' + [4]' (ii).

Increasing all the variables in (i) and (ii) by htrr, we obtain the
further results

2[2] = [l]' + [2]' + [3]'-[4]' (iii),

2[l] = [l]' + [2]'-[3]' + [4j (iv).

[Note. There are 256 expressions of the form dp (ic) 3g (x) S (y) 3
(2) which can be obtained from 3 (w) 3 (x) 3 (y) 3 (2) by incre;ising
w, x, y, z by suitable half-period.s, but only those in which the
suffixes p, q, r, s are either equal in pairs or all different give
rise to formulae not containing quarter-periods on the right-hand
side.]

Example 1. Shew that

[1] + [2] = [!]' + [2]', [2]-h[3] = [2]' + [.3]', [l]-h[4]=.[l]'-f
[4]', [3] -h [4] = [3]' -h [4]',

[l] + [3] = [2]' + [4]', [2]-f[4] = [l]'-h[3]'.

In Jacobi's work the signs of u-, .r', y', z' are changed throughout
so that the complete symmetry of the relations is destroyed; tlie
symmetrical forms just given are due to H. J. S. Smith, Proc. London
Math. Soc. 1. (May 21, 1860, pjx 1-12).

t The idea of this abridged notation is to be traced in H. J. S.
Smith's memoir. It seems, however, not to have been used before
Kronecker, Journal j'ilr Math. cii. (1887), pp. 260-272.

%
% 469
%

Example 2. By writing tv + n, x + \ tv for iv, x (and consequently /-
\ i, s' + tt for y\ /), shew that

[3344] + [2211] = [4433]' + [1122j,

where [3344] means 3 w) S3 (x) S y) 4 (z), etc. Example 3. Shew that

2[1234] = [3412]'+[2143]'-[1234]' + [4321]'. Example 4. Shew that

\Section{21}{3}{Jacobi's expressions for the Theta-functions as infinite products*TODO.}
We shall now establish the result

M = l

(where G is independent of z), and three similar formulae. Let fi2)= n
(1 - n-i e-- '>) n l-q->'- e--'');

each of the two products converges absolutely and uniformly in any
bounded

domain of values of z, by \hardsubsubsectionref{3}{3}{4}{1}, on account of the absolute
convergence of 00 V 2n-i. hence / (2:) is analytic throughout the
finite part of the 2 -plane,

and so it is an integral function.

The zeros of/(2') are simple zeros at the points where

g2iz = g(2H+l) T (w=..., -2, - 1,0, 1,2, ...)

i.e. where 2iz = (2?i + 1) ttit + 2ni7ri; so that f(z) and 4 (z) have
the same zeros; consequently the quotient ' i z)/f z) has neither
zeros nor poles in the finite part of the plane.

Now, obviously / (2 + tt) =f z);

GO QO

and f z+'77r)= IT (1 - 5- +ie-'' ) IT (1 - 52 -3 g-2fe)

  = 1 n = \

=f z) l-q-U- )! qe )

= -q- e'- f z). That is to say f(z) arid i z) have the same
periodicity factors (§ 2 I'll example 3). Therefore i z)/f(z) is a
doubly-periodic function with no zeros or poles, and so (| 20*12) it
is a constant G, say; consequently

 4 (z)=G U 1- 2q"'"-' cos 22 + 5 "--). 11=1

00 [It will appear in § 2142 that G= U (1 - q-'').]

n = l

Write z + TT for 2 in this result, and we get

%,(z)=G n (1 + 25 ' -! cos 2z + q' '-').

n=l * Cf. Fundamenta Nova, p. 145.

%
% 470
%

Also 1 (z) = - iq e", + ttt)

00 3C

= \ igi e'z G IJ (1 - 9=" e-'') TI (1 - q'''~"- e -'''')

n=l = 1

= 26 5* sin 11 (1 - f"e-") U I - e'-'O,

w = 1 = 1

and so, (z) = 2Gq sin ft ( I - 25-" cos 2z + q' )

n = \

while ', z)=' Jz + l7r]

= 2Gq cosz U 1 + 2q-'' cos 2z + ").

n = l Example. Shew that*

( cc 18 (-00 ISfoc 18

J n (i-?2 -i)i +16?- n (i+?2 )l = ' n (i+92 -i) .

bi = l J 'n=l J ln = l J

\addexamplecitation{Jacobi.}

\Section{21}{4}{The differential equation satisfied by the Theta-functions.}

We may regard s(z t) as a function of two independent variables z and
t; and it is permissible to differentiate the series for 3(2 |t) any
number of times with regard to z or r, on account of the uniformity of
convergence of the resulting series \hardsectionref{4}{7} corollary); in particular

- ' = - 4 2 n- exip n-7nT + 2mz)

OZ ft = - 00

Consequently, the function ' 3 (2 \ t) satisfies the partial
differential equation

1 .d y dy

The reader will readily prove that the other three Theta-functions
also satisfy this equation.

\Subsection{21}{4}{1}{A relation between Theta-functions of zero argument.}

The remarkable result that

V(0) = 2 (0) 3 (0) 4(0)

will now be established f. It is first necessary to obtain some
formulae for differential coefficients of all the Theta-functions.

* Jacobi describes this result (Fund. Nova, p. 90) as 'aequatio
identica satis abstrusa.'

t Several proofs of this important proposition have been given, but
none are simple.

Jacobi's original proof (Gfis. Werke, i. pp. 515-517), though somewhat
more difficult than the

proof given here, is well worth study.

%
% 471
%

Since the resulting series converge uniformly, except near the zeros
of the respective Theta-functions, we may differentiate the formulae
for the logarithms of Theta-functions, obtainable from \hardsectionref{21}{3}, as many
times as we please.

Denoting differentiations with regard to z by primes, we thus get

%' z) = X z)

1-1 a-'iiZ

L =i (1 + q e ) n=\

Making 2r 0, we get

a% (>2n- 1 g-2i3

=1 (1 + g "-i e-- )-

V (0) = 0, 3" (0) = - 8 3 (0) J (3 - .

In like manner.

V(0)-0, V(0) = 8 4(0) 2

 2' (0) = 0, 2" (0) = 2 (0)

..=i(] -cf- r

-1-8 S

 =i(l + <? '?J

and, if we write 1 z) = sin z . (z), we get

</)'(0) = 0, f (0) = 8(/>(0) i '"

If, however, we differentiate the equation 1 (z) = sin z . cj) (z)
three times, we get

 / (0) = (/> (0), /" (0) = S<p" (0) - </> (0).

Therefore

V"(0) V(0)

= 24 2

=1 (1 - q' y

-1;

and

V(0) v:iO), V:(0)

",(0) Sf3(0) 4(0)

 2?l 00,2/1-1 CO 2W- 1

8-2 2 + 2

L =i (1 + q' 'f .=1 (1 + q' '-'r .=1 (1 - ?''"-'/

= 8

\ V

+ 2

- 2

.=1 (1 + q 'T- .=1 (1 - q y n=i (1 - q y on combining the first two
series and writing the third as the difference of two series. If we
add corresponding terms of the first two series in the last line, we
get at once

V(0)

 V(0) V10)\ Vi0) 2

= 1 +

,(0) %(0) %iO) n=i l~q'''y V(0)

%
% 472
%

Utilising the differential equations of \hardsectionref{21}{4}, this may be written

1 d%' (0 I t) V(0|t) dr

\ 1 d%(0\ T) 1 d% 0\ r) 1 d%(0\ r)

~ 2(0|t) dr " 3(0|t) dr %(0\ t) dr

Integrating with regard to r, we get

V (0, q) = C% (0, q) % (0, q) % (0, q),

where C is a constant (independent of q). To determine C, make q- 0;
since

\ imq- X = % \ imq-- % = 2 lim 3 = l, lim 4 = l,

q O q O q -O (/ -O

we see that = 1; and so

which is the result stated.

\Subsection{21}{4}{2}{The value of the constant G.}

From the result just obtained, we can at once deduce the value of the
constant G which was introduced in \hardsectionref{21}{3}. For, by the formulae of
that section,

 / = 0(0)= 2q GU 1- q' % % = 2qiGU l + f )

M=l n=l

 3 = G n (1 + r''-')\ x = GU i- q ' -'f,

and so, by | 21-41, we have

00 O) OO CO

n (1 - (f y = G n (1 + q;"')' n (i + q '- y n (i - q -y.

Now all the products converge absolutely, since \ q\ < l, and so the
following rearrangements are permissible :

I n (1 - g "-') n (1 - ? 'ol  I fi (1 + (t-') n (1 + 'ol = n (i-9'O n
(i + g* )

M=l W=l

= n (1 - g * ),

M = l

the first step following from the consideration that all positive
integers are comprised under the forms 2n - 1 and 2n. Hence the
equation determining G is

n (1 - (f'J = G\

n=\

andso G=+ n (1 - r/

%
% 473
%

To determine the ambiguity in sign, we observe that G is an analytic
function of q (and consequently one-valued) throughout the domain \ q\
< \; and from the product for 3(2 ), we see that G- 1 as q->0. Hence
the plus sign must always be taken; and so we have established the
result

G=Yl (l- 'O-

Example 1. Shew that 1=22*0 .

Example 2. Shew that

Example 3. Shew that

1 + 2 i y -= n (i-(72 )(i+g2'i-i)2).

)! = 1 n = l

21 S. Connexion of the Sigma-f unction with the Theta- functions.

It has been seen 20-421 example 3) that the function a- [z \ wx, M2),
formed with the periods 2a)i, 2co2, is expressible in the form

where (/=exp (ttiojo/wi).

If we compare this result with the product of § 21 '4 for 1 [z \ t),
we see at once that

.(.) = exp( Y,-in(l-./ )-3i( |- ). TT \ 2coi/ 2 =i \ 2coi I COj/

To express j i in terms of Theta-functious, take logarithms and
differentiate twice, so that

 < )=:i-(0- =(e,)-( .T

.4>'

where v = 7rzja) and the function cf) is that defined in \hardsubsectionref{21}{4}{1}.

Expanding in ascending powers of z and equating the terms independent
of z in this result, we get

a>i 3 \ 2(oiJ \ 2(Ui/ (f) (0)

and SO,;=\ -- -- .

Lzooi i

Consequently a- z \ wi, wo) can be expressed in terms of
Theta-functions by the formula

'031 / I'-. l \ o / I "2

mi

a( lo, co,)=-,exp( --g J5,( v

where v hivzlwi.

Example. Prove that

/n'-a-iBi" 7n'\

\Section{21}{5}{The expression of elliptic functions by means of Theta-functions.}

It has just been seen that Theta-functions are substantially
equivalent to Sigma-functions, and so, corresponding to the formulae
of §§ 20'5-20"58, there will exist expressions for elliptic functions
in terms of Theta-functions.

%
% 474
%

From the theoretical point of view, the formulae of §§ 20"5-20"53 are
the more important on account of their S3'mmetry in the periods, but
in practice the Theta-function formulae have two advantages, (i) that
Theta-functions are more readily computed than Sigma-functions, (ii)
that the Theta- functions have a specially simple behaviour with
respect to the real period, which is generally the significant period
in applications of elliptic functions in Applied Mathematics.

Let $f(z)$ be an elliptic function with periods 2wi, 2\&J2; let a
fundamental set of zeros (aj, Oa, ... an) and poles (/3j, /3..., ...
/3 ) be chosen, so that

as in \hardsectionref{20}{3}TODO:verifyref.

Then, by the methods of \hardsubsectionref{20}{5}{3}, the reader will at once verify that

TTZ - TTCUr 1 W.jX TTZ - TTySr t Wg

r=\ (.

where A is a constant; and if

f z) = A,\ \ \ X[- - -'~' \ \ % .

' V Iw, (jdJ \ 2\&), CO

1)1).

m = l

be the principal part oi f(z) at its pole, then, by the methods of
§20-')2,

r=i (, =.! (m-1)! dz"" " V 2\&)i \&)i/J where J. 2 is a constant.

This formula is important in connexion with the integration of
elliptic functions. An example of an application of the formula to a
dynamical problem will be found in § 22741.

Example. Shew that

  3 (2)\ \ \ \ - l' ( ), - 3 - 3"

5i2 (2) ' dz .9i (2) i'3 ' and deduce that

\Subsection{21}{5}{1}{Jacobi's imaginary transformation.}

If an elliptic function be constructed with periods 2\&)i, 2w2, such
that

/ (( 2/a)i) > 0, it might be convenient to regard the periods as being
'Iw, - 2\&)i : for these numbers are periods and, if I (co-i/coi) >0,
then also /(- oji/wo)> 0. In the case of the elliptic functions which
have been considered up to this point, the periods have appeared in a
symmetrical manner and nothing is gained by this point of view. But in
the case of the Theta-functions, which are only quasi-periodic, the
behaviour of the function with respect to the real period tt is quite
different from its behaviour with respect to the complex period ttt.
Consequently, in view of the result of \hardsubsectionref{21}{4}{3}, we may expect to

%
% 475
%

obtain transformations of Theta-functions in which the period-ratios
of the two Theta-functions involved are respectively t and - l/r.

The transformations of the four Theta-functions were first obtained by
Jacobi*, who obtained them from the theory of elliptic functions; but
Poissonf had previously obtained a formida identical with one of the
transformations and the other three transformations can be obtained
from this one by ele- mentary algebra. A direct proof of the
transformations is due to Landsberg, who used the methods of contour
integration ij:. The investigation of Jacobi's formulae, which we
shall now give, is based on Liouville's theorem; the precise formula
which we shall establish is

where (- ir)' is to be interpreted by the convention arg(- iV) < '

For brevity, we shall write - 1 /t = r', q - exp ttW).

The only zeros of ' 3 z \ t) and ' 3 t z j t) are simple zeros at the
points at which

1 1 / /,,,1,1/

z = mir - UTTT + 2 '"' + o '""''' TZ = mir + tiTTT 4- vr 4- .3 ttt

respectively, where m, n, m, n take all integer values; taking m =- )i
- \, n = m, we see that the quotient

is an integral function with no zeros.

A 1 . / X . X (IZTTT + 7r-T-\ \ \ .,

Also z + ttt) ylf z) = exp ( -. j q e -' = 1,

while yjr (z - 'tt) - yjr ( z) = exp (; j x q~ e~-' '' = 1.

Consequently -v/r (z) is a doubly-periodic function with no zeros or
poles; and so \hardsubsectionref{20}{1}{2}) i/ ( ) must be a constant, A (independent of
2).

Thus 3 (z ! t) = exp (tW/7r) 3 ( r \ r');

and writing z + -tt, + ttt, -t- - tt -i- ttt in turn for z, we easily
get, (z : t) = exp irz-'/Tr) % (zr I r),

A% (z\ t)= exp (itZ /tt) % (ZT I t),

J.' i (z\ t)= - i exp Wz-j-n) % (zt \ t').

* Journal fur Math. in. (1828), pp. 403-404 [Ges. Werke, i. (1881),
pp. 264-265].

t Mem. dc VAcad. des Sci. vi. (1827), p. 592; the special case of the
formula in which z-0 had been given earlier by Poisson, Journal de
VEcole polyteclmique, xii. (cahier xix), (1823), p. 420.

+ This method is indicated in example 17 of Chapter vi, p. 124. See
Landsberg, Journal fiir Math. CXI. (1893), pp. 234-253.

%
% 476
%

We still have to prove that A = - it)-; to do so, differentiate the
last equation and then put 2 = 0; we get

 /(OJT) = -iVV(0 t'). But %' (0 t) =, (0 j t) 3 (0 i t) 4 (0 1 t)

and / (0 : t') =, (0 : r') 3 (0 \ r), (0 t');

on dividing these results and substituting, we at once get A~'- = - W,
and so

A = ± -iT) -. To determine the ambiguity in sign, we observe that 3(0
t)= 3(0|t'),

both the Theta-functions being analytic functions of t when 7 (t) >;
thus A is analytic and one-valued in the upper half r-plane. Since the
Theta-functions are both positive when t is a pure imaginary, the plus
sign must then be taken. Hence, by the theory of analytic
continuation, we always have

A = + - ir);

this gives the transformation stated. It has thus been shewn that

X 1 °

5" on-Trir+tniz \ 'V As -mr]- 1 1:17)

7j= -oe

Example 1. Shew that

when TT = -.

Example 2. Shew that

B, Q\ t) \ %AO\ t') 53(0|r) 53(0|r')

MOPr + 1) i 2iOJjr) 53(0 I r + 1) 54(0|r)'

Example 3. Shew that

and shew that the plus sign should be taken.

\Subsection{21}{5}{2}{Landen's type of transformation.}

A transformation of elliptic integrals (§ 227), which is of historical
interest, is due to Landen \hardsubsectionref{22}{4}{2}); this transformation follows at
once from a transformation connecting Theta-functions with parameters
t and 2t,

namely

X z\ t)X z I t) 3(0 It) 4(0 JT) 4(22|2t) 4(0|2t)

which we shall now prove.

The zeros of z r) i z\ r) are simple zeros at the points where

z = [m + -\ IT - \ n + -A TTT and where z = imr +in + -Airr, where m
and n

%
% 477
%

take all integral values; these are the points where 1z = mir + Ui Ar
- ir .'Ir, which are the zeros of 4 (2 j 2t). Hence the quotient

 4 (2 I 2t) has no zeros or poles. Moreover, associated with the
periods it and ttt, it has multipliers 1 and cf- e"-'' ) - q- e'' ) -
- q~~"' e- " ) = \ \ it is therefore a doubly-periodic function, and
is consequen-tly \hardsubsectionref{20}{1}{2}) a constant. The value of this constant may
be obtained by putting z - and we then have the result stated.

If we write \ \ +;- TTT for z we get a corresponding result for the
other

Theta-functions, namely

,( |t) i( |t) 3 (0 1 )>4 (OK)

 i(2 |2r) '"" 4(0i2T)

\Section{21}{6}{The differential equations satisfied by quotients of Theta-functions.}
From \hardsubsectionref{21}{1}{1} example 3, it is obvious that the
function

has periodicity factors - 1, + 1 associated with the periods tt, ttt
respectively; and consequently its derivative

[X z) 4 z) - %' ( ) 1 ( )l - V ( ) has the same periodicity factors.

But it is easy to verify that .(z),, z)/ J (z) has periodicity
f;xctors - 1, + 1; and consequently, if < (z) be defined as the
quotient

 X (z) % (z) - X ( ) 1 i )] - [% (z) % (z), then (f) (z) is
doubly-periodic with periods tt and ttt; and the only possible poles
of (f) (z) are simple poles at points congruent to tt and vr -h . ttt.

Now consider cf) iz + I ttt]; from the relations of \hardsubsectionref{21}{1}{1}, namely

% Z + l7rT =iq-h-''X z\ ',( z + l7rT'j = iq-ie-''%(z),

%\ z+l7rT =q-ie'''X(z), x z- l'rrT =q~ e-''% z), we easily see that

( ( -i- ttt) = - X (z) 1 (z) + X ( ) 4 ( )l - [% (z) % (z) . Hence (z)
is doubly-periodic with periods tt and - ttt; and, relative to

these periods, the only possible poles of z) are simple poles at
points 1 2

congruent to vr

%
% 478
%

Therefore ( 20-12), </)( ) is a constant; and making z- 0, we see that
the value of this constant is [ i' ' 4 - 1 2' a = Z-

We have therefore established the important result that

writing = * i ( )/ 4 2) and making use of the results of \hardsectionref{21}{2}, we
see that

(§)' = - ~ ' '' ' " ' '' '

This differential equation possesses the solution i( )/ 4(2). It is
not difficult to see that the general solution is ±% z + a)/%(z + a)
where a is the constant of integration; since this quotient changes
sign when a is increased by tt, the negative sign may be suppressed
without affecting the generality of the solution.

Example 1. Shew that

dz [Si z;j 2 S4 (2) 4 (z)

Example 2. Shew thcat

lPiii)l=\ q2 ii?) Mi)

\Subsection{21}{6}{1}{The genesis of the Jacohian Ellip.tic function* snu. }
The differential equation

(S)' '' " ' ' '' " ' '' ' which was obtained in \hardsectionref{21}{6}, may be brought
to a canonical form by a slight change of variable.

Writet %/% = y, V =;

then, if A:- be written in place of 2/ 3, the equation determining y
in terms of M is

(|y = a-/)(i-A.y).

This differential equation has the particular solution

The function of u on the right has multipliers -1,4-1 associated with
the periods 7r%", irT -,;-; it is therefore a doubly-periodic function
with periods 27r 3 ttt -. In any cell, it has two simple poles at the
points congruent to hirr a- and tt -J + iTTT j-; and, on account of
the nature of the quasi-periodicity of y, the residues at these points
are equal and opj3osite in sign; the zeros of the function are the
points congruent to and tt sI

* Jacobi and other early writers used the notation sin am in phice of
sn.

t Notice, from the formulae of \hardsectionref{21}{3}, that 2 + 0, 3 + when \ q\ < l,
except when q = 0, in which case the Theta-functions degenerate; the
substitutions are therefore legitimate.

%
% 479
%

It is customary to regard y as depending on k rather than on q; and
to exhibit y as a function of u and k, we write

2/ = sn u, k), or simply y = sn u.

It is now evident that sn (u, k) is an elliptic function of the second
of the types described in \hardsubsectionref{20}{1}{3}; when g- >0 (so that '- >0), it is
easy to see that sn(w, A")- >sin v.

The constant k is called the modulus; if '' = 4/ 3, so that k + k''
=l, k' is called the complementary modulus. The quasi-periods ir, ttt
. are usually written 2K, 2iK', so that sn (u, k) has periods 4iK, 2
K'.

From \hardsubsectionref{21}{5}{1}, we see that 2K' = 7r' . (0 \ r'), so that K' is the same
function of t as K is of t, when tt' = - 1.

Example 1. Shew that

dzS, z) -" S,(z) S, z)' and deduce that, if ?y = - " ~., and u = z\$
-, theu

 J - 4 ( )

Example 2. Shew that

rf2 3.

4(2) ''' S, z)3, z)'

d 3 ' (z) and deduce that, if j/ = -r 6"7 \ > ' u zS, then

 3 4 [z)

Example 3. Obtain the following results :

[These results are convenient for calculating /, k\ A", A'' when q is
given.]

\Subsection{21}{6}{2}{Jacohi's earlier notation*. The Theta-f unction ©(?<) and the Eta-fanction H ( ).}

The presence of the factors 3"- in the expression for sn u, k) renders
it sometimes desirable to use the notation which Jacobi employed in
the Fvndamenta Nova, and subsequently discarded. The function which is
of primary importance with this notation is © (u), defined by the
equation

Ch) (u) = 4 u%-' i t), so that the periods associated with © (u) are
2K and 2iK'.

* This is the notation employed throughout the Fundamenta Nova.

%
% 480
%

The function \& u + K) then replaces 3 (' ); and in place of i(-?) we
have the function H (u) defined by the equation

H ( ) = - iq - ie'"" " <-' ' e (u + i7v") = u%-'-, t), and . z) is
replaced by H (?/ + A").

The reader will have no difficulty in translating the analysis of this
chapter into Jacobi's earlier notation.

Example 1. If e' u)=-,, shew that the singularities of -t-t-t are
simple poles

at the points congruent to I'K' (mod 2A', -liK'); and the residue at
each singularity is 1.

Example 2. Shew that

H' (0) = W A'-i H ( A') e (0) e (A').

\Section{21}{7}{The problem of Inversion.}

Up to the present, the Jacobian elliptic function sn (i k) has been
implicitly regarded as depending on the parameter q rather than on the
modulus k; and it has been shewn that it satisfies the differential
equation

I - - - I = (1 - sn- u) (1 - k- sn- u),

where A: = V (0, ?)/ V (0, 5).

But, in those problems of Applied Mathematics in which elliptic
functions occur, we have to deal with the solution of the differential
equation

 I)-('- '> '-'y->

in which the modulus k is given, and we have no a priori knowledge of
the value of q\ and, to prove the existence of an analytic function
sn(M, k) which satisfies this equation, we have to shew that a number
t exists* such that

When this number t has been shewn to exist, the function sn(w, k) can
be constructed as a quotient of Theta-functions, satisfying the
differential equation and possessing the properties of being
doubly-periodic and analytic except at simple poles; and also

lim sn u, k)/i( = 1.

That is to say, we can invert the integral

\ [y dt

 ~Jo l-(') l-k'i ) ' so as to obtain the equation y= sn (u, k).

* The existence of a number r, for which / (t) > 0, involves t)ie
existence of a number q such that I g I < 1. An alternative procedure
would be to discuss tlie differential equation directly, after the
manner of Chapter x.

%
% 481
%

The difficulty, of course, arises in shewing that the equation

c=V(0|tW(0|t),

(where c has been written for L-). has a solution.

When* < c < 1, it is easy to shew that a solution exists. From the
identity given in \hardsectionref{21}{2} corollary, it is evident that it is sufficient
to prove the existence of a solution of the equation

1-c = V(0|t)/V(0!t),

CO / \ Q2n-1\ 8

which may be written 1 - c = 11 - ) .

Now, as q increases from to 1, the product on the right is continuous
and steadily decreases from 1 to; and so \hardsubsectionref{3}{6}{3}) it passes through
the value 1 - c once and only once. Consequently a solution of the
equation in T exists and the problem of inversion may be regarded as
solved.

21 "71. The problem of inversion for complex values of c. The modular
functions

f r),g T),h T).

The i roblem of inversion may be regarded as a problem of Integral
Calcuhis, and it may be j roved, by somewhat lengthy algebraical
investigations involving a discussion of

the behaviour of I (I -;!-) ~ 2 (1 - k fi) ~ 2 dt, when y lies on a
'Eiemann surface,' that the

J problem of inversion possesses a solution. For an exhaustive
discussion of this aspect of the problem, the reader is referred to
Hancock, Elliptic Functions, i. (New York, 1910).

It is, however, more in accordance with the sjjirit of this work to
prove by Cauchy's method (§ 6-.31) that the equation = 2* ( I ' V- s*
( 1 '') one root lying in a certain domain of the T-j)lane and that
(subject to certain limitations) this root is an analytic function of
c, when c is regarded as variable. It has been seen that the existence
of this root yields the solution of the inversion problem, so that the
existence of the Jacobian elliptic function with given modulus k will
have been demonstrated.

The method just indicated has the advantage of exhibiting the
potentialities of what are known as modular /mictions. The general
theory of these functions (which are of great importance in connexion
with the Theories of Transformation of Elliptic Functions) has been
considered in a treatise by Klein and Fricket.

:Mnir,s S./ 0\ t)

Let / (r) = We ir n \ -, - r \

IgV"" '" ' J 3 (0

" =53-'(0

.. \ g(2n-l) T 8 54*(0ir)

h r)=-f r)lg r). Then, if tt = - 1, the functions just introduced
possess the following properties : /(r + 2)=/(r), 5r(r + 2)=5r(r), f
r)+g r) = \,

f r + ) h (r), / (r') =g (r), g (r') =/(r),

by §§ 21 '2 corollary, 2r51 example 1.

* This is the case which is of practical importance.

t F. Klein, Vorlesungen uber die Theorie der clliptischen
Modnlfunktionen (ausgearbeitet und vervoUstandigt von E. Fricke).
(Leipzig, 1890.)

W. M. A. 31

%
% 482
%

It is easy|\ to see that as /(r)- - + QO, the functions iV<*~""/('")
= /i W and g (t) tend to unity, uniformly with resi)ect to R (r), when
- 1 (r) 1; and the derivates of these two functions (with regard to
r) tend uniformly to zero* in the same circumstances.

21 'Til. The principal solution off (t) - r = 0.

It has been seen in \hardsubsectionref{6}{3}{1} that, if /(t) is analytic inside and on any
contour, iiri times the number of roots of the equation /(t) - c =
inside the contour is equal to

/ 1 df r) Ifir c ir '

taken ]round the contour in question.

Take the contour ABCDEFE' D'C B' A shewn in the figure, it being
supposed temporarily! that /(t) - c has no zero actually on the
contour.

E' . F E

-1 1

The contour is constructed in the following manner :

FE is drawn parallel to the real axis, at a large distance from it.

AB la the inverse of FE with respect to the circle | t | = 1.

BC is the inverse of ED with respect to [ r | = 1, Z) being chosen so
that D\=AO.

By elementary geometry, it follows that, since C and D are inverse
points and 1 is its own inverse, the circle on D\ as diameter passes
through C; and so the arc CD of this circle is the reflexion of the
arc AB in the line R (r) = .

The left-hand half of the figure is the reflexion of the right-hand
half in the line R t) = 0.

* This follows from the expressions for the Tlieta-functions as power
series in q, it being observed that [ 9 [ - as I (t) - -|- oo .

t The values of/ T) at points on the contour are discussed in §
21'712.

%
% 483
%

It will now be shewn that, unless* c 1 or c O, the equation /(r) - c=0
has one, and only one, root inside the contour, provided that FE is
sufficiently distant from the real axis. This root will be called the
principal root of the equation.

To establish the existence of this root, consider / -rr\ - --y dr
taken along; the various portions of the contour.

Since/(r + 2)=/(r), we have,

I j BE J ED- ) f (t) -C dr

Also, as T describes BC and B'C", r'(= - l/r) describes E'D' and ED
respectively; and so

   BC j C-B'] f T)-C dr \ j BC Jc-B']g T)-C dr

 ] ED' J DE) g r)-C dr = 0, because g (r' + 2)= (r'), and
consequently corresponding elements of the integrals cancel. Since /
(r ± 1 ) = A (r), we have

[j D'C jCD]f r)-C dr jB:ABh T)-c dr

but, as T describes B'AB, r describes EE\ and so the integral round
the complete contoui* reduces to

/" f\ ] df r) 1 dh r') 1 dfiyiXdr

jEE'\ f -r)-c dr h(T') - c dr f 'r') - c dr ]

 i dfjr) 1 dh r) 1 dlMidr

]EE'\ f T)-C dr h r)\ \ -c.h r)] dr ' g r) - C dr j '

Now as EE' moves off to infinityt, /(t) - c-*- -c=t=0, (t)-c- -1 -
c4=0, and so the limit of the integral is

- lim f - - log h (r) dr

J EE' l-C.A(r) dr ° '

 X m \ 1 r . logACr) \ rflog (r) ]

.' EE C.h r)\ dr dr j '

But 1- c.A(t) 1, fi(r)~ \,g, r)- l, - 0, - 0, and so the limit of the

dr clr

integral is

I nidr = 2-i

J E'E

Now, if we choose EE' to be initially so far from the real axis that /
(r) - c, - c.h (r), g r) - e have no zeros when r is above EE', then
the contour will pass over no zeros of /(r) - c as EE' moves off to
infinity and the radii of the arcs CD, D'C, B'AB diminish to zero;
and then the integral will not change as the contour is modified, and
so the original contour integral will be Sttz, and the number of zeros
oif r) - c inside the original contour will be precisely one.

* It is shewn in \hardsubsectionref{21}{7}{1}'2 that, if c l or c O, then/(T) -c has a zero
on the contour. t It has been supposed temporarily that c=|=0 and 4=1.

31-2

%
% 484
%

21 '712. The values of the modular function f(t) on the contoitr
considered.

We now have to discuss the point mentioned at the beginning of 5
21-711, concerning the zeros of f(r) - c on the lines* joining +1 to
±l + x t and on the semicircles of 05C1, - ) C'B'0.

As T goes from 1 to 1 + x t or from - 1 to - 1 + x i, /(t) goes from -
x to through real negative values. So, if c is negative, we make an
indentation in DE and a corre- sponding indentation in D' E'; and the
integrals along the indentations cancel in virtue of the relation /(t
+ 2) +/(r).

As r describes the semicircle 0 C1,t' goes from - 1 + x I'to - 1,
and/(r) = 5r(T') = l - /(r), and goes from 1 to +x through real values
; it would be possible to make indentations in BC and B'C to avoid
this difficulty, but we do not do so for the following reason : the
ettect of changing the sign of the imaginary part of the number ' is
to change the sign of the real part of r. Now, if < 7 (c) < 1 and I
(c) be small, this merely make-s t cross OF by a short i>ath; if R
(c) < 0, t goes from DE to D' E' (or vice versa) and the value of q
alters only slightly; but if R c) > 1, r goes from BC to B'C, and so
q is not a one-valued function of c so far as circuits round c = +1
are concerned; to make q a one-valued function of c, we cut the
c-plane from -l-l to -fx; and then for values of c in the cut plane,
q is determined as a one-valued analytic function of c, say q (c), by
the formula q (c) = e' '"' '''

where

., 1 / r df r), 2771 j/(r)-C dr

as may be seen from \hardsectionref{6}{3}, by using the method of \hardsubsectionref{5}{2}{2}.

If c describes a circuit not siu-rounding the point c=l, q c) is
one-valued, but t c) is one-valued only if, in addition, the circuit
does not surround the point c = 0.

21 '72. The periods, regarded as functions of the modidus.

Since K=\ 7rB: (0, q) we see from 5 21-712 that K is a one-valued
analytic function of c =k ) when a cut from 1 to -l-x is made in the
c-plane; but since K'= -irK, we see that K' is not a one-valued
function of c unless an additional cut is made from to - x; it will
appear later \hardsubsectionref{22}{3}{2}) that the cut fi'om 1 to -fx which was necessary
so far as K is concerned is not necessary c\ s regards K'.

2173. The inversion-problem associated iv it h Weierstrassiari
elliptic functions.

It will now be shewn that, when invariants g. and g are given, such
that g %lg, it is possible to construct the Weierstrassian elliptic
function with these invariants; that is to say, we shall shew that it
is possible to construct \ periods 2(i)i, 2u>.2 such that the function
fp z ( oi, do) has invariants g and g .

The problem is solved if we can obtain a solution of the differential
equation

m

   if -9- -93

of the form = (2 i wi, <t>2)-

"We proceed to effect the solution of the equation with the aid of
Theta-functions. Let v = Az, where .4 is a constant to be determined
presently.

* We have seen that EE ' can be so chosen that f (t) -c lias uo zeros
either on EE ' or on the small circular arcs.

t On the actual calculation of the periods, see E. T. A. Innes, Proc.
Edinburgh Royal Sue. XXVII. (1907), pp. 357-368.

%
% 485
%

By the methods of § 21 -e, it is easily seeu that

and hence, using the results of § 21 "2, we have

Now let ei, e., e be the roots of the equation ' y' -g-iy-gz = j
chosen in such an order that ( 1 - e'2)l ei - 63) is not* a real
number greater than unity or negative.

In these circumstances the equation

61-63 3'(U|r)

possesses a solution (§ 21 "712) such that /(r)>0; this eqvxation
determines the parameter T of the Theta-functions, which has, up till
now, been at our disposal.

Choosing t in this manner, let A be next chosen so thatt

Then the function satisfies the equation

.V = ' |! j 53MO I r) V (0 I r) + ei ( ) = 4 (y - ei) y - 62) y - 63).

The periods of y, qua function of z, are ttJ, tttJA; calling these
2(bi, 2W2 we have

/(co2/<ai)>0. The function z | wi, oa. may be constructed with these
periods, and it is easily

seen that (3)- %\ f-f-J,2(0 | t) V(0 | r)-ei is an elliptic function
with no pole at the origin |; it is therefore a constant, C, say.

If 6*2, 6*3 be the invariants of (2 | wi, a>., we have

Aip ( z)-G. z)-G, = f(z) = ip z)-C-e,] z)-C-e. l iJ z)-C-e,, and so,
comparing coefiicients of powers of < (z), we have

= 12C, G2=g-2-l2C% G3=g3-g,C+iC Hence (7=0, G.2=g2, Gz g;

and so the function z \ co, wo) with the required invariants has been
constructed.

\Section{21}{8}{The numerical Computation of elliptic functions.}

The series proceeding in ascending powers of q are convenient for
calculating Theta-functions generally, even when | | is as large as
0"9. But it usually happens in practice that the modulus k is given
and the calculation

* If \ iZ: >i thenO< <:l; andif <0, then 1- >1, and

ei-e ei-i'j e -e Ci-e

 j -ej ri\ lZ 1" <l.

The values 0, 1, qo of (ej - <'2)/( i - 3) a-i'e excluded since (12 4=
27(/3 .

t The sign attached to is a matter of indifference, since we deal
exclusively with even functions of v and -.

t The terms in z'" cancel, and there is no term in z~i because the
function is even.

%
% 486
%

of K, K' and q is necessary. It v ll be seen later (§§ 22'801, 22'32)
that K, K' are expressible in terms of hypergeometric functions, by
the equations

but these series converge slowly except when | k \ and j k' \
respectively are quite small; so that the series are never
simultaneously suitable for numerical calculations.

To obtain more convenient series for numerical work, we first
calculate q as a root of the equation k = o" (0, q)l 'i' (0, q), and
then obtain K from the

formula K= r ir' i (0, q) and K' from the formula

K'=7r- K\ og, l!q).

The equation k = V (0, ?)/ V (0, q)

is equivalent to* Jk' = 4 (0, 5)/ 3 (0, q).

-i 111 Writing 2e = -j,, (so that < e <;j when 0<k< 1), we get

\ %i O,q)-' AO, q) %(0,q') ' % 0,q) + % 0,q) % 0,q )-

We have seen (§§ 21*71-21-712) that this equation in g possesses a

solution which is an analytic function of e* when I e < -; and so q
will be

expansible in a Maclaurin series in powers of e in this domainf.

It remains to determine the coefficients in this expansion from the
equation

g + (/ + r + ... ~ 1 + 2 * + 25" + . . . ' which may be written

q=6 + 2qU-q''+2q' €-q-'+ ...;

the reader will easily verify by continually substituting e + 2q*e - q
+ ... for q w herever q occurs on the right that the first two termsj
are given by

q = e + 2e' + 15e + loOe' + U'').

It has just been seen that this series converges when j e, < .

[Note. The first two terms of this expansion usually suffice; thus,
even if k be as large as (0-8704) = 0-933..., e = |, 2€- = 0-0000609,
15f = 0-0000002.]

Example. Given k = k' = \ IJ2, calculate q, K, A" by means of the
expansion just obtained, and also by observing that t=i, so that q =
e~ .

[y = 0-04.32 139, = A" = 1-854075.]

* In numerical work < A; < 1, and so q is positive and < k' < 1.

t The Theta-functions do not vanish when |5|<1 except at ' = 0, so
this gives the only possible branch point.

X This expansion was given by Weierstrass, Werke, ii. (1895), p. '276.

%
% 487
%

21 'Q. The notations employed for the Theta-f unctions.

The following scheme indicates the principal systems of notation which
have been employed by various writers; the symbols in any one column
all denote the same function.

 i(tj)

9,(nz)

9s (nz)

S (nz)

Jacobi

 l( )

 2(2)

h )

Si z)

Tannery and Molk

(9i (0)2)

62 (os)

03 (CZ)

6 m)

Briot and Bouquet

e, z)

02 )

e iz)

 0(2)

Weierstrass, Halphen, Hancock

6 z)

6i z)

Osiz)

BoM

Jordan, Harkness and Morley

The notation employed by Hermite, H. J. S. Smith and some other
mathematicians is expressed by the equation

v=0, 1)

6,, x)= 2 ( - T" q '+i )- e'"" " > '; (/x = 0, 1 tt = -

with this notation the results of \hardsubsectionref{21}{1}{1} example 3 take the very
concise form e,,(a;+a) = -y 6,, (.r),,, (. + ar) = (-)"?- e" '
*"* ' 6,, (.r).

Cayley employs Jacobi's earlier notation (§ 21 62). The advantage of
the Weierstrassian notation is that unity (instead of tt) is the real
period of 63 z) and 0 (2).

Jordan's notation exhibits the analogy between the Theta-functions and
the three Sigraa-functions defined in \hardsubsubsectionref{20}{4}{2}{1}. The reader will easily
obtain relations, similar to that of § 21 43, connecting 6 ( ) with
0-,. iwxz) when r= 1, 2, 3.

REFERENCES. L. EuLER, Opera Omnia, (1), xx. (Leipzig, 1912). C G. J.
Jacobi, Fundamenta Nova* (Konigsberg, 1829); Ges. Math. Werke, i.

pp. 497-538. C. Hermite, Oeuvres Mathematiqiies. (Paris, 1905-1917.)
F. Klein, Vorlesungen iiher die Theorie der elliptischen
Modulfunktionen (Ausgear-

beitet und vervoUstandigt von R. Fricke). (Leipzig, 1890.) H. Weber,
EUiptische Funktionen und algebraische Zahlen. (Brunswick, 1891.) J.
Tannery et J. Molk, Fonctions Elliptiques. (Paris, 1893-1902.)

Miscellaneous Examples.

1. Obtain the addition-formulae

9, y+z)9, y-z)9, =hHy)9o z)-9. 2/)h z) = S, y)9 z)-9 y)9, z\

 2 (y + 2) 2 y - ) V = 9 iy) s,' (z) - s,- (y) V (2) = S-2' (.y) 4 (2)
- 3 (y) 1' (2),

 3 (y + ) 3 (y - 2) V = 4 (y ) 3 (2) - 5 2 (y) V (,) 532 (3/) 5 2 (,)
\ 2 (3,) 2 (,)

 4 (y + -') 4 iy - z) 9C = 3 (i/) 3 z) - 5/ (y ) 2 z) = V [y) 9i' (z)
- 9, (y) 5i2 (3).

\addexamplecitation{Jacobi.} * Reprinted in his Ges. Math. Werke, i. (1881), pp. 49-239.

%
% 488
%

2. Obtain the addition-formulae

94(y+2)54Cy- )V=V(y) 2M2)+V(y)V(2)=V(3/)V(2)+V(y) 3'( ).

and, by increasing / by half periods, obtain the corresponding
formulae for

5r (i/ + z) Sr Ly - --) 2 and Br y- -z)Br 2f-z) V. where r=l, 2, 3.
\addexamplecitation{Jacobi.}

3. Obtain the formulae

5l 0/ ± --) 2 (y + ) h -94 = -9, Q/) \$2 (i/) 3 (2) 4 (2) ± 3 (y) 4 C
) 1 C ) 2 z), Sl(]/±z)Ss(l/ + z) 2 4 =  ! Cy) 3 (y) 2 (2) 4 C ) ± 2 i
) 4 (y) 1 (z) 3 i l h l/±z) -34 (y + ') 5.2-93 = 5, Cy) 4 (y) 2 (2) 3
C ) ± o (y) 3 (y) Si z) Si (z),

So i/±z)SsQ/ + z) 3. S = So (y) S3 (v/) S., (2) 3 (z) + S y) S 1/) S
(z) 3 (z), S, y±z) Si i/ + z) S.,Si=S, (j/) Si (y) 2 z) Si z) + Si
(j/) 3 (y) 1 (2) 3 (2), S3 i/±z)S, y + z)SsSi = S, y)Si 9/)S3 z)Siiz)
+ S,iy)S. i/)S, z)S2 z).

\addexamplecitation{Jacobi.}

4. Obtain the duplication-fomiulae

5, 2y) S,Si = 5,2 (y) V (3/) - 3i2 (3,) S 2 (\ y)

53 (2y) 53 V = 3 (y) 54 0/) - - i' (y) -92' (. ), Si 2y) Si' = S3*
(1/) - S,* (y ) = Si* y)- S,* (y).

Obtain the dupHcation-formula

S, (2y) 52 3 4 = 2 1 (y) -9, (y) 3 (y) 4 (y).

Obtain dupUcation-fomuilae from the results indicated in example 2.

Shew that, with the notation of § 21 '22,

[l]-[2] = [4]'-[3]', [l]-[3] = [l]'-[3]', [l]-[4] = [2]'-[3]', [2]-[3]
= [l]'-[4]', [2]-[4] = [2]-[4]', [3]-[4] = [2]'-[l]'.

Shew that

2 [11 22] = [11 22]' + [2211]' -[4433]' + [3344]',

2[1133] = [1133]' + [3311]'-[4422]' + [2244]', 2[1144] =
[1144]'+[4411]'-[3322]' + [2233]', 2 [2233] = [2233]' + [3322]' - [441
1]' + [1 1 44]', 2[2244] = [2244]' + [4422]'-[3311]' + [1133]', 2
[3344] = [3344]' + [4433]' - [221 1 ]' + [1 1 22]'.

Obtain the formulae

2n- fa =-2qi U (1 -?2")2 (1 -y2n-l)-2| .

\addexamplecitation{Jacobi.} \addexamplecitation{Jacobi.}

\addexamplecitation{Jacobi.}

k k'

i = 2fyi n (l+?2H)2(l-f/ -i)-

10. Deduce the following i-esults from example 9 : n (1 - j2n- 1)6 = 2
i > '/(->,

n l-f' f =27v-'q- M'K\

n (l+?2 -i) =22 (M')-i, 1=1

n (i+92 ) =lq -kk'-,

n (i-j )

n=l

= An- q- k k'-'K\

n (1+9"

n = l

Iq- k k'-K

\addexamplecitation{Jacobi.}

%
% 489
%

11. By considering I .* /* e "" dz taken along the contour formed by
the parallelogram

J °i (2)

whose corners are - tt, Itt, Tr + Trr, - tt + ttt, shew that and
deduce that, when | I z) \ < I ttt),

12. Obtain the following expansions :

S3' z)\ * ( - )' sin 2 3

each expansion being valid in the strip of the s-plane in which the
series involved is

absolutely convergent.

\addexamplecitation{Jacobi.}

13. Shew that, if \ I y)\ < l (ttt-) and 1 / (2) | < 7 (ttt), then

  ± = cot y + cot 2 + 4 i 2 q'"' sin 2my + 2nz). 1 (y) 1 (2) m=l =i

\addexamplecitation{Math. Trip. 1908.}

14. Shew that, if | /(s) j < \ I (ttt), then

TT,(S)"2'

where a = 2 2 j(' + )(2' +' + ).

\addexamplecitation{Math. Trip. 1903.}

[Obtain a reduction formula for by considering Si(z) -U-'' 'dz taken
round the contour of example 11.]

15. Shew that

cos 22 + g*" J

 --rT=i o+ 2 a cos2?i2,

 1(2) L =il-2j2ncos:

is a doublv-periodic function of z with no singularities, and deduce
that it is zero.

Prove similarly that

 2( )\ . A% g-" sin 22

.92 (z) !=i 1 + 2? " cos 22 + 2 "

 3 (2) " ~ lil + 2g''' -icos22 + j4 -2'

 4'.(g) . I g2n-l sii, 2g

  4(2) =i l-2g ''-icos22 + \$ "-2' 16. Obtain the values of k, k', K,
K' correct to six places of decimals when q= . [/ .= 0-895769, F =
0-444518, =2-262700, Zr' = 1-658414.]

%
% 490
%

17. Shew that, if w+x + i/ + 2=0, then, with the notation of \hardsubsectionref{21}{2}{2},

[3] + [l] = [2] + [4], [1234] + [3412] + [2143] + [4321] =0.

18. Shew that

 4(y) 4(2) hilZ + z) ' ' i(y)Si )h(2/ + y

19. By putting x=y = z, w=3a; in Jacobi's fundamental formulae, obtain
the following

results :

Si3 ( ) j (3 .) . 3 ( .) (ar) = 3 (2.1,.) 5,

 33 x) S3 (ar) - 3i (x) \$i (ar) = B 2x) 5-2, So3 (.f) 3. (Sx) + 3 3 (
) 5 (3.1;) = 33 (2 ) 3 .

20. Deduce from example 19 that

 Si (x) Si 3x) Si + Si x) Si Sx) Si + Ss (x) S3 3x) S - V ( ) 4 (3 ) 2

= 52=* ('*-) 2 (3.f) S3- + 4 (x) Si 3x) .932  \addexamplecitation{Trinity, 1882.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CS630: Database Management Systems
% Copyright 2014 Pejman Ghorbanzade <pejman@ghorbanzade.com>
% Creative Commons Attribution-ShareAlike 4.0 International License
% More info: https://github.com/ghorbanzade/beacon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section*{Question 2}

Consider a database schema with three relations:\\

\begin{terminal}
Movies (@*\underline{movie\_id}*@:integer, title:string, year:integer, studio:string)
Actors (@*\underline{actor\_id}*@:integer, name:string, nationality:string)
StarsIn(@*\underline{actor\_id}*@:integer, @*\underline{movie\_id}*@:integer, character:string)
\end{terminal}

The keys are underlined in each relation.
Relation \texttt{Movies} stores information such as unique movie identifier, title, year and  producing studio.
\texttt{Actors} contains unique actor identifier, actor name and nationality.
Relation \texttt{StarsIn} tracks which actor starred in which movie, and the name of the character interpreted in that movie.
Assume that one actor plays at most one character in the same movie.

Write relational algebra expressions for the following queries:

\begin{enumerate}
\item Find the titles of movies produced by \textit{Universal} studio.

\textbf{Solution:}
$$\displaystyle \pi_{title}(\sigma_{studio="Universal"}Movies) $$

\item Find the names of actors that played a character named \textit{Forrest Gump} in some movie.

\textbf{Solution:}
$$\displaystyle \pi_{name}(\pi_{actor\_id}(\sigma_{character="Forest\ Gump"}StarsIn)\Join Actors)$$

\item Find the names of actors of nationality \textit{German}.

\textbf{Solution:}
$$\displaystyle \pi_{name}(\sigma_{nationality="German"}Actors)$$

\item Find the nationality of actors who played a character named \textit{Forrest Gump} or who starred in a movie in year 1980.

\textbf{Solution:}
\begin{enumerate}
\item A1 includes IDs of actors who played a character named \textit{Forest Gump}.
$$ \rho(A1,\pi_{actor\_id}(\sigma_{character="Forest\ Gump"}StarsIn))$$
\item A2 includes IDs of actors who starred in a movie in year 1980.
$$ \rho(A2,\pi_{actor\_id}(\pi_{movie\_id}(\sigma_{year=1980}Movies)\Join StarsIn))$$
\item Desired list includes nationality of actors whose ID is either in A1 or A2.
$$ \pi_{nationality}((A1\cup A2)\Join Actors)$$
\end{enumerate}

\item Find the names of actors that star in exactly one movie.

\textbf{Solution:}
\begin{enumerate}
\item A1 includes IDs of actors never starred in any movie.
$$ \rho(A1,\pi_{actor\_id}Actors-\pi_{actor\_id}StarsIn) $$
\item A2 includes IDs of actors starred in more than one movie.
$$ \rho(S1(1\rightarrow actor\_id1,2\rightarrow movie\_id1,3\rightarrow character1),StarsIn) $$
$$ \rho(S2(1\rightarrow actor\_id2,2\rightarrow movie\_id2,3\rightarrow character2),StarsIn) $$
$$ \rho(A2(1\rightarrow actor\_id),\pi_{actor\_id1} (S1 \Join_{(actor\_id1=actor\_id2) \wedge (movie\_id1\neq movie\_id2)} S2)) $$
\item Desired list includes names of actors who are neither in A1 nor in A2.
$$ \pi_{name}((\pi_{actor\_id}Actors - A1 - A2) \Join Actors)  $$
\end{enumerate}

\item Find the names of actors who starred in some movie in or after year 1980, but who did not star in any role (ever) for a movie produced by \textit{Universal} studio.

\textbf{Solution:}
\begin{enumerate}
\item A1 includes IDs of actors who starred in some movie in or after year 1980.
$$ \rho(A1,\pi_{actor\_id}(\pi_{movie\_id}(\sigma_{year>1979}Movies) \Join StarsIn)) $$
\item A2 includes IDs of actors who starred in some role for a movie produced by \textit{Universal} studio.
$$ \rho(A2,\pi_{actor\_id}(\pi_{movie\_id}(\sigma_{studio="Universal"}Movies) \Join StarsIn)) $$
\item Desired list includes names of actors whose ID is in A1 and not in A2.
$$ \pi_{name}((A1-A2)\Join Actors) $$
\end{enumerate}

\end{enumerate}


\documentclass[12pt]{article}

\usepackage{wrapfig}
\usepackage{float}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{comment}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{hyperref}
% \usepackage[vlined,linesnumbered,ruled,resetcount]{algorithm2e}

\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\val}{val}
\DeclareMathOperator*{\MOSM}{MOSM}
\DeclareMathOperator*{\WOSM}{WOSM}
\DeclareMathOperator*{\best}{best}
\DeclareMathOperator*{\worst}{worst}

\usepackage{algorithm}
% \usepackage{algorithmicx}
\usepackage[noend]{algpseudocode}

\newcommand{\R}{\mathbb{R}}
\newcommand{\Rgz}{\mathbb{R}_{\ge 0}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}

\newcommand{\Es}[2]{\mathbb{E}_{#1}\left[{#2}\right]}
\newcommand{\E}[1]{\mathbb{E}\left[{#1}\right]}
\newcommand{\ip}[2]{\left\langle{#1} , {#2}\right\rangle}

\newcommand{\M}{\mathcal{M}}
\newcommand{\W}{\mathcal{W}}

\newtheorem{definition}{Definition}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{claim}[definition]{Claim}
\newtheorem{proposition}[definition]{Proposition}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@article{ThurberConcerningMaxStab02,
  author = {Thurber, Edward G.},
  title = {Concerning the maximum number of stable matchings in the stable
    marriage problem},
  journal = {Discrete Mathematics},
  year = {2002},
  volume = { 248 },
  pages = {195-219},
}
@article{IrvingCountingStab86,
  author    = {Robert W. Irving and
               Paul Leather},
  title     = {The Complexity of Counting Stable Marriages},
  journal   = {{SIAM} J. Comput.},
  volume    = {15},
  number    = {3},
  pages     = {655--667},
  year      = {1986},
  url       = {https://doi.org/10.1137/0215048},
  doi       = {10.1137/0215048},
  timestamp = {Sat, 27 May 2017 14:22:59 +0200},
  biburl    = {https://dblp.org/rec/bib/journals/siamcomp/IrvingL86},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
@article{PittelAverageStable89,
  author = {Pittel, B.},
  title = {The Average Number of Stable Matchings},
  journal = {SIAM J. Discret. Math.},
  issue_date = {Nov. 1989},
  volume = {2},
  number = {4},
  month = nov,
  year = {1989},
  issn = {0895-4801},
  pages = {530--549},
  numpages = {20},
  url = {http://dx.doi.org/10.1137/0402048},
  doi = {10.1137/0402048},
  acmid = {75544},
  publisher = {Society for Industrial and Applied Mathematics},
  address = {Philadelphia, PA, USA},
}
@misc {ShorAsymptoticStab19,
  TITLE = {The asymptotic behavior of a recurrence related to stable matchings},
  AUTHOR = {Peter Shor },
  HOWPUBLISHED = {Theoretical Computer Science Stack Exchange},
  NOTE = {URL: \url{https://cstheory.stackexchange.com/q/44371} (version: 2019-08-08)},
  EPRINT = {https://cstheory.stackexchange.com/q/44371},
  URL = {https://cstheory.stackexchange.com/q/44371}
}
\end{filecontents*}

\begin{document}

% \renewcommand{\qedsymbol}{\filledbox}

\title{
  A recurrence giving a lower bound for stable matchings
}
\author{Clay Thomas\\
claytont@princeton.edu}
\maketitle

It's an interesting open question to find good upper and lower bounds on the
maximum number of distinct stable matches that an $n\times n$ instance of the
stable marriages problem can have.
The best known lower bound (for $n$ a power of $2$) was originally constructed
in \cite{IrvingCountingStab86},
and a recurrence relation for the lower bound was found.
Specifically, define
  \[ b_0 = 1, \qquad b_1 = 2 \]
  \[ b_n = 3 b_{n-1}^2 - 2 b_{n-2}^4, \qquad n > 1 \]
Then $b_n$ gives a lower bound on the maximum number of stable matches in
a $2^n \times 2^n$ instance.
For a justification of this recurrence, see \cite{ThurberConcerningMaxStab02},
appendix A.
Knuth analyzed $b_n$ and found it was $\Omega(2.28^{2^n})$
(mentioned, e.g. in \cite{PittelAverageStable89}).
However, the details of this analysis were, to the best of our knowledge,
never published.
In this note, we establish the growth behavior of the sequence,
following the proof given by Peter Shor \cite{ShorAsymptoticStab19}.

\begin{proposition}
  There exist constants $s, r$ such that $b_n \sim r s^{2^n}$,
  i.e. $b_n = rs^{2^n}(1 + o(1))$.
  Moreover, $s\approx 2.280142$ and $r = \frac 1 2 (\sqrt 3 - 1)
  \approx 0.366025$
\end{proposition}

First, note that this is plausible because, if $c_n = 3 c_{n-1}^2$ (i.e. if we
eliminated the lower order terms of the recurrence)
we would have $c_n = (1/3) s^{2^n}$ where $s=3c_0$.
Now, if we had $b_n = r s^{2^n}$ exactly, we could recover $r$ and $s$ as
follows: $r = b_{n-1}^2 / b_n$ and
$s = \left(\frac{b_n}{r}\right)^{1/2^n}$ for any value of $n$.
In fact, we'll show that the above quantities \emph{quickly converge} to some
values $r$ and $s$ which produce the desired result.

\begin{proof}
First we handle $r$. Define
\[ r_n = \frac{b_{n-1}^2}{b_n} \]

\begin{claim}
  $r_n \to r$ as $n\to \infty$ for some value $r$.
  Moreover, $r_n$ monotonically decreases to $r$.
\end{claim}
\begin{proof}
  Because $r_n \ge 0$, it suffices to show that $r_n$ is decreasing.
  We have
  \[ r_n = \frac{b_{n-1}^2}{b_n}
  = \frac{b_{n-1}^2}{3b_{n-1}^2 - 2b_{n-2}^4}
  = \frac{1}{3 - 2(b_{n-2}^2/b_{n-1})^2}
  = \frac{1}{ 3 - 2r_{n-1}^2} \]
  Now, $r_1 = 1/2$, and we can easily see from a graph that the function
  $f(x) = 1/(3-2x^2)$ that $f(x) \le x$ for $r < x < 1$, where
  $r \approx 0.366$. (In particular, $r = (\sqrt 3 - 1)/2$ is the smaller
  positive root of $x(3-2x^2)=1$).
  Moreover, for $r < x < 1$ we have $f(x) > r$ as well.
  Thus, $r_n < r_{n-1}$ for all $n > 0$.

\end{proof}

\includegraphics{RatioConvergencePlot}

Note that certainly $r > 0$.
Now we can turn to $s$. Define
\[ s_n = \left(\frac{b_n}{r}\right)^{1/2^n} \]

\begin{claim}
  $s_n \to s$ as $n\to \infty$ for some value $s$.
  Moreover, $s_n$ monotonically decreases to $s$.
\end{claim}
\begin{proof}
  Because $s_n \ge 0$, it suffices to show that
  $s_n$ is decreasing.
  We have
  \[ \frac{s_{n}}{s_{n-1}}
    = \left(\frac{b_n}{r}\right)^{1/2^n} \left(\frac{r}{b_{n-1}}\right)^{2/2^n}
    = \left(\frac{rb_n}{b_{n-1}^2}\right)^{1/2^n}
    = \left(\frac{r}{r_n}\right)^{1/2^n} < 1
  \]
  where the inequality follows because $r_n > r$.
  Thus $s_n < s_{n-1}$, as desired.
\end{proof}

So far, we have $b_n = r s_n^{2^n} \ge r s^{2^n}$.
All that remains is to show that, in fact,
$b_n \le rs^{2^n}(1 + o(1))$ as well.

\begin{claim}
  $s^{2^n} / s_n^{2^n} \to 1$ as $n\to \infty$
\end{claim}
\begin{proof}
  As $s_n \ge s$, we know $(s/s_n)^{2^n} \le 1$.
  We have
  \[ \left(\frac{s}{s_n}\right)^{2^n}
  = \left(\prod_{k=n}^\infty \frac{s_{k+1}}{s_k}\right)^{2^n}
  = \prod_{k=n}^\infty \left(\frac{r}{r_{k+1}}\right)^{\frac{1}{2^{k+1}}\cdot 2^n}
  \]
  \[ \ge \prod_{k=n}^\infty \left(\frac{r}{r_{n+1}}\right)^{\frac{1}{2^{k+1}}\cdot 2^n}
  = \left(\frac{r}{r_{n+1}}\right)^{ 2^n\cdot\sum_{k=n}^\infty \frac{1}{2^{k+1}}\cdot}
  = \frac{r}{r_{n+1}}
  \]
  The inequality follows from the fact that $r_n$ is decreasing.
  The right hand side approaches $1$ by the definition of $r$.
\end{proof}

Thus, we can conclude that
\[ \frac{b_n}{rs^{2^n}} = \frac{s_n^{2^n}}{s^{2^n}} \to 1 \]
as $n\to \infty$, as desired.
\end{proof}

\paragraph{Remark:}
We saw that $r = (\sqrt 3 - 1)/2$ can be calculated exactly.
Combining a few facts above we can also get highly accurate estimates for $s$.
Specifically, in claims 2, 3, and 4 respectively we showed
\[ r_n = \frac 1 {3 - 2r_{n-1}^2} \]
\[ s_n = s_{n-1} \left(\frac r {r_n}\right)^{1/2^n} \]
\[ s_n \ge s \ge s_n \left(\frac r {r_n}\right)^{1/2^n} \]
The first two lines give us fast ways to compute the estimates of $s_n$, and
the last line shows that this estimate converges extremely quickly
(indeed, all we need to do is observe that $r/r_n$ is bounded by a constant $c$
and that $c^{1/2^n} = 1 - O(1/2^n)$ to get exponential convergence).

\bibliography{\jobname}{}
\bibliographystyle{alpha}

\end{document}


\documentclass[12 pt,a4paper]{report}
\setlength{\topmargin}{-2cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\textheight}{24cm}
\setlength{\textwidth}{16cm}

\usepackage{graphicx}

%Use sffamily for all titles

\begin{document}

\title{\sffamily\huge\textbf{Report on Sorting Algorithms}}
\author{Kavi Zahan Sultana}
\date{01/12/2014}
\maketitle

\newpage

\tableofcontents

\newpage

\section{Introduction}

This report provides the introduction, algorithm,running time and graphs of sorting algorithms.

\section{Insertion Sort}

Insertion sort is an efficient algorithm for sorting a small number of elements. We present the pseudocode called INSERTION-SORT.
It takes as a parameter an array /textit{A[1..n]}  containing a sequence of length \textit{n} that is to be sorted.

\subsection{Algorithm}

$INSERTION-SORT(A)$

1   \textbf{for}  $j=2   \textbf{   to  }   A.length$

2    \hspace{1cm}$ key=A[j] $

3     \hspace{1cm}$i=j-1$

4     \hspace{1cm}$\textbf{while  }i>0\hspace{0.3cm}and \hspace{0.3cm} A[i]>key$

5     \hspace{1.5cm}$A[i+1]=A[i]$

6     \hspace{1.5cm}$i=i-1$

7     \hspace{1cm}$A[i+1]=key$

\subsection{ Time Complexity  of  Insertion  Sort}

$INSERTION-SORT(A)  \hspace{3cm}cost \hspace{1cm}times$
\vspace{0.4cm}

1\hspace{0.75cm}$\textbf{for}\hspace{0.3cm}j=2 \textbf{ to } A.length\hspace{2.5cm}c_1\hspace{1cm} n  $

2\hspace{1.5cm}$key=A[j]\hspace{3.94cm}c_2\hspace{1cm}n-1$

3\hspace{1.5cm}$i=j-1\hspace{4.2cm}c_3\hspace{1cm}n-1$

4\hspace{1.5cm}$\textbf{while }i>0 and A[i]>key\hspace{1.1cm}c_4\hspace{1cm}\sum_{j=2}^nt_j$

5\hspace{2cm}$A[i+1]=A[i]\hspace{2.7cm}c_5\hspace{1cm}\sum_{j=2}^n(t_j-1)$

6\hspace{2cm}$i=i-1\hspace{3.8cm}c_6\hspace{1cm}\sum_{j=2}^n(t_j-1)$

7\hspace{1.5cm}$A[i+1]=key\hspace{3.3cm}c_7\hspace{1cm}n-1$

\vspace{1.5cm}

The running time of the algorithm is the sum of running times for each statement executed.To compute $T(n)$, the  running time of $INSERTION-SORT$ on an input of \textit{n} values, we sum the products of the \textit{cost} and \textit{times} columns,obtaining\\

$T(n)=c_1n+c_2(n-1)+c_3(n-1)+c_4\sum_{j=2}^nt_j + c_5\sum_{j=2}^n(t_j-1)+ c_6\sum_{j=2}^n(t_j-1) + c_7(n-1)$\\

\textbf{1.Best case:}

In $INSERTION-SORT$, the best case occurs if the array is already sorted. For each$ j=2,3,...,n$, we then find that $A[i]<=key$ in line 5 when \textit{i} has its initial value of $j-1$. Thus $t_j=1$ for $ j=2,3,...,n$, and the best-case running time is\\

$T(n)=c_1n+c_2(n-1)+c_3(n-1)+c_4(n-1) + c_7(n-1)$\\

\hspace{1cm}$=(c_1+c_2+c_3+c_4+c_7)n-(c_2+c_3+c_4+c_7).$\\

\hspace{1cm}$=an+b$\\

where, $a=(c_1+c_2+c_3+c_4+c_7)$ and $b=-(c_2+c_3+c_4+c_7)$, which depend on the statement costs $c_i$; it is thus a \textbf{\textit{linear function}} of \textit{n}.\\

\newpage

\textbf{2.Worst case:}

If the array is in reverse sorted order-that is, in decreasing order- the worst case results.We must compare each element $A[j]$ with each element in the entire sorted subarray$A[1..j-1]$, and so $t_j=j$ for $j=2,3,...,n$. Noting that \\

$\sum_{j=2}^nj=n(n+1)/2-1$\\

and\\

$\sum_{j=2}^n(j-1)=n(n-1)/2$\\

Therefore, in worst case, the running time of $INSERTION-SORT$ is\\
$$\hspace{0.5cm}T(n)=c_1n+c_2(n-1)+c_3(n-1)+c_4(n(n+1)/2-1)+c_5(n(n-1)/2)+ c_6(n(n-1)/2)+c_7(n-1)$$
$$\hspace{1.5cm}=(c_4/2+c_5/2+c_6/2)n^2+(c_1+c_2+c_3+c_4/2-c_5/2-c_6/2+c_8)n-(c_2+c_3+c_4+c_7)$$
$\hspace{1.5cm}=an^2+bn+c$\\

which is a \textbf{\textit{ quadratic equation}}. Here,$an^2+bn+c$ for constants a,b and c that again depend on the statement costs $c_i$; it is thus a \textbf{\textit{quadratic function}} of \textit{n}.\\
\newpage

\textbf{3.Average  case:}\\

The \textbf{average case} is often roughly as bad as the worst case. On average half the elements in $A[1..j-1]$ are less than $A[j]$,and half the elements are greater. On average, therefore, we check half of the subarray $A[1..j-1]$, and so $t_j$ is about $j/2$. The resulting average case running time turns out to be a quadratic function of the input size, just like the worst-case running time.

Here is the chart of time complexity of insertion sort.

\vspace{1cm}

\includegraphics{insertdata.png}

\hspace{5cm}fig: Chart of Insertion Sort.

\subsection{Graph of Time Complexity of Insertion Sort}

Here is the graph of  comparison of running times of average case,best case and worst case.\\

\includegraphics{img-1.png}

\hspace{4cm}fig: time vs n graph for insertion sort.

\newpage

\section{Merge Sort}

The \textbf{\textit{Merge Sort}} algorithm closely follows the divide and conquer paradigm. Intuitively, it operates as follows,
\vspace{0.5cm}

\textbf{Divide:}

Divide the \textit{n}- element sequence to be sorted into two subsequences of $n/2$ elements  each.
\vspace{0.5cm}

\textbf{Conquer:}

Sort the two subsequences recursively using merge sort.
\vspace{0.5cm}

\textbf{Combine:}

Merge the two sorted subsequences to produce the sorted answer.
\vspace{0.5cm}

The key operation of the merge sort algorithm is the merging of two sorted sequences in the \textbf{combine} step. We merge by calling an auxiliary procedure $MERGE(A,p,q,r)$, where \textit{A} is an array and \textit{p,q} and \textit{r} are indices into the array such that $p\leq q<r$. The procedure assumes that the subarray $A[p..q]$ and $A[q+1..r]$ are in sorted order. It \textbf{\textit{merges}} them to form a single sorted subarray that replaces the current subarray $A[p..r]$.
\vspace{0.5cm}

Our $MERGE$ procedure takes time $\Theta(n)$, where $n=r-p+1$ is the total number of elements being merged.

\newpage

\subsection{Algorithm}

The following pseudocode implements $MERGE(A,p,q,r)$ procedure, which merges the two subsequences. And another pseudocode $MERGE-SORT(A,p,r)$ sorts the elements in the subarray$A[p..r]$.
\vspace{1cm}

$MERGE(A,p,q,r)$

1\hspace{0.5cm} $n_1=q-p+1$

2\hspace{0.6cm}$n_2=r-q$

3\hspace{0.6cm}//create arrays $L[1...n_1+1]$ and $R[1...n_2+1]$.

4\hspace{0.6cm}$\textbf{for } i=1\hspace{0.2cm}to \hspace{0.2cm}n_1$

5\hspace{1cm}$do\hspace{0.2cm}L[i]=A[p+i-1]$

6\hspace{0.6cm}$\textbf{for}\hspace{0.2cm} j=1\hspace{0.2cm}to\hspace{0.2cm}n_2$

7\hspace{1cm}$do\hspace{0.2cm} R[j]=A[q+j]$

8\hspace{0.6cm}$L[n_1+1]=\infty$

9\hspace{0.6cm}$R[n_2+1]=\infty$

10\hspace{0.5cm}$i=1$

11\hspace{0.5cm}$j=1$

12\hspace{0.5cm}$\textbf{for}\hspace{0.2cm}k=p\hspace{0.2cm}to\hspace{0.2cm}r$

13\hspace{1cm}$do\hspace{0.2cm}if\hspace{0.2cm}L[i]\leq R[j]$

14\hspace{1.5cm}$then\hspace{0.2cm}A[k]=L[i]$

15\hspace{1.5cm}$i=i+1$

16\hspace{1cm}$else\hspace{0.3cm}A[k]=R[j]$

17\hspace{1.5cm}$j=j+1$

\vspace{1cm}

$MERGE-SORT(A,p,r)$

1\hspace{0.5cm}$\textbf{if}\hspace{0.2cm}p<r$

2\hspace{1cm}$q=\left [(p+r)/2\right]$

3\hspace{1cm}$MERGE-SORT(A,p,q)$

4\hspace{1cm}$MERGE-SORT(A,q+1,r)$

5\hspace{1cm}$MERGE(A,p,q,r)$

\subsection{Time Complexity of MERGE-SORT}

\vspace{1cm}

There are no such differences among the best,worst and average case of time complexity in merge sort.

\textbf{Best case:} In best case, the running time of merge sort is,$T(n)=O(nlog(n))$.
\vspace{0.5cm}

\textbf{Average case:} In average case, the running time of merge sort is, $T(n)=O(nlog(n))$.
\vspace{0.3cm}

\textbf{Worst case:} In worst case, the running time of worst case is, $T(n)=O(nlog(n))$.

Here, is the chart of time complexity in merge sort-

\vspace{1cm}

\includegraphics{mergedata.png}

\hspace{5cm}fig: Time Complexity chart.

\subsection{Graph of Time Complexity of MERGE-SORT}

We can represent time complexity of $MERGE-SORT$ by the following graph.

\includegraphics{mergesort.png}

\hspace{5cm}fig: Time complexity  graph  of merge sort.

\section{Bubble Sort}

\textbf{Bubble Sort} is a popular, but inefficient, sorting algorithm. It works by repeatedly swapping adjacent elements that are out of order.

\subsection{Algorithm of BUBBLE SORT}

\vspace{1cm}

$BUBBLE-SORT(A)$

1\hspace{0.5cm}$\textbf{for}\hspace{0.2cm}i=1\hspace{0.2cm}to\hspace{0.2cm}length[A]$

2\hspace{1cm}$do\hspace{0.2cm}\textbf{for}\hspace{0.2cm}j=length[A]\hspace{0.2cm}downto\hspace{0.2cm}i+1$

3\hspace{1.5cm}$do\hspace{0.2cm}\textbf{if}\hspace{0.2cm}A[j]<A[j-1]$

4\hspace{2cm}$then\hspace{0.2cm}exchange\hspace{0.2cm}A[j]<->A[j-1]$

\subsection{Time Complexity of BUBBLE SORT}

 In  average and worst case, the running time of BUBBLE-SORT are same, $T(n)=O(n^2)$. But in best case, the running time is $O(n)$.

\vspace{1cm}

Here is the table of time complexity-

\vspace{1cm}

\includegraphics{bubbledata.png}

\hspace{5cm}fig: Table of Time Complexity of Bubble Sort.

\subsection{Time Complexity Graph of BUBBLE-SORT}

The following graph represents time complexity of BUBBLE-SORT.

\vspace{1cm}

\includegraphics{bubble sort.png}

\hspace{5cm}fig: Time complexity of BUBBLE-SORT.

\section{Quick Sort}

Quick Sort, like Merge Sort, applies the divide and conquer paradigm. Here is the three-step divide and conquer process for sorting a typical subarray $A[p..r]$.

\textbf{Divide:} Partition the array $A[p..r]$ into two (possible empty) subarrays $A[p..q-1]$ and $A[q+1..r]$ such that each element of $A[p..q-1]$ is less than or equal to $A[q]$, which is, in turn, less than or equal to each element of $A[q+1..r]$. Compute the index \textit{q} as part of this partitioning procedure.

\textbf{Conquer:} Sort the two subarrays $A[p..q-1]$ and $A[q+1..r]$ by recursive calls to quick sort.

\textbf{Combine:} Because the subarrays are already sorted, no work is needed to combine them: the entire array $A[p..r]$ is now sorted.

\subsection{Algorithm of Quick Sort}

The following procedure implements quicksort:

\vspace{1cm}

$QUICKSORT(A,p,r)$

1\hspace{0.5cm}$\textbf{if}\hspace{0.2cm}p<r$

2\hspace{1cm}$q=PARTITION(A,p,r)$

3\hspace{1cm}$QUICKSORT(A,p,q-1)$

4\hspace{1cm}$QUICKSORT(A,q+1,r)$

\vspace{0.5cm}

\textbf{Partitioning the array}

\vspace{0.5cm}

The key to the algorithm is the $PARTITIONING$ procedure, which rearranges the subarray $A[p..r]$ in place.

\vspace{0.5cm}

$PARTITION(A,p,r)$

1\hspace{0.5cm}$x=A[r]$

2\hspace{0.5cm}$i=p-1$

3\hspace{0.5cm}\textbf{for} $j=p$  \textbf{to} $r-1$

4\hspace{1cm} \textbf{if} $A[j] \leq x$

5\hspace{1.5cm} $i=i+1$

6\hspace{1.5cm} exchange $A[i]$ with $A[j]$

7\hspace{0.5cm}exchange $A[i+1]$ with $A[r]$

8\hspace{0.5cm}\textbf{return} $i+1$

\subsection{Time Complexity of Quick Sort}

The running time of quick sort is similar at best and average case, but it is larger at worst case.

\vspace{0.5cm}

\textbf{Average case:} The running time is $O(nlgn)$.

\textbf{Best case:} The running time is $O(nlgn)$.

\textbf{Worst case:} The running time is $O(n^2)$.

\vspace{0.5cm}

Here is the Time Complexity Chart of Quick Sort:

\includegraphics{quickdata.png}

\hspace{5cm}fig: Time Complexity chart of Quick Sort.

\subsection{Time Complexity Graph of Quick Sort}

From chart, we draw a graph that represents the efficiency of Quick Sort algorithm.

\vspace{1cm}

\includegraphics{quicksort.png}

\hspace{5cm}fig: Time Complexity graph of quick sort.

\section{Heap Sort}

Like merge sort, but unlike insertion sort, heapsort's running time is $O(n lgn)$. Like insertion sort, but unlike merge sort, heapsort sorts in place: only a constant number of array elements are stored outside the input array at any time.

Heapsort also introduces another algorithm design technique: using a data structure, in this case one we call a \textbf{heap}, to manage information.

\subsection{Algorithm of Heap Sort}

$MAX-HEAPIFY(A,i)$

1\hspace{0.5cm}$l=LEFT(i)$

2\hspace{0.5cm}$r=RIGHT(i)$

3\hspace{0.5cm}\textbf{if} $l \leq A.heap-size$ and $A[l]>A[i]$

4\hspace{1cm}$largest=l$

5\hspace{0.5cm}\textbf{else} $largest=i$

6\hspace{0.5cm}\textbf{if} $r \leq A.heap-size$ and $A[r]>A[largest]$

7\hspace{1cm}$largest=r$

8\hspace{0.5cm}\textbf{if} $largest \neq i$

9\hspace{1cm}exchange $A[i]$ with $A[largest]$

10\hspace{1cm}$MAX-HEAPIFY(A,largest)$

\vspace{1cm}

$BUILD-MAX-HEAP(A)$

1\hspace{0.5cm}\textit{A.heap-size}=\textit{A.length}

2\hspace{0.5cm}\textbf{for} $i=[A.length/2]$ \textbf{downto} 1

3\hspace{1cm}$MAX-HEAPIFY(A,i)$

\vspace{1cm}

$HEAPSORT(A)$

1\hspace{0.5cm}$BUILD-MAX-HEAP(A)$

2\hspace{0.5cm}\textbf{for} $i=A.length$ \textbf{downto} 2

3\hspace{1cm}exchange $A[1]$ with $A[i]$

4\hspace{1cm}\textit{A.heap-size}=\textit{A.heap-size}-1

5\hspace{1cm}$MAX-HEAPIFY(A,1)$

\subsection{Time Complexity of Heap Sort}

The Time complexity of Heap sort is not so complex. The running time of Heao sort is $O(nlgn)$. This is same for the best, average and worst case.

\textbf{Chart for Time Complexity}

Here is the table that contains the data of running time and number of elements.

\vspace{1cm}

\includegraphics{heapdata.png}

\hspace{5cm}fig: Time Complexity chart.

\subsection{Time Complexity Graph}

Here is the graph that represents the time complexity graph in Heap-Sort.

\vspace{1cm}

\includegraphics{heapsort.png}

\hspace{5cm}fig: Time Complexity graph of Heap-Sort.

\end{document}


\documentclass[11pt]{article}

\usepackage{graphicx}
\usepackage{courier}
\usepackage{underscore}
\setcounter{secnumdepth}{4}

\title{Laconic to TMD Compilation}
\author{Adam Yedidia}

\begin{document}

\maketitle

This document is an explanation of the Laconic-to-TMD compilation process. It won't be useful to users who only want to know how to use Laconic files, or how to write Laconic files of their own. Rather, it is intended for an audience who is simply curious about how the algorithm works, or wants to write their own language which will compile down to TMD. \\

Each part of the logic in a Laconic program transforms into an equivalent section of TMD code. In the below sections, it is explained how this happens for each Laconic command. \\

Every Laconic compiler presented in this repository makes use of the algorithm described herein. So, for example, the compiler that transforms Laconic programs into 2-symbol Turing machines just calls this compiler, and then calls the compiler that transforms TMD programs into 2-symbol Turing machines. The same is true for compilation to 4-symbol Turing machines.

\section{Variable Values} \label{sec:varvalues}

In Laconic, variables can have any value corresponding to an integer, a list of integers, or a list of lists of integers. In TMD, ``variables'' and ``tapes'' refer to the same thing, and correspondingly the ``value'' of a ``variable'' is simply the symbols currently on the tape. \\

Recall that in TMD, the tape alphabet is (\texttt{_}, \texttt{1}, \texttt{E}), and that tapes must take the form \texttt{_}$(\texttt{1}|\texttt{E})^*\texttt{_}^\infty$. We call the second symbol on the tape the ``home position'' of that tape.

\subsection{\texttt{int} Values}

\subsubsection{Non-Negative Integers}

To represent the value of an \texttt{int} \texttt{x} with value $x \ge 0$, the tape representation is: \\ \\
\texttt{_}$\texttt{1}^x\texttt{E}\texttt{_}^\infty$ \\

So, for example, the value 5 would be represented as: \\ \\
\texttt{_11111E___}\dots

\subsubsection{Negative Integers}

To represent the value of an \texttt{int} \texttt{x} with value $x < 0$, the tape representation is: \\ \\
\texttt{_}$\texttt{E1}^{-x}\texttt{E_}^\infty$ \\

So, for example, the value -3 would be represented as: \\ \\
\texttt{_E111E___}\dots
%In the subsections following this one, I call the part of the tape containing only \texttt{1}'s and \texttt{E}'s.

\subsection{\texttt{list} Values}

To represent the value of a \texttt{list} that contains integer values $e_1$, $e_2$, $e_3$, and so on, the tape representation is: \\ \\
$\texttt{_E}((e_1>0)?\texttt{1}:\texttt{E})\texttt{1}^{|e_1|}\texttt{E}((e_2>0)?\texttt{1}:\texttt{E})\texttt{1}^{|e_2|}\texttt{E}((e_3>0)?\texttt{1}:\texttt{E})\texttt{1}^{|e_3|}\texttt{E}\dots\texttt{_}^\infty$ \\

In other words, the tape representation of the \texttt{list} begins with an \texttt{E} in the home position, and then for each element of the \texttt{list}, there would be a \texttt{1} if the element positive and an \texttt{E} otherwise, followed by a number of \texttt{1}'s equal to the magnitude of the number, followed by an \texttt{E}. So, for example, the value $[5, -2, 0]$ would be represented as: \\ \\
\texttt{_E111111EE11EEE___}\dots

\subsection{\texttt{list2} Values}

To represent the value of a \texttt{list2} that contains \texttt{list} values $l_1$, $l_2$, and so on, each of which contains \texttt{int} values $e_{11}$, $e_{12}$, and so on, and $e_{21}$, $e_{22}$, and so on, and so on, the tape representation is: \\ \\
$\texttt{_EE1}((e_{11}>0)?\texttt{1}:\texttt{E1})\texttt{1}^{|e_{11}|}\texttt{E1}
((e_{12}>0)?\texttt{1}:\texttt{E1})\texttt{1}^{|e_{12}|}\texttt{E1}\dots\texttt{EE1}
((e_{21}>0)?\texttt{1}:\texttt{E1})\texttt{1}^{|e_{21}|}\texttt{E1}
((e_{22}>0)?\texttt{1}:\texttt{E1})\texttt{1}^{|e_{22}|}\texttt{E1}\dots\dots\texttt{E_}^\infty$ \\

In other words, the tape representation of each list in the \texttt{list2} begins with \texttt{EE1}, and then for each \texttt{list} in the \texttt{list2}, the \texttt{int}s in those \texttt{list}s are preceded by a \texttt{1} if the number is positive and a \texttt{E1} otherwise, followed by a number of \texttt{1}'s equal to the magnitude of the number, followed by a \texttt{E1}. Finally, to signal the end of the entire \texttt{list2}, the symbol \texttt{E} is used, followed by infinite underscores. So, for example, the value $[[3,-1], [], [0,4]]$ would be represented as: \\ \\
\texttt{_EE11111E1E11E1EE1EE1E1E111111E1E___}\dots

\section{Laconic Operations}

Each operation in Laconic has a corresponding TMD function which performs the operation. As an example, the Laconic operation \texttt{a*b} will compile down to a call to the TMD function \texttt{BUILTIN_multiply}. \\

The following is the full mapping between Laconic operations and TMD functions: \\ \\

\begin{center}
    \begin{centering}
    \begin{tabular}{||c c c||}
    \hline
    Operation & Laconic symbol & TMD function \\ [0.5ex]
    \hline
    Addition & \texttt{+} & \texttt{BUILTIN_add} \\
    \hline
    Subtraction & \texttt{-} & \texttt{BUILTIN_subtract} \\
    \hline
    Multiplication & \texttt{*} & \texttt{BUILTIN_multiply}\\
    \hline
    Integer Division & \texttt{/} & \texttt{BUILTIN_divide}\\
    \hline
    Negation & \texttt{~} & \texttt{BUILTIN_intneg}\\
    \hline
    Equality & \texttt{==} & \texttt{BUILTIN_equal}\\
    \hline
    Inequality & \texttt{!=} & \texttt{BUILTIN_notEqual}\\
    \hline
    Greater Than & \texttt{>} & \texttt{BUILTIN_greaterThan}\\
    \hline
    Less Than & \texttt{<} & \texttt{BUILTIN_greaterThan} (arguments reversed)\\
    \hline
    Greater or Equal & \texttt{>=} & \texttt{BUILTIN_greaterOrEqual}\\
    \hline
    Less Than or Equal & \texttt{<=} & \texttt{BUILTIN_greaterOrEqual} (arguments reversed)\\
    \hline
    And & \texttt{\&} & \texttt{BUILTIN_and}\\
    \hline
    Or & \texttt{|} & \texttt{BUILTIN_or}\\
    \hline
    Not & \texttt{!} & \texttt{BUILTIN_assignNot}\\
    \hline
    List Index & \texttt{@} & \texttt{BUILTIN_listindex}\\
    \hline
    List2 Index & \texttt{@*} & \texttt{BUILTIN_list2index}\\
    \hline
    List Append & \texttt{\^} & \texttt{BUILTIN_append}\\
    \hline
    List2 Append & \texttt{\^{}*} & \texttt{BUILTIN_list2append}\\
    \hline
    List Length & \texttt{\#} & \texttt{BUILTIN_len}\\
    \hline
    List2 Length & \texttt{\#*} & \texttt{BUILTIN_len2}\\
    \hline
    List Concatenation & \texttt{||} & \texttt{BUILTIN_concatenate}\\
    \hline
    Explicit Integer & --- & \texttt{BUILTIN_assign*}\\
    \hline
    Explicit List Description & \texttt{[]} & \texttt{BUILTIN_listAssemble*}\\
    \hline
    Explicit List2 Description & \texttt{::} & \texttt{BUILTIN_list2Assemble*}\\
    \end{tabular}
    \end{centering}
\end{center}

The above TMD functions are all available for perusal at: \\ \\
\texttt{parsimony/src/tmd/laconic_std_library/} \\

Note that for explicit descriptions of \texttt{int}s, \texttt{list}s, or \texttt{list2}s, there are separate functions callable based on the size of the relevant value. This means that it is important to avoid putting integers larger than 20 or so, or lists of similar length, into the program explicitly. (Building them up implicitly, of course, is fine.) I would recommend against doing this, because probably at this point it is more parsimonious to describe the number or list implicitly, but if necessary one can use the programs \texttt{assemblexgen.py} and \texttt{assignxgen.py}, which can be found in the \texttt{tmd_meta} directory, to generate larger explicit-description functions. \\

The Laconic Standard Library has more than just the functions shown in the table above. It also contains many helper functions which are called by the functions above. \\

The Laconic Standard Library's functions all begin with the string ``\texttt{BUILTIN_}''. It is therefore a very bad idea to begin your function names in TMD or Laconic with that string. \\

Every function in the Laconic Standard Library was written by me in order to compute the desired operation. Each one is composed entirely of explicit tape commands, return statements, and calls to other built-in functions.

\section{Complex Expressions}

Complex expressions are expressions that are made up of multiple operations, such as (a+b)*c, for example. There is no order of operations to worry about, since full parenthesization is required. \\

Compiling a complex expression is somewhat more tricky than compiling a single operation, since the built-in functions can only handle one operation at a time. The solution is to hold temporary results in \emph{holder variables}, which are created automatically by the compiler. They are created as necessary and reused when their contents become irrelevant. They are recognizable by the fact that their names all begin with the \texttt{!} symbol. They exist only in the compiled TMD, of course. \\

When a variable is assigned to the value of a (potentially complex) expression, a series of function calls to built-in functions (potentially involving holder variables) is the result in the compiled TMD. Then, the built-in function \texttt{BUILTIN_assign} is called to transfer the held value of the result of the complex expression to the variable. \\

\section{If Statements}

In Laconic, an \texttt{if} statement has the following form: \\ \\
\texttt{if (}[\emph{expression}]\texttt{)\{}[\emph{function body}]\texttt{\}} \\

This is compiled down to a section of TMD code that looks like the following: \\ \\
{}[Sequence of commands designed to load the value of \emph{expression} into the holder variable $h$] \\
\texttt{[}$h$\texttt{] E (IF_STATE_}$i$\texttt{_FALSE); 1 ()} \\
{}[Compiled version of \emph{function body}] \\
\texttt{IF_STATE_}$i$\texttt{_FALSE:} [Continuation of the program] \\

In a Laconic program, the function body is evaluated if and only if the expression evaluates to a positive integer (and the expression is forbidden from being a \texttt{list} or \texttt{list2}). As can be seen above, in the compiled TMD, the function body is evaluated if and only if the home-position tape symbol in the result of the expression is not an \texttt{E}. As can be seen from Section~\ref{sec:varvalues}, this corresponds precisely to the scenarios when the value of the expression is equal to a positive integer.

\section{While Statements}

In Laconic, a \texttt{while} statement has the following form: \\ \\
\texttt{while (}[\emph{expression}]\texttt{)\{}[\emph{function body}]\texttt{\}} \\

This is compiled down to a section of TMD code that looks like the following: \\ \\
\texttt{WHILE_TEST_}$i$\texttt{:} [Sequence of commands designed to load the value of \emph{expression} into the holder variable $h$] \\
\texttt{[}$h$\texttt{] E (WHILE_STATE_}$i$\texttt{_FALSE); 1 ()} \\
{}[Compiled version of \emph{function body}] \\
\texttt{[}$h$\texttt{] E (WHILE_TEST_}$i$\texttt{); 1 (WHILE_TEST_}$i$\texttt{)} \\
\texttt{WHILE_STATE_}$i$\texttt{_FALSE:} [Continuation of the program]

In a Laconic program, the function body is evaluated repeatedly until the expression evaluates to a non-positive integer (and the expression is forbidden from being a \texttt{list} or \texttt{list2}). As can be seen above, in the compiled TMD, the function body is evaluated repeatedly until the home-position tape symbol in the result of the expression is an \texttt{E}. As can be seen from Section~\ref{sec:varvalues}, this corresponds precisely to the scenarios when the value of the expression is equal to a non-positive integer.

\section{Function and Variable Compilation}

Each Laconic function defined within a Laconic program is given its own corresponding TMD function file. There is additionally a TMD function created named \texttt{main}, which is given its own function file and contains all of the logic that exists in the Laconic program outside of function definitions. The function \texttt{main} is called first in the TMD program, and is accordingly put at the top of the \texttt{functions.tff} file. \\

The input line of \texttt{main.tmd} contains every variable declared in the Laconic file, along with every holder variable needed in \texttt{main} or in any of the other functions defined in the Laconic program. \\

Once \texttt{main} is fully converted to TMD as described in the sections above, we find all of \texttt{main}'s ``dependencies'' on other functions, by going through each function called by \texttt{main}. For each of those functions, we include them in \texttt{functions.tff}, and we recursively transform them to TMD as above if necessary, and import their dependencies as well. Some of these functions may come directly from the Laconic Standard Library, in which case they are copied to the target directory; others will be functions defined within the Laconic program, in which case they need to be generated (using the conversion process as described in the sections above) and moved into the target directory,

The functions are \texttt{functions.tff} are ordered from top to bottom in decreasing order of how many times each is called, with more frequently-called functions towards the top of the file. (Of course, \texttt{main} is the top function in the list.)

\end{document}