## Abstract

Hardy and Littlewood's approximate functional equation for quadratic Weyl sums (theta sums) provides, by iterative application, a powerful tool for the asymptotic analysis of such sums. The classical Jacobi theta function, on the other hand, satisfies an exact functional equation, and extends to an automorphic function on the Jacobi group. In the present study we construct a related, almost everywhere non-differentiable automorphic function, which approximates quadratic Weyl sums up to an error of order one, uniformly in the summation range. This not only implies the approximate functional equation, but also allows us to replace Hardy and Littlewood's renormalization approach by the dynamics of a certain homogeneous flow. The great advantage of this construction is that the approximation is global, that is, there is no need to keep track of the error terms accumulating in an iterative procedure. Our main application is a new functional limit theorem, or invariance principle, for theta sums. The interesting observation here is that the paths of the limiting process share a number of key features with Brownian motion (scale invariance, invariance under time inversion and non-differentiability), although time increments are not independent and the value distribution at each fixed time is distinctly different from a normal distribution.