<s>[INST] Calculating the expectation value for kinetic energy $\langle E_k \rangle$ for a known wave function I have a wavefunction ($a=1nm$):
$$\psi=Ax\exp\left[\tfrac{-x^2}{2a}\right]$$
for which I already calculated the normalisation factor (in my other topic): 
$$A = \sqrt{\frac{2}{a\sqrt{\pi a}}} = 1.06\frac{1}{nm\sqrt{nm}}$$
What I want to know is how to calculate the expectation value for a kinetic energy. I have tried to calculate it analyticaly but i get lost in the integration:
\begin{align}
\langle E_k \rangle &= \int\limits_{-\infty}^{\infty} \overline\psi\hat{T}\psi \,dx = \int\limits_{-\infty}^{\infty} Ax \exp \left[{-\tfrac{x^2}{2a}}\right]\left(-\tfrac{\hbar^2}{2m}\tfrac{d^2}{dx^2}Ax \exp \left[{-\tfrac{x^2}{2a}}\right]\right)\,dx =\dots
\end{align} 
At this point I go and solve the second derivative and will continue after this: 
\begin{align}
&\phantom{=}\tfrac{d^2}{dx^2}Ax \exp \left[{-\tfrac{x^2}{2a}}\right] = A\tfrac{d^2}{dx^2}x \exp \left[{-\tfrac{x^2}{2a}}\right]= A\tfrac{d}{dx}\left(\exp \left[{-\tfrac{x^2}{2a}}\right]-\tfrac{2x^2}{2a}\exp \left[{-\tfrac{x^2}{2a}}\right]\right)= \\
&=A \left(-\tfrac{2x}{2a}\exp \left[{-\tfrac{x^2}{2a}}\right] - \tfrac{1}{a}\tfrac{d}{dx}x^2\exp \left[{-\tfrac{x^2}{2a}}\right]\right) = \\
&=A \left(-\tfrac{x}{a}\exp \left[{-\tfrac{x^2}{2a}}\right] - \tfrac{2x}{a}\exp \left[{-\tfrac{x^2}{2a}}\right] + \tfrac{x^3}{a^2}\exp \left[{-\tfrac{x^2}{2a}}\right]\right) = \\
&= A \left(-\tfrac{3x}{a}\exp \left[{-\tfrac{x^2}{2a}}\right] + \tfrac{x^3}{a^2}\exp \left[{-\tfrac{x^2}{2a}}\right]\right)
\end{align}
Ok so now I can continue the integration:
\begin{align}
\dots &= \int\limits_{-\infty}^{\infty} Ax \exp \left[{-\tfrac{x^2}{2a}}\right]\left(-\tfrac{\hbar^2}{2m} A \left(-\tfrac{3x}{a}\exp \left[{-\tfrac{x^2}{2a}}\right] + \tfrac{x^3}{a^2}\exp \left[{-\tfrac{x^2}{2a}}\right]\right)\right)\,dx = \\
&= \int\limits_{-\infty}^{\infty} -\frac{A^2\hbar^2}{2m}x\exp\left[-\tfrac{x^2}{2a}\right] \left(-\tfrac{3x}{a}\exp \left[{-\tfrac{x^2}{2a}}\right] + \tfrac{x^3}{a^2}\exp \left[{-\tfrac{x^2}{2a}}\right]\right) \,dx\\
&= \int\limits_{-\infty}^{\infty} \frac{A^2\hbar^2}{2m}\left(\tfrac{3x^2}{a}\exp \left[{-\tfrac{x^2}{a}}\right] - \tfrac{x^4}{a^2}\exp \left[{-\tfrac{x^2}{a}}\right]\right) \,dx\\
&= \frac{A^2\hbar^2}{2m} \underbrace{\int\limits_{-\infty}^{\infty}\left(\tfrac{3x^2}{a}\exp \left[{-\tfrac{x^2}{a}}\right] - \tfrac{x^4}{a^2}\exp \left[{-\tfrac{x^2}{a}}\right]\right) \,dx}_{\text{How do i solve this?}}=\dots\\
\end{align}
This is the point where I admited to myself that I was lost in an integral and used the WolframAlpha to help myself. Well I got a weird result. My professor somehow got this ($m$ is a mass of an electron) but I don't know how:
\begin{align}
\dots = \frac{\hbar^2}{2m}\cdot\frac{3}{2a} = \frac{3\hbar^2}{4ma} = 0.058eV
\end{align} 
Can anyone help me to understand the last integral? How can I solve it? Is it possible analyticaly (it looks like professor did it, but i am not sure about it)?
 [/INST] In your problem, you need integrals of kind : 
$I_{2n} = \int x^{2n} e^{- \large \frac{x^2}{a}} ~ dx$
Note first that $I_0 = (\pi)^\frac{1}{2} (\frac{1}{a})^ {-\frac{1}{2}}$
Now, it is easy to see that there is a reccurence relation between the integrals :
$$I_{2n+2} = - \frac{\partial I_{2n}}{\partial (\frac{1}{a}) } $$
For instance, 
$$I_2 = - \frac{\partial I_{0}}{\partial (\frac{1}{a}) } = \frac{1}{2}(\pi)^\frac{1}{2} (\frac{1}{a})^ {- \large\frac{3}{2}} = \frac{1}{2}(\pi)^\frac{1}{2} ~a^ {\large\frac{3}{2}}$$
$$I_4 = - \frac{\partial I_{2}}{\partial (\frac{1}{a}) } = \frac{3}{2} \frac{1}{2}(\pi)^\frac{1}{2} (\frac{1}{a})^ {- \large\frac{5}{2}} = \frac{3}{2} \frac{1}{2}(\pi)^\frac{1}{2} ~a^ {\large\frac{5}{2}}$$
A general formula is : 
$$I_{2n} = I_0 ~(2n-1)!! ~(\frac{a}{2})^n = \frac{(\pi)^\frac{1}{2}}{2^n} ~(2n-1)!! ~a^{n+\frac{1}{2}}$$
where $(2n-1)!! = (2n-1)(2n-3)......5.3.1$
</s>