The characteristic function of a normal random variable with mean $\mu$ and standard deviation $\sigma$ is:
$$\begin{alignat*}{1} \hat{\phi}(t) & =e^{i\mu t}e^{-\frac{1}{2}\sigma^{2}t^{2}}\\ & =\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}) \end{alignat*}$$
What I want to do is to plot the PDF of the normal random variable knowing only the characteristic function outlined above $\hat\phi(t)$. Ideally the solution to this problem would be to apply the Inverse Fourier Transform on $\hat\phi(t)$ and then plot the result for different values of $x$. Applying the Inverse Transform leads me to solve this integral to get the PDF of $x$:
$$\begin{alignat*}{1} f(x) & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2})\exp(- itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}- itx)dt \end{alignat*} $$
The problem is that I do not know how to do it in R. I could use the integrate()
function, but how do I treat the imaginary unit $i$?