Solution (source code)

= Solution

Reality of the <electron density> implies $F(-h)=F(h)^*$. Writing $F(h)=|F(h)|e^{i\phi_h}$ and pairing positive and negative indices gives
$$
\rho(x)=F(0)+2\sum_{h=1}^\infty |F(h)|
\cos(2\pi hx-\phi_h).
$$
The sign in the cosine follows from the supplied negative-sign Fourier-synthesis convention. $F(0)$ is the mean <electron density> in the fractional-coordinate normalization.