Writing Fourier transform integral in terms of real-valued functions I am interested in the following integral.
$$ f(x,t) = \int \limits_{-\infty}^{\infty} \mathrm{d}k e^{-k^2}\left( e^{i(kx-pt-qk^2t)}+e^{i(kx+pt+qk^2t)} \right)$$
One way (for example, by using Mathematica) to solve it is in the following way.
$$ f(x,t) = \frac{\sqrt{\pi}}{2} \frac{(e^{-ipt}e^{\frac{ix^2}{-4i+4qt}}\sqrt{1-iqt}+e^{ipt}e^{\frac{-ix^2}{4i+4qt}}\sqrt{1+iqt})}{\sqrt{1+q^2t^2}} $$
I believe that $f(x,t)$ should be real valued, but it is not clear to me how to simplify given expression so that it consists only of real valued functions.
 A: The exponential term can be recast as $2cos(kx)cos(pt+qk^2t)$
a)$e^{ikx}=cos(kx)+isin(kx)$.  The rest of the integrand is a function of $k^2$, so integrating over the real line eliminates the $sin(kx)$ term.
b) $e^{-i(pt+qk^2t)}+e^{i(pt+qk^2t)}=2cos(pt+qk^2t)$.  Note the $sin$ terms cancel.
A: First observe that we have: $$\displaystyle e^{ix^2/(-4i+4qt)}$$ is the same as $$e^{ix^2(4qt+4i)/(16(q^2t^2+1))}$$ which then becomes $$e^{-4x^2/(16(q^2t^2+1))}e^{i4x^2qt/(16(q^2t^2+1))}$$
Similarly $$\displaystyle e^{-ix^2/(4i+4qt)}$$ really is just $$e^{4x^2/(16(q^2t^2+1))}e^{i4x^2qt/(16(q^2t^2+1))}$$
Next observe that $$\sqrt{1-iqt}=\left(\sqrt{1+q^2t^2}\right)e^{-i\theta}e^{-i\pi n}$$ where $\theta=2\arctan(qt)$. Similarly observe that $$\sqrt{1+iqt}=\left(\sqrt{1+q^2t^2}\right)e^{i\theta}e^{i\pi n}$$ with again $\theta$ as above.
At any rate we then have $f(x,t)= \displaystyle \frac{\sqrt{\pi}}{2\sqrt{1+q^2t^2}}\left[e^{-ipt}e^{i4x^2qt/(16(q^2t^2+1))}e^{-4x^2/(16(q^2t^2+1))}\sqrt{1+q^2t^2}e^{-i\theta}e^{-i\pi n}+e^{ipt}e^{-i4x^2qt/(16(q^2t^2+1))}e^{4x^2/(16(q^2t^2+1))}\sqrt{1+q^2t^2}e^{i\theta}e^{i\pi n}\right]$ which then reduces to:
$f(x,t)= \displaystyle \frac{\sqrt{\pi}}{2}\left[e^{-ipt}e^{i4x^2qt/(16(q^2t^2+1))}e^{-4x^2/(16(q^2t^2+1))}e^{-i\theta}e^{-i\pi n}+e^{ipt}e^{-i4x^2qt/(16(q^2t^2+1))}e^{4x^2/(16(q^2t^2+1))}e^{i\theta}e^{i\pi n}\right]$
This expression is absurd, thus let $$A=\frac{4x^2}{16(q^2t^2+1)}$$
We thus have: $$f(x,t)= \displaystyle \frac{\sqrt{\pi}}{2}\left[e^{-i(pt+\theta+\pi n)}e^{i4x^2qt/(16(q^2t^2+1))}e^{-A}+e^{i(pt+\theta+\pi 
 n)}e^{-i4x^2qt/(16(q^2t^2+1))}e^A\right]$$
I'll let you maybe take it from here using Euler's formula....lol. I'm sure there's a faster way of doing this...smh
A: The two parts of your answer are obviously a complex conjugate pair.
Let's just take one of the terms and double its real part:
$$\begin{align*}f(x,t) &= \frac{\sqrt{\pi}}{2} \frac{(e^{-ipt}e^{\frac{ix^2}{-4i+4qt}}\sqrt{1-iqt}+e^{ipt}e^{\frac{-ix^2}{4i+4qt}}\sqrt{1+iqt})}{\sqrt{1+q^2t^2}}\\
\\
&= \sqrt{\pi}\;\Re\left[\frac{e^{-ipt}e^{-\frac{x^2}{4}\frac{1}{1+iqt}}}{\sqrt{1+iqt}}\right]\\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt{1+q^2t^2}}\;\Re\left[\sqrt{1-iqt}\cdot e^{-ipt}e^{-\frac{x^2}{4}\frac{1-iqt}{1+q^2t^2}}\right] \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\Re\left[\sqrt{1-iqt}\cdot e^{-ipt}e^{-\frac{x^2}{4}\frac{-iqt}{1+q^2t^2}}\right] \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\Re\left[\sqrt{re^{i(\theta +2n\pi)}}\cdot e^{i\left(\frac{x^2}{4}\frac{qt}{1+q^2t^2}-pt\right)}\right] \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\Re\left[{\sqrt[4]{1+q^2t^2}e^{i(\theta/2 +n\pi)}}\cdot e^{i\left(\frac{x^2}{4}\frac{qt}{1+q^2t^2}-pt\right)}\right] \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt[4]{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\Re\left[e^{i\left(\frac{\theta}{2}+n\pi+\frac{x^2}{4}\frac{qt}{1+q^2t^2}-pt\right)}\right] \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt[4]{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\cos\left(\frac{\theta}{2}+n\pi+\frac{x^2}{4}\frac{qt}{1+q^2t^2}-pt\right) \\
\\
&= \dfrac{\sqrt{\pi}}{\sqrt[4]{1+q^2t^2}}e^{-\frac{x^2}{4}\frac{1}{1+q^2t^2}}\;\cos\left(\frac{\mathrm{arctan2}(-qt,1)}{2}+n\pi+\frac{x^2}{4}\frac{qt}{1+q^2t^2}-pt\right) \\
\\
\end{align*}$$
You can take $n=0$ for the principal value of the square root.  Or you can take $n=1$ and effectively just change the sign of the answer.
