<s>[INST] Trying to approximate $E[f(X)]$ - Woflram Alpha gives $E[f(X)] \approx \frac{1}{\sqrt{3}}$ but I get $E[f(X)] \approx 0$? Let $X \sim \mathcal{N}(\mu_X,\sigma_X^2) = \mathcal{N}(0,1)$. Let $f(x) = e^{-x^2}$. I want to approximate $E[f(X)]$.
Wolfram Alpha gives
\begin{align}
E[f(X)] \approx \frac{1}{\sqrt{3}}.
\end{align}
Using a Taylor expansion approach, and noting that $f''(0) = -2$, I get
\begin{align}
E[f(X)] &\approx f(\mu_X) + \frac{f''(\mu_X)}{2} \sigma_X^2 \\
& = f(0) + \frac{f''(0)}{2} \\
& = 1 + \frac{-2}{2} \\
& = 0.
\end{align}
Why does my approximation fail to match the Wolfram Alpha result? What can be done to fix it?
 [/INST] There's no need to "approximate" when you can derive the exact value of $\mathbb{E}[f(X)]$ . Let us apply the Law of the Unconscious Statistician (LoTUS) to obtain :
\begin{align*}
\mathbb{E}[f(X)] &= \int_{-\infty}^{+\infty} e^{-x^2} \cdot \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{x^2}{2}\right)~dx\\
&= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{3x^2}{2}\right)~dx\\
&= 2\int_0^{+\infty} \frac{1}{\sqrt{2\pi}} \cdot\frac{1}{\sqrt{6z}} e^{-z}~dz\\
&= \frac{2}{2\sqrt{3\pi}} \int_0^{+\infty} e^{-z} z^{\frac{1}{2} -1} ~dz\\
&=\frac{1}{\sqrt{3\pi}}\cdot \Gamma\left(\frac{1}{2}\right)\\
&= \frac{1}{\sqrt{3\pi}}\cdot \sqrt{\pi}\\
&= \frac{1}{\sqrt{3}}
\end{align*}
Hope this helps. :)
</s>