# An algorithm for Poincare recurrence time

Define the function $[0,+\infty) \rightarrow R$:

$$f = \cos (t) + \cos (\sqrt{2} t) + \cos (\sqrt{3} t) + \cos (\sqrt{5} t ) .$$

I want a number $t$ bigger than $10^7$ such that

$$f(t) > 4 - 10^{-9} .$$

Can anyone give me such a number? Ultimately, I want an algorithm which works for arbitrary precision (say $10^{-900}$).

• how do you do $$\cos (t) + \cos (\sqrt{2} t) + \cos (\sqrt{3} t) > 3 - 10^{-9}?$$ – Will Jagy May 12 '15 at 19:30
• It is an equally difficult problem. Anyway, I want a general algorithm. – wdlang May 12 '15 at 20:11
• One example: $t=32733777552734744709300 \times 17310639413 \times 122447 (2\pi), f(t) = 3.99999999946$. – Douglas Zare May 13 '15 at 0:37
• Isn't it just a matter of finding sufficiently good rational approximations to $\frac{1}{2 \pi}$, $\frac{\sqrt{2}}{2 \pi}$, $\frac{\sqrt{3}}{2 \pi}$, $\frac{\sqrt{5}}{2 \pi}$, then taking t as their least common denominator? – John R Ramsden May 14 '15 at 10:42
• More of a comment than an answer: This method, mathforum.org/kb/message.jspa?messageID=7379751, will also find the simultaneous approximations needed to solve your problem. – O. S. Dawg May 15 '15 at 2:35

You want to find an $s$ such that $s, \sqrt{2} s, \sqrt{3} s, \sqrt{5} s$ are all close to integer. Your $t$ is then given by $2\pi s.$ The first question is a problem in simultaneous Diophantine approximation, an algorithm for which (using lattice reduction) is given by W.Bosma (probably among others).
If you take a random $T$ in some large interval (large enough that $\cos(T)$, $\cos(\sqrt{2} T)$ and $\cos(\sqrt{3} T)$ $\cos(\sqrt{5} T)$ are essentially independent), the probability that each of these is greater than $1 - 10^{-9}/4$ is approximately $(10^{-3}/(\sqrt{2} \pi))^4 \approx 2.5 \times 10^{-15}$. However, we can do better. If we take $T = 2 \pi x$ where $x$ is an integer, $\cos(T) = 1$. If $x$ is a linear combination (with small integer coefficients) of denominators of convergents of the continued fraction for $\sqrt{2}$, we can ensure $\cos(\sqrt{2} T)$ close enough to $1$. Then we have only two other cosines that need to be close to $1$, and the probability should be about $5 \times 10^{-8}$, well within the capabilities of a random search on a fast computer.
• You might get to $10^{-9}$ this way, but never to $10^{-900}$. The approach via simultaneous Diophantine approximation (using the LLL algorithm, or better yet PSLQ) is polynomial in the exponent and readily solve the question for $10^{-900}$ (as was done by O.S.Dawg) and beyond. – Noam D. Elkies May 17 '15 at 2:06