Skip to main content
2 of 2
added 80 characters in body
Iosif Pinelis
  • 127.9k
  • 8
  • 107
  • 229

$\newcommand\ep\epsilon\newcommand{\si}{\sigma} $"I want to find a function for $N$ at which the error is $\epsilon$."

This question is stated very poorly.

Indeed, let $n:=N$ (there is no reason to use $N$ where $n$ will do.) The $n$th error is \begin{equation*} \ep_n:=s-s_n=\ep_{1n}+\ep_{2n}, \end{equation*} where \begin{equation*} s:=\sum_{q=1}^\infty a_q,\quad s_n:=\sum_{q=1}^{n-1} a_q(1-q/n), \quad a_q:=e^{-q^2\si^2/2}, \end{equation*} \begin{equation*} \ep_{1n}:=\sum_{q=n}^\infty a_q,\quad \ep_{2n}:=\frac1n\,\sum_{q=1}^{n-1} a_q q. \end{equation*}

Clearly, $\ep_n$ takes only countably many values; so, the equality $\ep_n=\ep$ can hold only for countably many values of $\ep$. Also, a closed-form expression for $\ep_n$ is not available. So, solutions of the equation $\ep_n=\ep$ for $n$ are not available in closed form, even when such solutions exist.

However, for any real $\ep>0$, we can provide an explicit lower bound $n_{\si,\ep}$ on $n$ such that $\ep_n\le\ep$ for $n\ge n_{\si,\ep}$ -- and this is what appears to have actually been tried to do in most of the OP.

Indeed, note that \begin{equation*} r_q:=\frac{a_{q+1}}{a_q}=e^{-(q+1/2)\si^2} \end{equation*} is decreasing in $q$. So, \begin{equation*} \ep_{1n}\le\sum_{q=n}^\infty a_n r_n^{q-n}=\frac{a_n}{1-r_n}=\frac{e^{-n^2\si^2/2}}{1-e^{-(n+1/2)\si^2}} \le2e^{-n^2\si^2/2} \end{equation*} if \begin{equation*} n\ge\frac{\ln2}{\si^2}-\frac12. \end{equation*} Next, \begin{equation*} \ep_{2n}\le\frac1n\,\sum_{q=1}^\infty a_q q \le\frac{h(\si)}n, \end{equation*} where \begin{equation} h(\si):=\sum_{q=1}^\infty a_1 r_1^{q-1} q =\frac{e^{5 \si ^2/2}}{(e^{3 \si^2/2}-1)^2}. \end{equation} Thus, if \begin{equation} n\ge n_{\si,\ep}:=\max\Big(\frac{\ln2}{\si^2}-\frac12,\sqrt{\frac2{\si^2}\, \max\Big(0,\ln\frac3\ep\Big)}, \frac{h(\si)}{\ep/3}\Big), \end{equation} then $\ep_n\le\ep$. $\quad\Box$

Iosif Pinelis
  • 127.9k
  • 8
  • 107
  • 229