**Setup:**
Let $\phi\colon T^2 \to T^2$ be a hyperbolic toral automorphism. Let $f\colon T^2 \to \mathbb{R}$ be a continuous function.

For $x \in T^2$, let $\underline{f}(x) = \inf_{n \in \mathbb{Z}} f(\phi^n(x))$. Let $M = \sup_{x \in T^2} \underline{f}(x)$.

Let $N_\epsilon(x) = \min\{n \geq 0 \colon f(\phi^n(x)) < M + \epsilon\}$, and let $N_\epsilon = \sup_{x \in T^2} N_\epsilon(x)$.

Notice that $N_\epsilon < \infty$ for all $\epsilon > 0$. Indeed, if we let $U_n = \{x \in T^2\colon N_\epsilon(x) \leq n\}$ ($n \geq 0$), this forms an open cover of $T^2$ by definition of $M$, so by compactness some $U_n$ must be all of $T^2$.

**Question:**
Is there a way of estimating $M$? And, what I most want to know, *how does the growth of $N_\epsilon$ as $\epsilon \to 0$ depend on $\phi$ and $f$?* Could we write down an algorithm to upper-bound $N_\epsilon$?

The $f$ I'm considering is given by a piecewise formula, real-analytic on each of the (finitely many) pieces.

Another way of putting it would be, given a "nice" open set $U$ in the torus (e.g. $U = \{x\colon f(x) < K\}$ for $f$ piecewise real-analytic, so $\partial U$ consists of piecewise real-analytic curves) is there a good way of telling whether every orbit intersects $U$, and if so estimating the minimum $N$ such that for every $x$, there exists $0 \leq n \leq N$ with $\phi^n(x) \in U$?

**Context:**
My current interest in this has to do with the *geodesic flow* on the space $X = \{A\mathbb{Z}^2\colon A \in SL_2(\mathbb{R})\}$ of unimodular lattices in the plane. It's given by $g_t(A\mathbb{Z}^2) = \left(\begin{array}{l}e^t&0\\0&e^{-t}\end{array}\right)A\mathbb{Z}^2$.

This flow has some periodic orbits. For instance, if $A_0 = \left(\begin{array}{l}\sqrt{2}&1\\-\sqrt{2}&1\end{array}\right)$, then we get $$\left(\begin{array}{l}3 + 2\sqrt{2}&0\\0&3 - 2\sqrt{2}\end{array}\right)\left(\begin{array}{l}\sqrt{2}&1\\-\sqrt{2}&1\end{array}\right)\mathbb{Z}^2 = \left(\begin{array}{l}\sqrt{2}&1\\-\sqrt{2}&1\end{array}\right)\left(\begin{array}{l}3&2\\4&3\end{array}\right)\mathbb{Z}^2 = \left(\begin{array}{l}\sqrt{2}&1\\-\sqrt{2}&1\end{array}\right)\mathbb{Z}^2.$$

There's a natural torus bundle $Y$ over $X$, with the fiber over $A\mathbb{Z}^2$ being $\mathbb{R}^2/A\mathbb{Z}^2$, which represents *translates of unimodular lattices*. And there's a flow in $Y$ that projects down to the geodesic flow in $X$.

Under this flow, for instance, the torus $\mathbb{R}^2/A_0\mathbb{Z}^2$ ($A_0$ as above) gets mapped onto itself via $\left(\begin{array}{l}3&2\\4&3\end{array}\right)$. I'm really trying to understand certain things about the flow in $Y$. But the question I ask about toral automorphisms and functions/open sets seems basic enough that it might also be important for other things.