Solution (source code)

= Solution

Use the angular-frequency <Fourier transform>
$$
\widehat f(k)=\int_{-\infty}^{\infty}f(x)e^{-ikx}\,dx.
$$
Then
$$
\boxed{\widehat f(k)=A\int_{-1}^{1}e^{-ikx}\,dx
=2A\frac{\sin k}{k}},
$$
with the continuous value $\widehat f(0)=2A$.

The <convolution> $(f*f)(x)$ is $A^2$ times the length of the overlap of the intervals $[-1,1]$ and $[x-1,x+1]$. Thus
$$
\boxed{(f*f)(x)=
\begin{cases}
A^2(2-|x|),&|x|\le2,\\
0,&|x|>2.
\end{cases}}
$$

The <convolution theorem> states, for this convention, that
$$
\widehat{u*v}(k)=\widehat u(k)\widehat v(k).
$$
Since $g=(B/A^2)(f*f)$, it follows that
$$
\boxed{\widehat g(k)
=4B\left(\frac{\sin k}{k}\right)^2},
$$
again interpreted continuously at $k=0$, where $\widehat g(0)=4B$.