EXPERIMENTAL MATHEMATICS – TUTORIAL 2
1. Numerical precision
Both Macaulay2 and Mathematica support arbitrary precision numerical calculations. In
Macaulay2, the desired numerical precision can be specified with numeric:
numeric_100 pi
For numbers, one can use the following shorthand:
1/3p100
In each case the precision is measured in binary digits (a precision of 100 is roughly 30 digits
in base 10).
Or one can simply (as one of you suggested!) set once and for all the default precision:
defaultPrecision=100;
and then all subsequent calculations will be done using this precision.
For Mathematica, there is some information about numeric precision and interval arith-
metic at
https://reference.wolfram.com/language/tutorial/Numbers.html
First check the last identity of the lecture up to 30 digits: that
M(1,
√
2) =
Γ(3/4)
Γ(5/4)
√
pi
2
In both Macaulay2 and Mathematica, the Γ function is Gamma.
Now consider the real number
α =
pi10
ζ(10)
where ζ(s) =
∑∞
n=1
1
ns
is implemented as zeta in Macaulay2 (resp. Zeta in Mathematica).
Compute α to default precision and guess what the exact value of α might be.
Increase the precision a few times to see if your guess persists.
Consider the real number
β =
(
epi
√
163 744
)1/3
Compute β to default precision and venture a guess about the value of β.
Increase the working precision and recompute β. Do you need to adjust your guess If
not, maybe increase the precision some more.
Think about what strategies you might employ to check whether what you are seeing is
just a numerical glitch.
A good approach to this type of question relies on interval arithmetic.
1
2 EXPERIMENTAL MATHEMATICS – TUTORIAL 2
2. Interval arithmetic
This is a continuation of the previous exercise.
In Macaulay2, one can write e.g.,
mypi = interval(3.14,3.15)
(exp(sqrt 163 * mypi)-744)^(1/3)
If the interval does not contain the expected value, this means there is inequality (but if it
does, we can’t conclude anything yet!).
Because approximating constants is so common, there is in fact a built-in function:
mypi=numericInterval(100,pi)
Note that calculations are still performed with some given precision; if you want the
interval to be smaller and smaller, you need to make sure every constant has the prescribed
precision!
Experiment until you have a definite conclusion about the value of β defined in the previous
exercise.
Given some accuracy bound ε, implement your own function myagm that returns the agM
of two positive real numbers a and b in interval arithmetic, where the width of the interval
is less than ε. You can reuse the functions a and b defined in the lectures.
EXPERIMENTAL MATHEMATICS – TUTORIAL 2 3
3. Continued fractions
In the first exercise, we’ve found that pi
10
ζ(10)
is an integer. This leads to the obvious question:
given an integer k ≥ 2, is pik
ζ(k)
an integer If not, is it at least a rational number
Experiment numerically, and formulate a conjecture.
We shall use continued fractions to find the best rational approximation of a real number.
A continued fraction expansion of a positive real number β is an expression of the form
β = a0 +
1
a1 +
1
a2 +
1
a3 +
1
. . .
where a0 ∈ Z≥0, a1, a2, · · · ∈ Z>0.
Given β, the continued fraction expansion is easily computed by the recursion
β0 = β
an = bβnc for n ≥ 0
βn =
1
βn 1 an 1 for n ≥ 1
The truncation at an of a continued fraction is called its n-th convergent
a0 +
1
a1 +
1
a2 +
1
· · ·+ 1
an
=
pn
qn
If you harbour any nostalgia for the good ol’ Real Analysis days, try your hand at this:
prove that the sequence (pn/qn) converges as n→∞. One possible approach is to first show
that
pn 1qn pnqn 1 = ( 1)n
then conclude that the sequence (pn/qn) is Cauchy.
Write a function that, given n and a real number β, returns pn/qn (and optionally prints
the sequence a0, . . . , an). b. . .c is implemented as floor, resp. Floor. Try it on the golden
ratio 1+
√
5
2
, the square roots of small integers, e, pi. . . What do you observe Can you prove
a statement about numbers with periodic continued fraction expansion
A number β is rational if and only if its continued fraction expansion is finite. Experiment
on pi
k
ζ(k)
, minding accuracy issues.
Hopefully, at this stage, you’ve found a certain sequence of numerators/denominators.
Ask the OEIS for help recognizing them!
4 EXPERIMENTAL MATHEMATICS – TUTORIAL 2
4. agM and Ramanujan identity
Consider the function
A(q) =
(∑
n∈Z
qn
2
)2
for |q| < 1.
Implement A numerically to some given accuracy.
Now compute A(e pi). Do you recognize this number (Hint: it is closely related to
M(1,
√
2))
This is a special case of an identity of Ramanujan, namely that if q is defined by
q = exp
(
pi M(1,
√
x)
M(1,
√
1 x)
)
for 0 < x < 1, then A(q) = 1/M(1,
√
x). (can you see why it’s a special case )