### Theta Functions

As mentioned in the previous post, modular forms are complicated mathematical structures that follow a number of symmetry rules. One of the typical modular forms is what's called "theta functions". A theta function TF over two variables a and b is defined as: TF(a,b) = Sum(-oo <= n <= oo) a^(n*(n+1))/2 * b^(n*(n-1))/2 Basically it is an infinite sum in both directions of a product whose variables are raised to n, which is the variable from minus infinite to positive infinite. The question is to observe the symmetrical properties of this form. One way to do that is by plotting the 3D chart for the following function: z = Sum(-oo <= n <= oo) x^(n*(n+1))/2 * y^(n*(n-1))/2 This was we transform the form into a simple z = F(x,y) function. Given a pair (x,y), we can then generate z and have the triplet (x,y,z). Let's write some code to do that. Code is straightforward but two simple aspects to be aware of: 1) If you do a for(int i=-oo;i<=oo;i++)