\documentclass{article}
\input{../lib.sty}

\title{\texttt{fn accuracy\_to\_discrete\_gaussian\_scale}}
\author{\MichaelShoemateAuthor}

\begin{document}
\maketitle

This document contains materials associated with \rustdoc{accuracy/fn}{accuracy\_to\_discrete\_gaussian\_scale}.

By \rustdoc{accuracy/fn}{discrete\_gaussian\_scale\_to\_accuracy}, 
the relationship between $\alpha$, $a$ and $scale$, is:

\begin{align*}
    1 - \alpha = \frac{\sum_{y=0}^{a - 1} (1 + 1[y \ne 0]) e^{-(y/s)^2/2}}{\sum_{z \in \mathbb{Z}} e^{-(z/s)^2/2}}
\end{align*}

A closed-form expression for $s$ doesn't exist, 
so we use a numerical approach by a binary search.
A loose upper bound is provided by \rustdoc{accuracy/fn}{accuracy\_to\_gaussian\_scale}.
The binary search finds the smallest $s$ such that
\begin{align*}
    \alpha \le 1 - \frac{\sum_{y=0}^{a - 1} (1 + 1[y \ne 0]) e^{-(y/s)^2/2}}{\sum_{z \in \mathbb{Z}} e^{-(z/s)^2/2}}
\end{align*}

\end{document}
