Volume 9, Issue 2 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff Submissions Subscriptions Advertising Back Issues Contact Information 
Trott's Corner
Modular Equations Now we calculate the simplest modular equations for the RogersRamanujan continued fraction. In the simplest case, modular equations (or identities) are bivariate polynomials for some positive integer . Ramanujan found the following one, among others:
Here is a highprecision check of this identity.
In addition to their intrinsic beauty, modular identities are frequently useful for constructing fast algorithms. Repeatedly squaring the argument, , will make it quickly decrease, and a very low approximation of can be used at the last step. We will not follow this line of thought here and only demonstrate it by using , which is .
The last recursive squaring approach needed only nine steps to yield 134 correct digits for . With nine terms, the truncated continued fraction would give only 18 correct digits. Here is another modular equation for . This time we make a series of order 100 to check the identity. The truncated series vanishes.
Now we will implement the few lines of Mathematica code that will allow us to generate new modular equations. The idea is similar in spirit to the last check; we will use a highorder series: for a fixed and , we make the following ansatz:
Here is a fixed integer. Expanding in a series in allows a comparison of coefficients, and we get a linear system for the coefficients . Because of the factor , we can partition the coefficients with respect to their fractional power. The function splitGroups does this. We use the abbreviations and to make the code easier to read.
Here is an example for , , and . We obtain five groups corresponding to , , , , and .
The function groupsToSeriesCoefficientLists uses a highorder series approximation to obtain the linear equations obeyed by the coefficients . To avoid parametrized solutions, we use series terms to make sure we get more equations than coefficients .
Here is another example. By using enough series terms, we get (many) more equations than coefficients and hopefully get a unique solution if a modular equation exists.
To find nontrivial solutions of the resulting homogeneous system for the , we use the function NullSpace. Specifically, we use modular null space computations to avoid intermediate coefficient swell that would arise from using exact rational arithmetic. Using approximate highprecision numbers would lose too much precision in the calculations.
Here are examples where the system has either no solution or a solution.
A numerical check confirms that we indeed found a modular equation.
Solving with ModulusPrime guarantees that we do not miss a solution, but such solutions might not be solutions over the rationals. To avoid spurious solutions, we use the function selectModularEquationNumerically to select (via a highprecision check) the real modular equations. In addition, selectModularEquationNumerically factors the resulting identities and extracts the relevant parts.
Now we have everything to implement the function findModularEquation that, for a given , will find a corresponding modular equation. The function starts with and increases until a modular equation is found. The optional second argument allows us to start the search at a given value of and a given group number .
The next input recalculates the modular equation given earlier.
The following input avoids the search.
Here is a complete list of twovariable modular equations for , (only the equations for were known [8, 9, 10]). For brevity of the results, we apply Simplify. We use the notations R[], and R[].
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Modular equation of order :
Calculating modular equations for even larger can be done quickly. Here are the three primes , , and . Primes are often of especial interest for modular equations.
We check the last identity to 10,000 digits at a "random" value.
Combining modular equations coming from different values of allows us to derive new ones. For example, we replace by in the modular equation for . By using the modular equation for , we can eliminate the . So we obtain the modular equation for . This complicated polynomial that corresponds to would take a long time to find using the function findModularEquation directly.
Using findModularEquation using a list as the first argument allows us to find modular equations of the form . Here is a simple example.
This concludes our short excursion into the world of modular equations. The interested reader could now go on and search for more complicated modular equations, such as for positive integers , , and like the following two examples for and (where we use ).


About Mathematica  Download Mathematica Player Copyright © Wolfram Media, Inc. All rights reserved. 