TITLE: An algorithm for Poincare recurrence time
QUESTION [8 upvotes]: 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}$).

REPLY [2 votes]: 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.