# Sample variance of rounded variables

J. An<EMAIL_ADDRESS>1 Korea Astronomy and Space Science Institute

###### Abstract

If the rounding errors are assumed to be distributed independently from the
intrinsic distribution of the random variable, the sample variance $s^{2}$ of
the rounded variable is given by the sum of the true variance $\sigma^{2}$ and
the variance of the rounding errors (which is equal to $w^{2}/12$ where $w$ is
the size of the rounding window). Here the exact expressions for the sample
variance of the rounded variables are examined and it is also discussed when
the simple approximation $s^{2}=\sigma^{2}+w^{2}/12$ can be considered valid.
In particular, if the underlying distribution $f$ belongs to a family of
symmetric normalizable distributions such that $f(x)=\sigma^{-1}F(u)$ where
$u=(x-\mu)/\sigma$, and $\mu$ and $\sigma^{2}$ are the mean and variance of
the distribution, then the rounded sample variance scales like
$s^{2}-(\sigma^{2}+w^{2}/12)\sim\sigma\Phi^{\prime}(\sigma)$ as
$\sigma\to\infty$ where $\Phi(\tau)=\int_{-\infty}^{\infty}{\rm
d}u\,e^{iu\tau}F(u)$ is the characteristic function of $F(u)$. It follows
that, roughly speaking, the approximation is valid for a slowly-varying
symmetric underlying distribution with its variance sufficiently larger than
the size of the rounding unit.

##  I Introduction

Most real world data are only recorded in the rounded figure with a fixed
number of significant digits. Strictly this rounding introduces additional
systematic uncertainties which must be properly accounted for, in order to
infer the property of the intrinsic distribution of the measured quantities.
Naively, assuming that there is neither intrinsic uncertainty nor systematic
bias, the differences between the true value and the rounded reported value
are expected to be distributed evenly over the window of the size of the
reporting unit.

In particular, if the variable value $x$ is rounded to an integer multiple
value of the measurement unit as in $nw$ (where $w$ is the measurement unit
and $n$ is an integer), then $(n+\delta-1/2)w\leq x<(n+\delta+1/2)w$ or
$(n+\delta-1/2)w<x\leq(n+\delta+1/2)w$. Here the constant
$\delta\in[-1/2,1/2]$ specifies the rounding method (e.g., $\delta=1/2$ for
rounding down to the floor, $\delta=-1/2$ for rounding up to the ceiling, and
$\delta=0$ for rounding to the nearest integer etc.) whereas the equal signs
at the boundary follow the prescribed convention. Then the rounding error
(i.e. $\rho=nw-x$) is distributed in the rectangular distribution:

$P(\rho)=\begin{cases}w^{-1}&\text{for $-(1/2+\delta)w<\rho<(1/2-\delta)w$}\\\
0&\text{elsewhere}\end{cases},$ (1)

where the distribution at the boundary is determined by the chosen convention
– however provided that $x$ is a real variable in a continuous distribution,
the boundaries consitute a null measure set and so the specific choice does
not affect the following discussion. For a random variable $x$, the mean of
the rounded values is (with $\bar{x}$ being the true mean of $x$)

$\overline{nw}=\overline{x+\rho}=\bar{x}+\int_{-(1/2+\delta)w}^{(1/2-\delta)w}\frac{\rho}{w}\,{\rm
d}\rho=\bar{x}-\delta u,$ (2)

while the variance is

$\begin{split}s^{2}&=\overline{(nw-\overline{nw})^{2}}=\overline{(x+\rho)^{2}}-(\bar{x}+\bar{\rho})^{2}\\\
&=\sigma^{2}+\overline{\rho^{2}}-\bar{\rho}^{2}+2(\overline{x\rho}-\bar{x}\bar{\rho}),\end{split}$
(3)

where $\sigma^{2}=\overline{x^{2}}-\bar{x}^{2}$ is the variance of $x$, with
the variance of the rounding errors given by

$\overline{\rho^{2}}-\bar{\rho}^{2}=\int_{-(1/2+\delta)w}^{(1/2-\delta)w}\frac{\rho^{2}}{w}\,{\rm
d}\rho-(\delta w)^{2}=\frac{w^{2}}{12}.$ (4)

In other words, provided that the distribution of $x$ does not affect the
rounding (as in $\overline{x\rho}=\bar{x}\bar{\rho}$), the standard deviation
of the rounded values is simply a quadrature sum of the true underlying
standard deviation and that of the rounding errors, and the true standard
deviation may be estimated from the variance of the rounded values via

$\sigma=\left(s^{2}-\frac{w^{2}}{12}\right)^{1/2}.$ (5)

However, this result is only valid “on average” sense. That is to say, the
underlying distribution of the variable can technically affect the rounding
but for an arbitrary unspecified distribution, the expected value of
“$\overline{x\rho}-\bar{x}\bar{\rho}$” should be zero and the reported error
tends to the quadrature sum of the random error and the rounding error
($\sigma_{\rho}/w=1/\\!\sqrt{12}\approx 0.2887$).

##  II Theory

Suppose that $f(x)$ is a probability distribution of a real random variable
$x$ with

$\begin{split}&\int_{-\infty}^{\infty}\\!{\rm
d}x\,f(x)=1,\quad\int_{-\infty}^{\infty}\\!{\rm d}x\,x\,f(x)=\mu,\\\
&\int_{-\infty}^{\infty}\\!{\rm
d}x\,(x-\mu)^{2}f(x)=\int_{-\infty}^{\infty}\\!{\rm
d}x\,x^{2}f(x)-\mu^{2}=\sigma^{2}.\end{split}$ (6)

Next consider the rounding off the measured value of the variable such that,
with a fixed constant $\delta\in[-1/2,1/2]$ and the measurement unit $w$, the
value $x$ is read off by an integer multiple of the unit, i.e. $nw$, where
$n=\left\lfloor(x/w+1/2-\delta)\right\rfloor$ or
$n=\left\lceil(x/w-1/2-\delta)\right\rceil$ with $\lfloor x\rfloor$ and
$\lceil x\rceil$ being the integer floor and ceiling of $x$. Then the
(discrete) distribution of the reported integer $n$ for the rounded value is
found to be

$F_{n}=\int_{(n+\delta-1/2)w}^{(n+\delta+1/2)w}\\!{\rm d}x\,f(x).$ (7)

This distribution is properly normalized: that is,

$\sum_{n=-\infty}^{\infty}F_{n}=\int_{-\infty}^{\infty}\\!{\rm d}x\,f(x)=1,$
(8)

and so we can find the mean and the variance of the rounded variables by
calculating

$\begin{split}m&=\bar{n}w=w\sum_{n=-\infty}^{\infty}nF_{n},\quad\\\
s^{2}&=\overline{(nw-m)^{2}}=\overline{n^{2}}w^{2}-m^{2}\\\
&=w^{2}\left[\sum_{n=-\infty}^{\infty}n^{2}F_{n}-\left(\sum_{n=-\infty}^{\infty}nF_{n}\right)^{2}\right].\end{split}$
(9)

For some distributions $f(x)$, the associated discrete distribution $F_{n}$ as
well as its mean $m$ and the standard deviation $s^{2}$ of the rounded
variable can be computed analytically. However the calculations become quite
tedious even for many simple distributions and the computations can only be
done numerically for most distributions including the important example such
as the normal distribution. Instead here we try to analyze the problem more
generally. Henceforth we also assume $w=1$ but the requisite adjustments for
any other value of $w$ are trivial.

###  II.1 characteristic function

First let us introduce the characteristic function $\varphi(t)$ of the
distribution $f(x)$: namely,

$\varphi(t)=\int_{-\infty}^{\infty}\\!{\rm d}x\,e^{itx}f(x).$ (10)

The derivatives of the characteristic function then result in

$\begin{split}\varphi^{(n)}(t)&=i^{n}\int_{-\infty}^{\infty}\\!{\rm
d}x\,x^{n}e^{itx}f(x);\\\
\varphi^{(n)}(0)&=i^{n}\int_{-\infty}^{\infty}\\!{\rm
d}x\,x^{n}f(x),\end{split}$ (11)

and so $\varphi(0)=1$, $\varphi^{\prime}(0)=i\mu$ and
$\varphi^{\prime\prime}(0)=-(\sigma^{2}+\mu^{2})$. We can also define the
shifted characteristic function:

$\begin{split}\tilde{\varphi}(t)&=e^{-it\mu}\varphi(t)=\int_{-\infty}^{\infty}\\!{\rm
d}x\,e^{it(x-\mu)}f(x)\\\ &=\int_{-\infty}^{\infty}\\!{\rm
d}\epsilon\,e^{it\epsilon}f(\mu+\epsilon),\\\
\tilde{\varphi}^{\prime}(t)&=e^{-it\mu}[\varphi^{\prime}(t)-i\mu\varphi(t)];\\\
\tilde{\varphi}^{\prime\prime}(t)&=e^{-it\mu}[\varphi^{\prime\prime}(t)-2i\mu\varphi^{\prime}(t)-\mu^{2}\varphi(t)].\end{split}$
(12)

Then $\tilde{\varphi}(0)=\varphi(0)=1$,
$\tilde{\varphi}^{\prime}(0)=\varphi^{\prime}(0)-i\mu\varphi(0)=0$, and
$\tilde{\varphi}^{\prime\prime}(0)=\varphi^{\prime\prime}(0)-2i\mu\varphi^{\prime}(0)-\mu^{2}\varphi(0)=-\sigma^{2}-\mu^{2}+2\mu^{2}-\mu^{2}=-\sigma^{2}$.
In other words, the Maclaurin series coefficients of $\tilde{\varphi}(t)$
result in the sequence of the central moments whereas those of $\varphi(t)$
result in the moments about the origin. Furthermore, if the distribution is
symmetric about its mean $\mu$ as in $f(\mu+\epsilon)=f(\mu-\epsilon)$ for any
$\epsilon\in\mathbb{R}$, then

$\begin{split}\tilde{\varphi}(t)&=\int_{-\infty}^{\infty}\\!{\rm
d}\epsilon\,e^{it\epsilon}f(\mu-\epsilon)\\\ &=\int_{-\infty}^{\infty}\\!{\rm
d}\varepsilon\,e^{i(-t)\varepsilon}f(\mu+\varepsilon)=\tilde{\varphi}(-t);\end{split}$
(13)

and also $\tilde{\varphi}^{(n)}(t)=(-1)^{n}\tilde{\varphi}^{(n)}(-t)$. That is
to say, the shifted characteristic function of a symmetric distribution is an
even function. The converse also holds in that, if the characteristic function
is in the form of $\varphi(t)=e^{it\mu}\tilde{\varphi}(t)$ with an even
function such that $\tilde{\varphi}(t)=\tilde{\varphi}(-t)$, the distribution
must be symmetric about the mean $\mu$.

###  II.2 distribution of rounded values

The characteristic function may also be inverted to recover the distribution
via the inverse Fourier transform: that is,

$\begin{split}f(x)&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}t\,e^{-itx}\varphi(t)\\\ &=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}t\,e^{it(\mu-x)}\tilde{\varphi}(t).\end{split}$ (14)

Inserting this into equation (7), we find the expression for the discrete
distribution $F_{n}$ of the rounded variable in terms of the characteristic
function $\varphi(t)$: namely,

$\begin{split}F_{n}&=\frac{1}{2\pi}\int_{n+\delta-1/2}^{n+\delta+1/2}\\!{\rm
d}x\int_{-\infty}^{\infty}\\!{\rm d}t\,e^{-itx}\varphi(t)\\\
&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}t\,\varphi(t)\int_{n+\delta-1/2}^{n+\delta+1/2}\\!{\rm d}x\,e^{-itx}\\\
&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}t\,\varphi(t)\,\mbox{sinc}\Bigl{(}\frac{t}{2}\Bigr{)}\,e^{-it(n+\delta)}\\\
&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}t\,\tilde{\varphi}(t)\,\mbox{sinc}\Bigl{(}\frac{t}{2}\Bigr{)}\,e^{it(\mu-\delta-n)}.\end{split}$
(15)

Here $\mbox{sinc}(x)=x^{-1}\sin x$ for $x\neq 0$ and $\mbox{sinc}(0)=1$. In
addition we can also define the characteristic function of $F_{n}$. Since
$F_{n}$ is a discrete distribution, its characteristic function is given
by(Tricker, 1984)

$\begin{split}\Phi_{t}&=\sum_{n=-\infty}^{\infty}\\!e^{itn}F_{n}\\\
&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\\!{\rm
d}\tau\,\varphi(\tau)\,\mbox{sinc}\Bigl{(}\frac{\tau}{2}\Bigr{)}\,e^{-i\tau\delta}\sum_{n=-\infty}^{\infty}\\!e^{i(t-\tau)n}\\\
&=\sum_{k=-\infty}^{\infty}\\!\varphi(t+2\pi
k)\,\mbox{sinc}\left(\frac{t}{2}+\pi k\right)\,e^{-i(t+2\pi k)\delta}\\\
&=\sum_{k=-\infty}^{\infty}\\!\tilde{\varphi}(t+2\pi
k)\,\mbox{sinc}\left(\frac{t}{2}+\pi k\right)\,e^{i(t+2\pi
k)(\mu-\delta)},\end{split}$ (16)

Here we have used the Fourier series representation of the so-called Dirac
comb distribution: namely,

$\frac{1}{2\pi}\sum_{n=-\infty}^{\infty}\\!e^{in(t-\tau)}=\sum_{k=-\infty}^{\infty}\\!\deltaup(t-\tau+2\pi
k).$ (17)

Then the derivative of $\Phi_{t}$ is found to be

$\frac{d\Phi_{t}}{dt}=\sum_{k=-\infty}^{\infty}\Biggl{\\{}\left[\varphi^{\prime}(t+2\pi
k)-i\delta\varphi(t+2\pi k)\right]\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}\\\ +\varphi(t+2\pi k)\frac{d}{dt}\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}\Biggr{\\}}e^{-i(t+2\pi k)\delta},$ (18)

while the second-order derivative is given by

$\frac{d^{2}\Phi_{t}}{dt^{2}}=\sum_{k=-\infty}^{\infty}\Biggl{\\{}\left[\varphi^{\prime\prime}(t+2\pi
k)-2i\delta\varphi^{\prime}(t+2\pi k)-\delta^{2}\varphi(t+2\pi
k)\right]\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi k\Bigr{)}\\\
+2\left[\varphi^{\prime}(t+2\pi k)-i\delta\varphi(t+2\pi
k)\right]\frac{d}{dt}\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}+\varphi(t+2\pi
k)\frac{d^{2}}{dt^{2}}\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}\Biggr{\\}}e^{-i(t+2\pi k)\delta}.$ (19)

Here for the sake of clarity, we have not yet introduced the explicit forms
for the derivatives of the sinc function,

$\begin{split}\frac{d}{dt}\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}&=\frac{1}{2}\frac{\cos(t/2+\pi k)-\mbox{sinc}(t/2+\pi k)}{t/2+\pi
k}\\\ \frac{d^{2}}{dt^{2}}\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}&=-\frac{1}{4}\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi k\Bigr{)}\\\
&-\frac{1}{2}\frac{\cos(t/2+\pi k)-\mbox{sinc}(t/2+\pi k)}{(t/2+\pi
k)^{2}}.\end{split}$ (20)

Next given that

$\frac{d^{k}\Phi_{t}}{dt^{k}}=i^{k}\sum_{n=-\infty}^{\infty}\\!n^{k}e^{itn}F_{n}\
\Rightarrow\
\sum_{n=-\infty}^{\infty}\\!n^{k}F_{n}=\frac{1}{i^{k}}\left.\frac{d^{k}\Phi_{t}}{dt^{k}}\right\rvert_{t=0},$
(21)

we can find that

$\begin{split}m&=\sum_{n=-\infty}^{\infty}\\!nF_{n}=\frac{1}{i}\left.\frac{d\Phi_{t}}{dt}\right\rvert_{t=0}=\mu-\delta+S_{0}\\\
s^{2}&=\sum_{n=-\infty}^{\infty}\\!(n-m)^{2}F_{n}=-\left.\frac{d^{2}\Phi_{t}}{dt^{2}}\right\rvert_{t=0}-m^{2}\\\
&=\sigma^{2}+\frac{1}{12}-S_{1}-S_{0}^{2},\end{split}$ (22)

where

$\begin{split}S_{0}&=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}\varphi(2\pi k)}{2\pi ik}e^{-2\pi
ik\delta}\\\ &=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}\tilde{\varphi}(2\pi k)}{2\pi
ik}e^{2\pi ik(\mu-\delta)},\end{split}$ (23)

and

$\begin{split}S_{1}&=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}}{\pi k}\left[\varphi^{\prime}(2\pi
k)-i\mu\varphi(2\pi k)-\frac{\varphi(2\pi k)}{2\pi k}\right]e^{-2\pi
ik\delta}\\\ &=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}}{\pi
k}\left[\tilde{\varphi}^{\prime}(2\pi k)-\frac{\tilde{\varphi}(2\pi k)}{2\pi
k}\right]e^{2\pi ik(\mu-\delta)}.\end{split}$ (24)

Here we have used the fact that $\mbox{sinc}(\pi k)=(\pi k)^{-1}\sin(\pi k)=0$
for any non-zero integer $k\in\mathbb{Z}-\\{0\\}$ as well as

$\left.\frac{d}{dt}\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}\right\rvert_{t=0}=\begin{cases}\dfrac{(-1)^{k}}{2\pi
k}&k\in\mathbb{Z}-\\{0\\}\vskip 3.0pt plus 1.0pt minus 1.0pt\\\
0&k=0\end{cases},$ (25)

and

$\left.\frac{d^{2}}{dt^{2}}\,\mbox{sinc}\Bigl{(}\frac{t}{2}+\pi
k\Bigr{)}\right\rvert_{t=0}=\begin{cases}\dfrac{(-1)^{k+1}}{2(\pi
k)^{2}}&k\in\mathbb{Z}-\\{0\\}\vskip 3.0pt plus 1.0pt minus 1.0pt\\\
-\dfrac{1}{12}&k=0\end{cases}.$ (26)

Equations (22) indeed reproduce the results expected from the elementary
arguments given in the introduction with the proviso that the infinite sums,
$S_{0}$ and $S_{1}$ in equations (23) and (24) are negligible. In other words,
if one considers only the $k=0$ term in the characteristic function of
equation (16), we would recover the results that $m=\mu-\delta$ and
$s^{2}=\sigma^{2}+1/12$. In fact, if one regards $F_{n}$ to be a continuous
distribution over real $n$ and replace the infinite sum
$\sum_{n=-\infty}^{\infty}e^{i(t-\tau)n}$ in equation (16) with the integral
$\int_{-\infty}^{\infty}e^{i(t-\tau)n}{\rm d}n$, the Dirac comb
$\sum_{k=-\infty}^{\infty}\deltaup(t-\tau+2\pi k)$ would be replaced by a
single Dirac delta $\deltaup(t-\tau)$. That is to say, the naive expectation
that $m=\mu-\delta$ and $s^{2}=\sigma^{2}+1/12$ may be considered as the
approximation in the limit of continuous $F_{n}$.

###  II.3 symmetric distribution

If $M\in\mathbb{Z}$ is the integer to which the mean $\mu$ is rounded,
$\mu\in[M+\delta-1/2,M+\delta+1/2]$ and $\chi=\mu-\delta-M\in[-1/2,1/2]$.
Since $M$ and $k$ are integers and $\mu-\delta=M+\chi$, we find

$\begin{split}S_{0}&=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}\tilde{\varphi}(2\pi k)}{2\pi
ik}e^{2\pi ik\chi};\\\ S_{1}&=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{(-1)^{k}}{\pi
k}\left[\tilde{\varphi}^{\prime}(2\pi k)-\frac{\tilde{\varphi}(2\pi k)}{2\pi
k}\right]e^{2\pi ik\chi},\end{split}$ (27)

which is basically the Fourier series expressions of $S_{0}(\chi)$ and
$S_{1}(\chi)$ for $\chi\in[-1/2,1/2]$. Since
$\tilde{\varphi}(-t)=\tilde{\varphi}(t)$ and
$\tilde{\varphi}^{\prime}(-t)=-\tilde{\varphi}^{\prime}(t)$ for a symmetric
distribution, these can be further reducible to the real ones:

$\begin{split}S_{0}&=\sum_{k=1}^{\infty}\\!\frac{(-1)^{k}\tilde{\varphi}(2\pi
k)}{\pi k}\sin(2\pi k\chi);\\\
S_{1}&=\sum_{k=1}^{\infty}\\!\frac{2\cdot(-1)^{k}}{\pi
k}\left[\tilde{\varphi}^{\prime}(2\pi k)-\frac{\tilde{\varphi}(2\pi k)}{2\pi
k}\right]\cos(2\pi k\chi)\\\
&=\sum_{k=1}^{\infty}\\!4\cdot(-1)^{k}\left.\frac{d}{dt}\biggl{(}\frac{\tilde{\varphi}(t)}{t}\biggr{)}\right|_{t=2\pi
k}\cos(2\pi k\chi)\end{split}$ (28)

if $f(x)$ is symmetric about its mean.

Next, consider the family of the distributions sharing the common normalized
form; namely,

$f(x)=\frac{1}{\sigma}\,F\\!\left(\frac{x-\mu}{\sigma}\right)$ (29)

where $F(u)$ is a fixed non-negative function such that
$\int_{-\infty}^{\infty}\\!{\rm d}u\,F(u)=1$, $\int_{-\infty}^{\infty}\\!{\rm
d}u\,u\,F(u)=0$, and $\int_{-\infty}^{\infty}\\!{\rm d}u\,u^{2}F(u)=1$. Then,
for all members of the family, we find $\varphi(t)=e^{i\mu t}\Phi(\sigma t)$
and $\tilde{\varphi}(t)=\Phi(\sigma t)$ where

$\Phi(\tau)=\int_{-\infty}^{\infty}\\!{\rm d}u\,e^{iu\tau}F(u)$ (30)

is the characteristic function of the normalized distribution. Here $f(x)$ is
a symmetric distribution if and only if $F(u)$ and $\Phi(\tau)$ are even
functions: $F(-u)=F(u)$ and $\Phi(-\tau)=\Phi(\tau)$. In the limit of
$\sigma=0$ – essentially $F(u)=\deltaup(u)$ – we then have
$\tilde{\varphi}(t)=\Phi(0)=1$ and
$\tilde{\varphi}^{\prime}(t)=\sigma\Phi^{\prime}(\sigma t)=0$ and so

$\begin{split}\lim_{\sigma^{2}\to
0}S_{0}&=\sum_{k=1}^{\infty}\\!\frac{(-1)^{k}}{\pi k}\sin(2\pi
k\chi)=-\chi;\\\ \lim_{\sigma^{2}\to
0}S_{1}&=\sum_{k=1}^{\infty}\\!\frac{(-1)^{k+1}}{(\pi k)^{2}}\cos(2\pi
k\chi)=\frac{1}{12}-\chi^{2},\end{split}$ (31)

for $\chi\in[-1/2,1/2]$. Then it follows that $m=\mu-\delta-\chi=M$ and
$s^{2}=\sigma^{2}+1/12-(1/12-\chi^{2})-(-\chi)^{2}=\sigma^{2}=0$, as expected
(i.e. every sample point is rounded to the same integer).

Now suppose that $\Phi(\tau)$ admits an asymptotic expansion;

$\Phi(\tau)\simeq\frac{1}{|\tau|^{s}}\sum_{p=0}^{\infty}\frac{\Phi_{\infty,p}}{\tau^{2p}}\qquad\text{($\tau\to\infty$)}$
(32)

with a constant $s>0$. Then it follows from equation (28) that

$\begin{split}S_{0}&\simeq\sum_{p=0}^{\infty}\\!\frac{\Phi_{\infty,p}}{(2\sigma)^{2p+s}}\sum_{k=1}^{\infty}\\!\frac{(-1)^{k}\sin(2\pi
k\chi)}{(\pi k)^{2p+s+1}};\\\
S_{1}&\simeq\sum_{p=0}^{\infty}\\!\frac{(2p+s+1)\Phi_{\infty,p}}{(2\sigma)^{2p+s}}\sum_{k=1}^{\infty}\\!\frac{(-1)^{k+1}\cos(2\pi
k\chi)}{(\pi k)^{2p+s+2}}.\end{split}$ (33)

Here the inner sums on $k$ converge absolutely for $s>0$ (NB: the sums for an
even integer $s$ are actually reducible to the Bernoulli polynomials) given
that

$\left\lvert\sum_{k=1}^{\infty}\\!\frac{(-1)^{k}\sin(2\pi k\chi)}{(\pi
k)^{2p+s+1}}\right\rvert\leq\sum_{k=1}^{\infty}\\!\frac{|(-1)^{k}\sin(2\pi
k\chi)|}{(\pi k)^{2p+s+1}}\\\ \leq\sum_{k=1}^{\infty}\\!\frac{1}{(\pi
k)^{2p+s+1}}=\frac{\zeta(2p+s+1)}{\pi^{2p+s+1}},$ (34)

where $\zeta(z)$ is the Riemann zeta function and similarly

$\left\lvert\sum_{k=1}^{\infty}\\!\frac{(-1)^{k+1}\cos(2\pi k\chi)}{(\pi
k)^{2p+s+2}}\right\rvert\leq\frac{\zeta(2p+s+2)}{\pi^{2p+s+2}}.$ (35)

If $\chi=1/2$, then $\cos(2\pi k\chi)=\cos(\pi k)=(-1)^{k}$ for any integer
$k$ and so the last bound is actually sharp. By contrast, the first bound is
not sharp but it suffices for our purposes here. Since
$\lim_{z\to\infty}\zeta(z)=1$ and $\zeta(z)$ for $z>1$ is monotonically
decreasing, we can conclude that equations (33) is in fact valid asymptotic
expansion of $S_{0}$ and $S_{1}$ as $\sigma\to\infty$. Also it follows that,
if $\lim_{\tau\to\infty}d\ln|\Phi(\tau)|/d\ln|\tau|=-s<0$, we have
$S_{0}\sim\sigma^{-s}\to 0$ and $S_{1}\sim\sigma^{-s}\to 0$ as
$\sigma\to\infty$ as well as $m=\mu-\delta+\mathcal{O}(\sigma^{-s})$ and
$s^{2}=\sigma^{2}+1/12+\mathcal{O}(\sigma^{-s})$.

As a concrete example, consider the bilateral exponential (Laplace)
distribution of the mean $\mu$ and the variance $\sigma^{2}$:

$f(x)=\frac{1}{\\!\sqrt{2}\sigma}\exp\biggl{(}-\frac{\\!\sqrt{2}}{\sigma}\lvert
x-\mu\rvert\biggr{)},$ (36)

which is easily normalizable so that

$F(u)=\frac{e^{-\\!\sqrt{2}|u|}}{\\!\sqrt{2}};\quad\Phi(\tau)=\left(1+\frac{\tau^{2}}{2}\right)^{-1}.$
(37)

Here we find $\Phi(\tau)=-\sum_{k=1}^{\infty}(-2/\tau^{2})^{k}\simeq
2/\tau^{2}$ as $\tau\to\infty$ and so it should be
$m=\mu-\delta+\mathcal{O}(\sigma^{-2})$ and
$s^{2}=\sigma^{2}+1/12+\mathcal{O}(\sigma^{-2})$. In fact for this case, we
know the analytic forms for $S_{0}(\chi)$ and $S_{1}(\chi)$. That is to say,
let us consider the odd function for $\chi\in[-1/2,1/2]$ given by

$\begin{split}S_{0}(\chi)&=\sum_{k=1}^{\infty}\frac{2^{k}B_{2k+1}(1/2+\chi)}{(2k+1)!\sigma^{2k}}\\\
&=\frac{\sinh(\\!\sqrt{2}\chi/\sigma)}{2\sinh[1/(\\!\sqrt{2}\sigma)]}-\chi,\end{split}$
(38)

where $B_{n}(z)$ is the Bernoulli Polynomial. Then we find that

$\int_{-1/2}^{1/2}\\!{\rm d}\chi\,S_{0}(\chi)\sin(2\pi
k\chi)=\frac{(-1)^{k}}{2\pi k[1+2(\sigma\pi k)^{2}]}.$ (39)

for a positive integer $k$. It follows that the first infinite sum in equation
(28) with $\tilde{\varphi}(t)=\Phi(\sigma t)=[1+(\sigma t)^{2}/2]^{-1}$ is the
Fourier (sine) series expansion for $S_{0}(\chi)$ in equation (38). In other
words, if we sample the random variable $x$ distributed according to equation
(36) and round it to an integer $n$ such that $n+\delta-1/2\leq
x<n+\delta+1/2$ or $n+\delta-1/2<x\leq n+\delta+1/2$ with a fixed
$\delta\in[-1/2,1/2]$, the mean of $n$ is

$\begin{split}m&=\mu-\delta+S_{0}=M+\frac{\sinh(\\!\sqrt{2}\chi/\sigma)}{2\sinh[1/(\\!\sqrt{2}\sigma)]}\\\
&\simeq\mu-\delta-\frac{\chi(1-4\chi^{2})}{12\sigma^{2}}+\mathcal{O}(\sigma^{-4}),\end{split}$
(40)

where $M$ is the integer to which $\mu$ is rounded and $\chi=\mu-\delta-M$.
Similarly we can also establish that the second infinite sum in equation (28)
with the same $\tilde{\varphi}(t)$ is a Fourier series representation of

$\begin{split}S_{1}(\chi)&=\sum_{k=1}^{\infty}\\!\frac{2^{k}B_{2k+2}(1/2+\chi)}{(k+1)(2k)!\sigma^{2k}}\\\
&=\sigma^{2}+\frac{1}{12}-\chi^{2}+\frac{\chi\sinh(\\!\sqrt{2}\chi/\sigma)}{\sinh[1/(\\!\sqrt{2}\sigma)]}\\\
&\phantom{=\sigma^{2}}-\frac{\cosh[1/(\\!\sqrt{2}\sigma)]\cosh(\\!\sqrt{2}\chi/\sigma)}{2\sinh^{2}[1/(\\!\sqrt{2}\sigma)]},\end{split}$
(41)

and so the variance of the rounded integers sampled over the random variables
with the distribution in equation (36) is

$\begin{split}s^{2}&=\frac{2\cosh[1/(\\!\sqrt{2}\sigma)]\cosh(\\!\sqrt{2}\chi/\sigma)-\sinh^{2}(\\!\sqrt{2}\chi/\sigma)}{4\sinh^{2}[1/(\\!\sqrt{2}\sigma)]}\\\
&\simeq\sigma^{2}+\frac{1}{12}-\left(\frac{7}{480}-\frac{\chi^{2}}{4}+\frac{\chi^{4}}{2}\right)\frac{1}{\sigma^{2}}+\mathcal{O}(\sigma^{-4}).\end{split}$
(42)

##  III Expectation Values for unspecified mean

The results so far have concerned the distributions with a known fixed mean.
Here instead we consider the cases of unspecified means. That is to say, let
us calculate the expectation values for the (difference to the true) mean and
the variance of the rounded variables averaged over distributions with all
possible means. In practice, this is achieved by averaging over
$\chi\in[-1/2,1/2]$ and so $\langle m-\mu\rangle=-\delta+\langle S_{0}\rangle$
and $\langle s^{2}\rangle=\sigma^{2}+1/12-\langle S_{1}\rangle-\langle
S_{0}^{2}\rangle$, where $\langle S_{0}\rangle=\int_{-1/2}^{1/2}{\rm
d}\chi\,S_{0}(\chi)$ and so on. However, we have $\langle e^{2\pi
ik\chi}\rangle=\langle\sin(2\pi\chi k)\rangle=\langle\cos(2\pi\chi
k)\rangle=0$ for any non-zero integer $k$ and thus $\langle
S_{0}\rangle=\langle S_{1}\rangle=0$ given equations (27) and (28). As for
$\langle S_{0}^{2}\rangle$, let us first note $\langle
S_{0}^{2}\rangle\neq\langle S_{0}\rangle^{2}$. Rather from equation (27),

$\begin{split}\langle
S_{0}^{2}\rangle&=\sum_{\begin{subarray}{c}k,p=-\infty\\\ k,p\neq
0\end{subarray}}^{\infty}\\!(-1)^{k+p}\frac{\tilde{\varphi}(2\pi
k)\tilde{\varphi}(2\pi p)}{(2\pi i)^{2}kp}\langle e^{2\pi
i(k+p)\chi}\rangle\\\ &=\sum_{\begin{subarray}{c}k=-\infty\\\ k\neq
0\end{subarray}}^{\infty}\\!\frac{\tilde{\varphi}(2\pi k)\tilde{\varphi}(-2\pi
k)}{(2\pi k)^{2}}=\sum_{k=1}^{\infty}\\!\frac{\lvert\tilde{\varphi}(2\pi
k)\rvert^{2}}{2(\pi k)^{2}},\end{split}$ (43)

where we have used the fact that $\tilde{\varphi}(-t)$ is the complex
conjugate of $\tilde{\varphi}(t)$ for any real $f(x)$ (see eq. 12). The same
result for the symmetric distributions may also be derived from equation (28)
given $\langle\sin^{2}(2\pi\chi k)\rangle=1/2$ and $\langle\sin(2\pi\chi
k)\sin(2\pi\chi p)\rangle=0$ for positive integers $k\neq p$. Consequently

$\langle m\rangle=\mu-\delta,\quad\langle
s^{2}\rangle=\sigma^{2}+\frac{1}{12}-\sum_{k=1}^{\infty}\\!\frac{\lvert\tilde{\varphi}(2\pi
k)\rvert^{2}}{2(\pi k)^{2}},$ (44)

with $\lim_{\sigma\to 0}\langle S_{0}^{2}\rangle=\zeta(2)/(2\pi^{2})=1/12$
(given $\tilde{\varphi}(t)=1$ for $\sigma=0$) and $\langle
s^{2}\rangle=\sigma^{2}=0$ in the limit of $\sigma=0$.

If $\Phi(\tau)$ is given by the same function admitting the asymptotic
expansion of equation (32), we find

$\langle
S_{0}^{2}\rangle\simeq\sum_{p=0}^{\infty}\frac{\zeta(2p+2s+2)\left(\sum_{r=0}^{p}\Phi_{\infty,p-r}\Phi_{\infty,r}\right)}{2^{2(p+s)+1}\pi^{2(p+s+1)}\sigma^{2(p+s)}},$
(45)

and so $\langle S_{0}^{2}\rangle\sim\sigma^{-2s}\to 0$ and $\langle
s^{2}\rangle=\sigma^{2}+1/12+\mathcal{O}(\sigma^{-2s})$ (also $0\leq\langle
s^{2}\rangle\leq\sigma^{2}+1/12$) as $\sigma\to\infty$ for
$\Phi(\tau)\sim\tau^{-s}$ as $\tau\to\infty$. That is to say, $\langle
s^{2}\rangle$ typically tends to the limiting value
$\lim_{\sigma^{2}\to\infty}(\langle s^{2}\rangle-\sigma^{2})=1/12$ about twice
much faster than the individual $s^{2}$ does. For example, with the bilateral
exponential distribution given in equation (36), we specifically have

$\begin{split}\langle S_{0}^{2}\rangle&=\sum_{k=1}^{\infty}\\!\frac{1}{2(\pi
k)^{2}[1+2(\pi k\sigma)^{2}]^{2}}\\\
&=\sum_{k=1}^{\infty}\\!\frac{1}{2^{3}(\pi
k)^{6}\sigma^{4}}\sum_{p=0}^{\infty}\\!\frac{(-1)^{p}(p+1)}{2^{p}(\pi
k\sigma)^{2p}}\\\
&=\sum_{p=0}^{\infty}\\!\frac{(-1)^{p}(p+1)}{\sigma^{2(p+2)}}\frac{\zeta(2p+6)}{(2\pi^{2})^{p+3}}\\\
&=\sum_{p=0}^{\infty}\\!\frac{(p+1)B_{2p+6}}{(2p+6)!}\frac{2^{p+2}}{\sigma^{2(p+2)}}\\\
&=\sigma^{2}+\frac{1}{12}-\frac{2+3\\!\sqrt{2}\,\sigma\sinh(\\!\sqrt{2}/\sigma)}{16\sinh^{2}[1/(\\!\sqrt{2}\sigma)]}\end{split}$
(46)

where $B_{k}$ is the Bernoulli number, and so

$\begin{split}\langle
s^{2}\rangle&=\frac{2+3\\!\sqrt{2}\,\sigma\sinh(\\!\sqrt{2}/\sigma)}{16\sinh^{2}[1/(\\!\sqrt{2}\sigma)]}\\\
&=\sigma^{2}+\frac{1}{12}-\frac{1}{\sigma^{4}}\sum_{p=0}^{\infty}\\!\frac{(p+1)B_{2p+6}}{(2p+6)!}\frac{2^{p+2}}{\sigma^{2p}};\end{split}$
(47)

that is, $\langle
s^{2}\rangle\simeq\sigma^{2}+1/12-1/(7560\sigma^{4})+\mathcal{O}(\sigma^{-6})$,
which contrasts to equation (42).

###  III.1 distributions with a compact support

Suppose that $f(x)$ is

$f(x)=\begin{cases}\dfrac{1}{2\\!\sqrt{3}\sigma}&(\mu-\\!\sqrt{3}\sigma\leq
x\leq\mu+\\!\sqrt{3}\sigma)\\\ 0&\text{elsewhere}\end{cases},$ (48)

i.e. the uniform distribution over a compact interval, the normalized form of
which is

$\begin{split}F(u)&=\begin{cases}\dfrac{1}{2\\!\sqrt{3}}&(-\\!\sqrt{3}\leq
u\leq\\!\sqrt{3})\\\ 0&\text{elsewhere}\end{cases};\\\
\Phi(\tau)&=\int_{-\\!\sqrt{3}}^{\\!\sqrt{3}}\frac{e^{iu\tau}{\rm
d}u}{2\\!\sqrt{3}}=\frac{\sin(\\!\sqrt{3}\tau)}{\\!\sqrt{3}\tau}.\end{split}$
(49)

We then find for the compact uniform distribution that

$\begin{split}\langle
S_{0}^{2}\rangle&=\sum_{k=1}^{\infty}\\!\frac{\sin^{2}(2\\!\sqrt{3}\pi\sigma
k)}{2(\pi k)^{2}(2\\!\sqrt{3}\pi\sigma
k)^{2}}=\sum_{k=1}^{\infty}\\!\frac{1-\cos(4\\!\sqrt{3}\pi\sigma
k)}{48\sigma^{2}(\pi k)^{4}}\\\
&=\frac{1}{48\sigma^{2}}\left[\frac{\zeta(4)}{\pi^{4}}-\frac{B_{4}(\xi)}{3}\right]=\frac{\xi^{2}(1-\xi)^{2}}{144\sigma^{2}}\end{split}$
(50)

where $\xi=2\\!\sqrt{3}\sigma-\lfloor 2\\!\sqrt{3}\sigma\rfloor\in[0,1)$ is
the fractional part of “$2\\!\sqrt{3}\sigma$ (which is the width of the
support)”. Here we have used the Fourier series expansion of the Bernoulli
polynomial (for $0\leq\xi\leq 1$) of the even order(Olver et al., 2010)

$B_{2n}(\xi)=(-1)^{n+1}\frac{(2n)!}{2^{2n-1}}\sum_{k=1}^{\infty}\frac{\cos(2\pi
k\xi)}{(\pi k)^{2n}},$ (51)

with $\zeta(4)=\pi^{4}/90$ and $B_{4}(\xi)=\xi^{2}(\xi-1)^{2}-1/30$. That is
to say, while the remainder $\langle S_{0}^{2}\rangle=\sigma^{2}+1/12-\langle
s^{2}\rangle$ falls off “on average” like $\sim\sigma^{-2}$ as
$\sigma\to\infty$, the actual behavior includes the periodic modulation
superimposed on the asymptotic scale-free decay. This is due to the compact
support on the underlying distribution: note that a compact distribution
$F(u)$ typically results in an oscillatory $\Phi(\tau)$, and $\langle
S_{0}^{2}\rangle$ is basically the sum on the regular sampling of the latter.
The resulting modulation of $\langle S_{0}^{2}\rangle$ may be understood as a
sort of interference patterns between the width of the compact support and the
unit intervals for the rounded integer values. However unless the variance of
the underlying continuous distribution $f(x)$ is known a priori, the averaged
asymptotic behavior of $\langle S_{0}^{2}\rangle$ as $\sigma\to\infty$ may be
used to estimate $\sigma^{2}$ from $s^{2}$ in practice within a reasonable
accuracy (provided $s^{2}>>1$). If one is in fact only interested in the
averaged asymptotic behavior, we can further average $\langle
S_{0}^{2}\rangle$ in equation (50) over $\xi\in[0,1)$ and get $\langle
S_{0}^{2}\rangle=\zeta(4)/(48\sigma^{2}\pi^{4})=(4320\sigma^{2})^{-1}$. For a
general distribution with a compact support, one may obtain the averaged
asymptotic behavior for $\langle S_{0}^{2}\rangle$ in equation (43) by
assuming that any sum of the form $\sum_{k}\sin(a\sigma k)/k^{n}$ or
$\sum_{k}\cos(a\sigma k)/k^{n}$ (where $a$ is a fixed real constant) also
vanishes on average.

In principle we can also calculate $S_{0}$ and $S_{1}$ first, and subsequently
average them over the proper interval. For the uniform distribution in
equation (48), equation (28) results in

$\begin{split}S_{0}&=\sum_{k=1}^{\infty}\\!(-1)^{k}\frac{\sin(2\\!\sqrt{3}\sigma\pi
k)}{2\\!\sqrt{3}\sigma(\pi k)^{2}}\sin(2\pi k\chi)\\\
&=\sum_{k=1}^{\infty}\\!\frac{\cos(2\pi\Delta_{-}k)-\cos(2\pi\Delta_{+}k)}{4\\!\sqrt{3}\sigma(\pi
k)^{2}}\\\
&=\frac{B_{2}(\Delta_{-})-B_{2}(\Delta_{+})}{4\\!\sqrt{3}\sigma}=-\frac{\lambda\zeta}{\\!\sqrt{3}\sigma},\end{split}$
(52)

where $\Delta_{\pm}=\mu-\delta+1/2\pm\\!\sqrt{3}\sigma-m_{\pm}$ is the
fractional part of $\mu\pm\\!\sqrt{3}\sigma-\delta+1/2$ and
$m_{\pm}=\lfloor(1/2+\mu-\delta\pm\\!\sqrt{3}\sigma)\rfloor$ is the integer to
which the upper/lower limit of the compact support (i.e.
$\mu\pm\\!\sqrt{3}\sigma$) is rounded. In addition,
$\lambda=(\Delta_{+}+\Delta_{-}-1)/2$ and $\zeta=(\Delta_{+}-\Delta_{-})/2$.
Also used are $(-1)^{k}\sin(2\pi k\chi)=\sin[2\pi k(1/2+\mu-\delta)]$ for any
integer $k$ given $\chi=\mu-\delta-M$ with an integer $M$, and
$B_{2}(x)=x^{2}-x+1/6$. Similarly,

$\begin{split}S_{1}&=\sum_{k=1}^{\infty}\\!(-1)^{k}\left[\frac{\cos(2\\!\sqrt{3}\sigma\pi
k)}{(\pi k)^{2}}-\frac{\sin(2\\!\sqrt{3}\sigma\pi k)}{\\!\sqrt{3}\sigma(\pi
k)^{3}}\right]\cos(2\pi k\chi)\\\
&=\frac{B_{2}(\Delta_{-})+B_{2}(\Delta_{+})}{2}+\frac{B_{3}(\Delta_{-})-B_{3}(\Delta_{+})}{3\\!\sqrt{3}\sigma}\\\
&=\lambda^{2}+\zeta^{2}-\frac{1}{12}-\left(2\lambda^{2}+\frac{2}{3}\zeta^{2}-\frac{1}{6}\right)\frac{\zeta}{\\!\sqrt{3}\sigma},\end{split}$
(53)

further utilizing $B_{3}(x)=x^{3}-3x^{2}/2+x/2$ and the Fourier series for the
odd-order Bernoulli polynomial(Olver et al., 2010):

$\sum_{k=1}^{\infty}\frac{\sin(2\pi kx)}{(\pi
k)^{2n+1}}=\frac{(-1)^{n+1}2^{2n}}{(2n+1)!}B_{2n+1}(x)\quad(0\leq x\leq 1).$
(54)

Here note $\lim_{\sigma^{2}\to 0}S_{1}=\lambda^{2}+\zeta^{2}-1/12$ and so
$s^{2}=\sigma^{2}-\lambda^{2}-\zeta^{2}+1/6+\mathcal{O}(\sigma^{-1})$ even
though $\Phi(\tau)=\mbox{sinc}(\\!\sqrt{3}\tau)\sim\tau^{-1}$ as
$\tau\to\infty$. Technically this is not a counter-example of the prior
discussion following equation (32), since $\mbox{sinc}(x)$ does not actually
have a proper asymptotic expansion as $x\to\infty$ in the strict sense. In
fact, we observe that, while the asymptotic behavior of $S_{0}$ as
$\sigma\to\infty$ follows that of $\Phi(\tau)$ as $\tau\to\infty$, the
behavior of $S_{1}$ actually traces $\tau\Phi^{\prime}(\tau)$ instead. With an
oscillatory $\Phi(\tau)$ due to $F(u)$ on a compact support,
$\tau\Phi^{\prime}(\tau)$ can indeed be much larger than $\Phi(\tau)$ even if
$\Phi(\tau)$ is bounded by an asymptotically decaying envelope, and so
$s^{2}-\sigma^{2}$ does not necessarily tend to $1/12$ unless
$\tau\Phi^{\prime}(\tau)\to 0$ as $\tau\to\infty$. By contrast, the formula
for $\langle s^{2}\rangle$ in equation (44) only involves
$|\tilde{\varphi}(2\pi k)|^{2}$ and we thus expect the asymptotic behavior of
the remainder $\sigma^{2}+1/12-\langle s^{2}\rangle$ to trace that of
$|\Phi(\tau)|^{2}$ in general.

In order to average the expresseions in equations (52) and (53) over
$\chi\in[-1/2,1/2]$, we first observe that $\zeta=\xi/2\geq 0$ or
$\zeta=(\xi-1)/2<0$ (where $0\leq\xi<1$ is still the fractional part of
$2\\!\sqrt{3}\sigma$). Next $\Delta_{\pm}=\lambda\pm\zeta+1/2\in[0,1)$ implies
$\lambda\in[-1/2+\zeta,1/2-\zeta)=[(\xi-1)/2,(1-\xi)/2)$ for $\zeta\geq 0$ and
$\lambda\in[-1/2-\zeta,1/2+\zeta)=[-\xi/2,\xi/2)$ for $\zeta<0$. Finally
$\lambda=\chi\pm\frac{1}{2}$ or $\chi$ depending on the parity of
$m_{+}+m_{-}$ and we find that $\chi\in[-1/2,1/2]$ at fixed $\sigma$ (and
consequently $\xi$ is also fixed) then maps to the union of those two allowed
intervals on $\lambda$. Consequently averaging over $\chi\in[-1/2,1/2]$ is
achieved through summing two integrals on $\lambda$: viz.

$\begin{split}\langle
S_{0}^{2}\rangle&=\int_{\frac{\xi-1}{2}}^{\frac{1-\xi}{2}}\\!{\rm
d}\lambda\left.S_{0}^{2}\right\rvert_{\zeta=\frac{\xi}{2}}+\int_{-\frac{\xi}{2}}^{\frac{\xi}{2}}\\!{\rm
d}\lambda\left.S_{0}^{2}\right\rvert_{\zeta=\frac{\xi-1}{2}}\\\
&=\frac{2}{3\sigma^{2}}\left[\frac{\xi^{2}}{4}\int_{0}^{\frac{1-\xi}{2}}\\!{\rm
d}\lambda\,\lambda^{2}+\frac{(\xi-1)^{2}}{4}\int_{0}^{\frac{\xi}{2}}\\!{\rm
d}\lambda\,\lambda^{2}\right]\\\
&=\frac{2}{3\sigma^{2}}\left[\frac{\xi^{2}}{4}\frac{(1-\xi)^{3}}{24}+\frac{(\xi-1)^{2}}{4}\frac{\xi^{3}}{24}\right]=\frac{\xi^{2}(1-\xi)^{2}}{144\sigma^{2}},\end{split}$
(55)

which recovers equation (50). Since $S_{0}$ is an odd function of $\lambda$,
it is immediately obvious that $\langle S_{0}\rangle=0$. As for $\langle
S_{1}\rangle$, two respective integrals for $\zeta=\xi/2\geq 0$ and
$\zeta=(\zeta-1)/2<0$ exactly cancel each other and so $\langle
S_{1}\rangle=0$.

Since $\chi$ (i.e. the offset of the mean from an integer value) determines
both $\Delta_{\pm}$ (i.e. the offsets of the boundary points of the support
from integer values) once $\sigma$ (which specifies the width of the support)
is fixed, $\Delta_{+}$ and $\Delta_{-}$ are not in fact independent from each
other. Nevertheless it is still formally possible to consider $S_{0}$ in
equation (52) as a function of the pair of independent variables
$(\Delta_{+},\Delta_{-})\in[0,1)^{2}$ and average $S_{0}^{2}$ over this whole
rectangular domain. Following the coordinate transform
$(\Delta_{+},\Delta_{-})\rightarrow(\lambda,\zeta)$, the resulting average is
shown to be identical to further averaging the $\chi$-average of equation (55)
over $\zeta\in(-1/2,1/2)$ or equivalently $\xi\in[0,1)$. That is to say, if
one assume that both upper and lower boundaries of the compact support are
randomly placed relative to the integer values (and independent from each
other), the resulting expectation value (averaged over all possible such
placements) recovers only the “slow” asymptotic decay behavior of $\langle
s^{2}\rangle$ for the rounded random variables on a compact support while
averaging off the “fast” modulation due to the interference between the width
of the support and the integer signposts.

##  IV Normal distributions

Finally we would like to consider the case of $f(x)$ being the Gaussian normal
distribution:

$f(x)=\frac{1}{(2\pi)^{1/2}\sigma}\exp\biggl{[}-\frac{(x-\mu)^{2}}{2\sigma^{2}}\biggr{]},$
(56)

or in the standard form

$F(u)=\frac{e^{-u^{2}/2}}{\\!\sqrt{2\pi}},\quad\Phi(\tau)=e^{-\tau^{2}/2}.$
(57)

Then with $\tilde{\varphi}(t)=\Phi(\sigma t)$, we have

$\begin{split}S_{0}&=\sum_{k=1}^{\infty}\\!(-1)^{k}\sin(2\pi
k\chi)\,\frac{e^{-2(\pi\sigma k)^{2}}}{\pi k};\\\
S_{1}&=\sum_{k=1}^{\infty}\\!(-1)^{k}\frac{\cos(2\pi
k\chi)}{\pi^{2}}\,\left.\frac{d}{d\kappa}\biggl{(}\frac{e^{-2(\pi\sigma\kappa)^{2}}}{\kappa}\biggr{)}\right\rvert_{\kappa=k}\\\
&=\sum_{k=1}^{\infty}\\!(-1)^{k+1}\cos(2\pi k\chi)\,\frac{1+(2\pi\sigma
k)^{2}}{(\pi k)^{2}}e^{-2(\pi\sigma k)^{2}}.\end{split}$ (58)

Thanks to the super-exponential decay $\propto e^{-2(\pi\sigma k)^{2}}$ in $k$
(NB: the $k=2$ term is suppressed relative to the $k=1$ term by $\sim
e^{-6(\pi\sigma)^{2}}$: if $\sigma=1$, note $e^{-6\pi^{2}}\approx 2\times
10^{-26}$!), these sums (which are actually in the form of the _Jacobi theta
function_ and its antiderivatives) converge extremely quickly and are
completely dominated by their respective first terms unless $\sigma\ll 1$.
Alternatively we may construct a more formal argument by bracketing the
infinite sums following the integral convergence test. In particular, we first
observe that

$\begin{split}|S_{0}|&\leq\sum_{k=1}^{\infty}\frac{e^{-2(\pi\sigma
k)^{2}}}{\pi k}=I_{0},\\\ |S_{1}|&\leq\sum_{k=1}^{\infty}\frac{1+(2\pi\sigma
k)^{2}}{(\pi k)^{2}}e^{-2(\pi\sigma k)^{2}}=I_{1}\end{split}$ (59)

but the summands now are strictly decreasing positive functions of $k\geq 1$.
Hence the integral convergence test indicates

$\begin{split}\frac{E_{1}(2\pi^{2}\sigma^{2})}{2\pi}&\leq
I_{0}\leq\frac{e^{-2(\pi\sigma)^{2}}}{\pi}+\frac{E_{1}(2\pi^{2}\sigma^{2})}{2\pi},\\\
\frac{e^{-2(\pi\sigma)^{2}}}{\pi^{2}}&\leq
I_{1}\leq\frac{(2\pi\sigma)^{2}+2}{\pi^{2}}e^{-2(\pi\sigma)^{2}},\end{split}$
(60)

where $E_{1}(x)=\int_{1}^{\infty}\\!{\rm d}t\,e^{-tx}/t$ is the analytic
exponential integral. Note that $I_{0}$ for $\sigma=0$, which results in the
harmonic series, actually diverges and so the first bounds are only valid for
$\sigma>0$, but it has been already shown that $S_{0}=-\chi$ if $\sigma=0$.
Given the asymptotic expansion
$e^{x}E_{1}(x)\sim\sum_{k=0}^{\infty}(-1)^{k}k!/x^{k+1}$ as $x\to\infty$, the
first bounds may also be replaced by the purely elementary functions. In
particular, for $x>0$, we find

$e^{x}E_{1}(x)=\int_{1}^{\infty}\\!\frac{e^{x(1-t)}{\rm
d}t}{t}<\int_{1}^{\infty}\\!{\rm d}t\,e^{-x(t-1)}=\frac{1}{x},$ (61)

i.e. $E_{1}(x)<e^{-x}/x$ for $x>0$, and so follows that

$|S_{0}|\leq
I_{0}\leq\left[1+\frac{1}{(2\pi\sigma)^{2}}\right]\frac{e^{-2(\pi\sigma)^{2}}}{\pi}.$
(62)

That is to say, for a sufficiently large $\sigma$, both sums $I_{0}$ and
$I_{1}$ are completely dominated by their respective first terms, and
$S_{0}\sim\mathcal{O}(e^{-2(\pi\sigma)^{2}})$ and
$S_{1}\sim\mathcal{O}(\sigma^{2}e^{-2(\pi\sigma)^{2}})$ as $\sigma\to\infty$.
In conclusion, the mean $m$ and the variance $s^{2}$ of the rounded variables
drawn from the normal distribution (of the mean $\mu$ and the variance
$\sigma^{2}$) behave like

$\begin{split}m&\simeq\mu-\delta+\mathcal{O}(e^{-2(\pi\sigma)^{2}});\\\
s^{2}&\simeq\sigma^{2}+\frac{1}{12}+\mathcal{O}(\sigma^{2}e^{-2(\pi\sigma)^{2}}),\end{split}$
(63)

as $\sigma\to\infty$, but the remainder in most practical purposes can be
safely ignored provided $\sigma\gtrsim 1$ (NB: $e^{-2\pi^{2}}/\pi\approx
8.5\times 10^{-10}$).

As for the expectation value averaged over $\mu$ at fixed $\sigma^{2}$, if we
consider the sum

$\langle S_{0}^{2}\rangle=\sum_{k=1}^{\infty}\frac{e^{-(2\pi\sigma
k)^{2}}}{2(\pi k)^{2}},$ (64)

the integral test is still applicable:

$\int_{1}^{\infty}\\!\frac{e^{-(2\pi\sigma x)^{2}}{\rm d}x}{2(\pi
x)^{2}}\leq\langle
S_{0}^{2}\rangle\leq\frac{e^{-(2\pi\sigma)^{2}}}{2\pi^{2}}+\int_{1}^{\infty}\\!\frac{e^{-(2\pi\sigma
x)^{2}}{\rm d}x}{2(\pi x)^{2}}.$ (65)

While here the integral is technically reducible to the incomplete gamma
function (or an expression involving the error function), it is sufficient for
our purpose to note

$e^{a}\\!\int_{1}^{\infty}\\!\frac{e^{-ax^{2}}{\rm
d}x}{x^{2}}=\int_{0}^{\infty}\\!\frac{e^{-at}{\rm
d}t}{2(t+1)^{3/2}}<\int_{0}^{\infty}\\!\frac{e^{-at}{\rm d}t}{2}=\frac{1}{2a}$
(66)

for $a>0$. Hence it follows that, for $\sigma>0$,

$\displaystyle\langle S_{0}^{2}\rangle=\sigma^{2}+\frac{1}{2}-\langle
s^{2}\rangle\leq\left[\frac{1}{2}+\frac{1}{(4\pi\sigma)^{2}}\right]\frac{e^{-(2\pi\sigma)^{2}}}{\pi^{2}};$
(67) $\displaystyle\therefore\ \langle
s^{2}\rangle\simeq\sigma^{2}+\frac{1}{12}+\mathcal{O}(e^{-(2\pi\sigma)^{2}})$
(68)

with an even faster-decaying (cf. $e^{-(2\pi)^{2}}/\pi^{2}\approx 7.2\times
10^{-19}$) remainder term. In summary, the rounding errors for the normally
distributed random variables can for most practical applications be considered
as independent from the intrinsic dispersion unless the intrinsic dispersion
itself is quite smaller than the rounding unit.

## References

  * Tricker (1984) A. R. Tricker, “Effects of Rounding on the Moments of a Probability Distribution,” The Statistician. 33, 381-390 (1984)
  * Olver et al. (2010) F. W. J. Olver, D. W. Lozier, R. F. Boisvert, C. W. Clark, “NIST Handbook of Mathematical Functions,” (Cambridge Univ. Press, Cambridge. 2010) (http://dlmf.nist.gov)


# A Customisable Underwater Robot

Guido Schillaci
Adaptive Systems Group
Computer Science Department
Humboldt-Universität zu Berlin
<EMAIL_ADDRESS>Fabio Schillaci
Digital Designer and Architect
http://www.schillaci.org
<EMAIL_ADDRESS>Verena V. Hafner
Adaptive Systems Group
Computer Science Department
Humboldt-Universität zu Berlin
<EMAIL_ADDRESS>
###### Abstract

We present a model of a configurable underwater drone, whose parts are
optimised for 3D printing processes. We show how - through the use of
printable adapters - several thrusters and ballast configurations can be
implemented, allowing different maneuvering possibilities.

After introducing the model and illustrating a set of possible configurations,
we present a functional prototype based on open source hardware and software
solutions. The prototype has been successfully tested in several dives in
rivers and lakes around Berlin.

The reliability of the printed models has been tested only in relatively
shallow waters. However, we strongly believe that their availability as freely
downloadable models will motivate the general public to build and to test
underwater drones, thus speeding up the development of innovative solutions
and applications.

The models and their documentation will be available for download at the
following link:

https://adapt.informatik.hu-berlin.de/schillaci/underwater.html.

##  I Introduction

Underwater robots are tipically classified into two categories: Autonomous
Underwater Vehicles (AUVs) and Remotely Operated Vehicles (ROVs). AUVs are
unmanned, self-propelled vehicles that can operate autonomously of a host
vessel, which makes them well suited to exploration of extreme environments
[1]. A continuous development of new vehicles and sensors, and advances in
artificial intelligence are increasing the range of AUVs applications [2].
However, their high cost and the know-how required to develop them makes their
adoption prohibitive to the general public.

Remotely operated underwater vehicles are mobile devices commonly used in deep
water industries. ROVs are usually connected to a surface vessel through a
tether and controlled by an operator, which makes them more reliable and less
prone to failures than AUVs. Similarly to AUVs, professional ROVs are
tipically very expensive.

However, thanks to the rapid growth of opensource software and hardware
communities, and thanks to their experience in the development of flying
drones, underwater teleoperated drone technology has recently become
accessible to a wider public. In fact, low-cost open-source solutions for
remotely operated vehicles (ROVs) can be found in the market since almost a
decade, such as OpenROV (opensource remotely operated vehicle
111https://www.openrov.com/) and BlueRov2 (an opensource ROV kit produced by
BlueRobotics 222 https://www.bluerobotics.com/).

Not surprisingly, research institutes and do-it-yourself communities exhibited
a growing interest in the adoption of opensource underwater drones for many
applications [3]: from underwater exploration to marine science, archeology
and marine geoscience; from diving to fishing; from boating to harbour and
boat maintenance and support; from garbage collection to operation in
hazardous environment.

Figure 1: A screenshot of a 3-thrusters prototype.

Similarly to flying drones, low cost underwater vehicles are usually equipped
with cameras and basic sensing capabilities (e.g. inertial measurement unit,
depth sensor, etc.), and are teleoperated from the surface. Underwater
propulsion is achieved through propellers, whose number and configuration
(e.g. with fixed or changing orientation) define the degrees of freedom of the
movements that the drone can perform underwater. A conventional procedure in
ROVs/AUVs design is to make vehicles positively buyoant to ensure they will
return to the surface, should any power failure occurs. Moreover, low-cost
ROVs adopt fixed ballast - achieved through lead, buoyancy chambers and
syntactic foam - to have the desired gravity. Under a fixed ballast
configuration, ascend and descend movements are achieved using vertical
thrusters. Variable ballast can surely represent a better solution, as it does
not require thusting upwards/downwards, however at the expense of higher
cost/complexity of the vehicle.

The electronics of underwater vehicles are enclosed into watertight containers
that prevent water infiltration and, consequently, damage to the components.
Propellers are usually connected to the watertight enclosure through cables
and cable glands to ensure watertight connection to the inner electronics. To
reduce the risks of water infiltration due to high water pressure when using
cable glands, other solutions have been tested, such as using magnetic
coupling to move the propellers using motors positioned inside the watertight
enclosure [4].

The components required to build watertight enclosures and connections -
together with the electronic components - usually represent a consistent
portion of the total cost of the ROV/AUV equipment. Nonetheless, designing and
building external components - which includes, for instance, propellers,
ballast and waterdynamic configurations - is not a minor, nor cheap task in
underwater drones development.

In this paper, we propose an opensource solution for rapid prototyping and
customisation of underwater drones. In section II, we present 3D-printable
models that are compatible with hardware components available in the low-cost
underwater drones market (i.e. BlueRobotics and OpenROV) and that can be used
to easily customise propellers, ballast and waterdynamic configurations, thus
reducing the total cost of the final product. Therefore, we present an
implementation of a functional prototype (section III) that uses the proposed
models. Finally, we describe the hardware (section III-A) and the software
solutions (section III-B) that we adopted in the functional prototype.

##  II A customisable underwater drone

As of today, several models of ROV parts can be found online, for instance
those provided by BlueRobotics. Unfortunately, such models are usually either
not optimal for 3D-printing (e.g. walls around screwing holes are thin and
thus prone to breakage when mounting the parts) or not modular enough to
easily customise the drone configuration without having to buy additional
components.

In this work, we present a model for a customisable underwater robot for
marine research that addresses these issues. The 3D-models presented here are
realeased under an open source license and are available for download at the
following link: https://adapt.informatik.hu-
berlin.de/schillaci/underwater.html. In the development of these models, we
took inspiration from the T100/T200 thruster models and on the enclosure clamp
model for watertight tubes developed by BlueRobotics 333The original models
from BlueRobotics are available at the following link:
https://github.com/bluerobotics/bluerobotics.github.io..

The original thruster consists of three plastic parts, plus a propeller to be
mounted on the motor. A mounting bracket is provided as a separate model.
Initially, we tested printing such models using an Ultimaker 2 3D printer.
However, the models are unfortunately not optimal for rapid prototyping
techniques. In fact, we could not find any printer configuration - including
solid infill and high quality 0.06 mm layer height - that prevented damages of
the plastic while mounting them together using screws, as walls around holes
are too thin. It is very likely that such models have been developed for being
produced using other techniques, such as injection molding, rather than rapid
prototyping through 3D-printers. Moreover, holes in 3D-printed parts can
become stripped very quickly, already after a few times bolts are screwed in
and unscrewed out. Mounting parts together using nuts and bolts would prevent
this, but this option was not possible with the original models provided by
BlueRobotics.

Therefore, we re-designed the models - in particular the ones composing the
thruster and the enclosure clamp - and optimised them for 3D printing
techniques. In particular, we increased the thickness of most of the model
parts and we introduced mounting structures that allow using nuts and bolts.
We designed an adapter for mounting a cheap Turnigy DST-700 brushless motor
(priced in several online stores for <10 EUR) onto the Bluerobotics T200
propeller, which has been specifically designed for the more expensive (priced
ca. 80 EUR), although more resistant to corrosion, M200 motor. The new design
of the thruster uses a different configuration of the holes that allow easy
fastening using M2.5 and M3 nuts and bolts. Moreover, we added mounting points
onto the thruster and onto the enclosure clamp models, so that they can be
easily mounted together at different positions, as illustrated in Figure 2.

Figure 2: The enclosure clamp is provided with 4 mounting points (+90°,
+135°and -90°, -135°. This illustration shows an exploded model of a thruster
to be mounted on the +90°point.

We designed also three adapters that allow to change the orientation of a
thruster or to split a mounting point into two, as depicted in Figure 3. For
instance, Figure 4 shows a thurster to be mounted in a vertical configuration
using a 90°adapter.

The split adapter can significantly increase the number of possible
configurations, if adopted in combination with the 90°adapter. Figure 5 shows
a combination of three adapters for mounting a vertical thruster and a
45°horizontal thurster onto the same mounting point at the enclosure clamp.
Moreover, we designed a rotation adapter that allow five different
orientations of a thruster within 90°.

Figure 3: The three adapters that allow setting different orientations of the
thursters and ballast. Figure 4: The 90°adapter can be used to mount a
vertical thurster onto the enclosure clamp. Figure 5: The split adapter can be
used to split a mounting point into two. In the figure, a combination of split
and 90°adapters is used to mount a vertical and a 45°horizontal thrusters onto
the same mounting point in the enclosure clamp. Figure 6: A rotation adapter
provides five possible orientations within 90°.

As mentioned in the previous section, in low-cost ROVs characterised by fixed
ballast, ascend and descend movements are commonly achieved using vertical
thrusters. A conventional procedure is to make vehicles positively buyoant to
ensure they will return to the surface, should any power failure occurs. We
designed a particular cylindrical structure that can be filled with steel
balls or syntactic foam, in order to allow the user to set the desired
buyoancy to the drone. A ballast cylinder is divided into two compartments,
should precise settings of the center of mass are needed.

Figure 7: Horizontal view of a setup where four ballast cylinders are used
mounting a split adapter onto the +135°mounting point and a split adapter onto
the -135°mounting point of the enclosure clamp. Figure 8: Frontal view of a
setup where four ballast cylinders are used mounting two split adapters onto
the +135°mounting point and two split adapters onto the -135°mounting point of
the enclosure clamp.

The ballast cylinder has the same mounting structure of the thurster, so that
it can be mounted onto the same mounting points depicted above. Figure 7 and 8
show an example where four ballast cylinders are mounted onto the +135°and
-135°mounting points of the anterior enclosure clump.

The adapters, thrusters and ballasts can be mounted together using standard M3
nuts and M3-30mm bolts.

The parts described above allow multiple frame configurations, each providing
different maneuvering possibilites and degrees of freedom for the drone
movements. Figure 9 shows perhaps the simplest setup with a 3 thrusters frame
configuration. Here, two horizontal thrusters allow for forward/backward
movements and yaw rotations (left and right turns). A vertical thruster
mounted onto the tail mounting point of the drone provides pitch rotation
possibilities (nose up and nose down movements). As the only vertical thruster
is placed far away from the center of mass of the robot, ascent and descend
movements are not possible with such a configuration.

Although ballast weights can be mounted to adjust the position of the center
of mass, if ascend and descend movements are required, additional vertical
thrusters can be mounted onto the posterior enclosure clamp (see Figure 10) or
onto a split adpater at the anterior enclosure clamp together with a
45°thruster (as in the vectored frame configuration depicted in Figure 11).
This configuration may still require adjustments of the center of mass
position through ballast, which can be plugged at the bottom of the posterior
clamp or at the tail mounting point.

The vectored frame configuration depicted in Figure 11 allows for full control
on the robot: forward, backward and lateral movements; ascend and descend
movements; yaw and roll rotations.

Figure 9: Underwater drone with a 3-thrusters frame configuration. Figure 10:
The drone with a 4-thrusters frame configuration. Vertical propellers are
closer to the center of mass, allowing ascend and descent movements. Figure
11: Vectored 6-thrusters frame configuration. This configuration allows for
better control on the robot: forward, backward and lateral movements; ascend
and descend movements; yaw and roll rotations.

##  III A functional prototype

In this section, we present an implementation of a functional prototype using
a three thrusters frame configuration, as depicted in Figure 9. Section III-A
describes the electronics of the drone. In section III-B we describe the
software adopted for controlling the robot. We carried out several dives in
different lakes and rivers around Berlin. Figure 12 shows the drone emerging
from a dive in the Dahme river in Köpenick, Berlin.

Figure 12: A picture of the drone during a dive in the Dahme river in
Köpenick, Berlin.

###  III-A Hardware description

We adopted low-cost and opensource, when available, solutions for implementing
the electronics of the drone. In particular, we set up a Raspberry Pi 3 model
B - equipped with a Quad Core 1.2GHz Broadcom BCM2837 64bit CPU and 1GB RAM -
as a companion computer to an opensource flight controller, namely PX4
Pixhawk, sold by mRobotics. Pixhawk is an open-hardware project aiming at
providing high-end autopilot hardware to the public at low costs
444https://pixhawk.org/. The board is equipped with several sensors, including
a gyroscope, an accelerometer, a magnetometer and a barometer.

We installed three Turnigy DST-700 brushless motors, each initially connected
to the Pixhawk flight controller through a N-channel MOSFET Afro 12A
Electronic Speed Controller, which provides PWM control of the motor speed. As
we experienced a damage in a ESCs connected to a propeller that was put too
much under torque stress, we opted for mounting Afro 20A ESCs instead of 12A
ones.

A Turnigy 5000mAh 4S 25C Lipo Battery Pack is adopted to power the system.
Power is distributed to the ESCs through a Matek power distribution board, to
the Pixhawk through a mRobotics Power Module and to the Rasperry Pi through a
5V 3A Switching Power UBEC.

A Raspberry Pi V2.1, 8 MP 1080P camera module is installed on the Rapsberry Pi
to stream HD videos to the surface computer. A Lisiparoi low-light led module
is installed onboard. The drone is connected to a surface computer through a
25 meters neutrally buyoant RJ45 tether which provides data communication. The
user can teleoperate the drone using a game controller. We tested a XBox360
controller and a ASUS TV500BG Bluetooth gamepad. Cheap cardboard VR goggles
has been used to stream the video recorded from the Raspberry Pi camera onto a
smartphone to ease the teleoperation of the drone.

Electronics need to be put into a watertight container. We acquired a 4”
watertight enclosure, a compatible aluminium end cap and a glass dome cap, and
o-ring sealed flanges from the BlueRobotics online store. Motor power cables
and tether are inserted into the watertight enclosure though cable penetrators
and sealed through J-B Marine Weld marine epoxy. We acquired also a
BlueRobotics waterproof switch that allows turning on/off the drone without
the need of opening the watertight enclosure. The switch is connected upstream
to the electronics. A pressure valve has been installed for vacuum seal tests
and for simplifying opening/closing the watertight enclosure.

We acquired also a BlueRobotics Bar30 high resolution waterproof pressure and
temperature sensor. The sensor comes in a watertight penetrator, thus it can
be safely used and connected into the Pixhawk board.

###  III-B Software description

We rely entirely on open-source software solutions for controlling the drone.
In particular, we adopted Raspian as operating system for the Raspberry Pi
555https://www.raspberrypi.org/downloads/raspbian/ and we installed ArduSub
666https://www.ardusub.com/ onto the PX4 Pixhawk. ArduSub is a fully-featured
open-source solution for remotely operated underwater vehicles, initially
developed by BlueRobotics as derived from the ArduCopter code, now is part of
the ArduPilot project. ArduSub has several pre-installed functionalities,
including feedback stability control, depth and heading hold, and autonomous
navigation using pre-coded trajectories.

MAVlink is adopted as a communication protocol. QGroundControl is installed
into the surface computer, tablet or smartphone for providing dive control and
mission planning to the drone. QGroundControl, initially developed as the
control station software for the Pixhawk Project, is an open-source
application used at several research centers and by a growing communitiy
777http://qgroundcontrol.org/about for control of flying, terrestrial and
underwater drones.

Finally, the open source SimonK firmware 888https://github.com/sim-/tgy has
been compiled and deployed onto the Afro ESCs using an Afro USB programming
tool, in order to allow forward/reverse rotations of the propellers and to
match the parameters configured in ArduSub.

##  IV Conclusions

In this paper, we presented open source models for building low-cost
underwater drones and for customising their thrusters and ballast
configurations. The models are optimised for rapid prototyping through 3D
printers.

After introducing the different parts and adapters that can allow for multiple
frame configurations and, thus, different grades of maneuverability, we
presented a functional prototype. In particular, we built a three-propellers
underwater drone based on open source hardware and software solutions. The
prototype has been successfully tested several times in dives near Berlin.

Although the reliability of the 3D printed parts have been tested only in
relatively shallow waters (<10 meters), we strongly believe that making them
freely available online will motivate the general public to build and to
experiment with underwater drones, and consequently speed up the development
of innovative solutions and applications.

Nonetheless, we are planning to carry out further tests in deeper waters and
under different frame configurations. Moreover, we are currently exploring
possibilities for autonomous learning of robot control strategies.

## References

  * [1] R. B. Wynn, V. A. Huvenne, T. P. L. Bas, B. J. Murton, D. P. Connelly, B. J. Bett, H. A. Ruhl, K. J. Morris, J. Peakall, D. R. Parsons, E. J. Sumner, S. E. Darby, R. M. Dorrell, and J. E. Hunt, “Autonomous underwater vehicles (auvs): Their past, present and future contributions to the advancement of marine geoscience,” _Marine Geology_ , vol. 352, pp. 451 – 468, 2014, 50th Anniversary Special Issue. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S0025322714000747
  * [2] J. J. Leonard and A. Bahr, _Autonomous Underwater Vehicle Navigation_. Cham: Springer International Publishing, 2016, pp. 341–358.
  * [3] B. Siciliano and O. Khatib, _Springer handbook of robotics_. Springer, 2016.
  * [4] H. Hanff, P. Kloss, B. Wehbe, P. Kampmann, S. Kroffke, A. Sander, M. von Einem, J. F. Bode, F. Kirchner, and M. B. Firvida, “Auvx-a novel miniaturized autonomous underwater vehicle,” _Oceans’17 MTS/IEEE_ , 2017.