Solution (source code)

= Solution

Normalizability requires $\operatorname{Re}B>0$. Since
$$
|\psi|^2=|A|^2e^{-(B+B^*)x^2},
$$
the given Gaussian <integral> gives
$$
\boxed{\langle \hat x^2\rangle
=\frac1{2(B+B^*)}
=\frac1{4\operatorname{Re}B}}.
$$
Also $\psi_x=-2Bx\psi$, so integration by parts yields
$$
\langle\hat p^2\rangle
=\hbar^2\int|\psi_x|^2dx
=4\hbar^2|B|^2\langle x^2\rangle.
$$
Therefore
$$
\boxed{\langle\hat p^2\rangle
=\frac{\hbar^2|B|^2}{\operatorname{Re}B}}.
$$
These are the <second moments of a complex Gaussian wave packet>.