A nearly-optimal method to compute the truncated theta function, its derivatives, and integrals

A poly-log time method to compute the truncated theta function, its derivatives, and integrals is presented. The method is elementary, rigorous, explicit, and suited for computer implementation. We repeatedly apply the Poisson summation formula to the truncated theta function while suitably normalizing the linear and quadratic arguments after each repetition. The method relies on the periodicity of the complex exponential, which enables the suitable normalization of the arguments, and on the self-similarity of the Gaussian, which ensures that we still obtain a truncated theta function after each application of the Poisson summation. In other words, our method relies on modular properties of the theta function. Applications to the numerical computation of the Riemann zeta function and to nding the number of solutions of Waring type Diophantine equations are discussed.