Quantum Harmonic Oscillator Virial theorem is not holding I'm asked to calculate the average Kinetic and Potential Energies for a given state of a quantum harmonic oscillator. The state is:
$$
\psi(x,0) = \left(\dfrac{4m\omega}{\pi\hbar}\right)^\frac{1}{4}e^{\frac{-2m\omega}{\hbar}x^2}
$$
The thing is, calculating
$\langle T\rangle=\int_{-\infty}^{\infty}\psi(x)(-i\hbar)^2\frac{d^2}{dx}\psi dx=\left(\dfrac{4m\omega}{\pi\hbar}\right)^\frac{1}{2}\int_{-\infty}^{\infty}e^{\frac{-4m\omega}{h}x^2}dx-\left(\dfrac{4m\omega}{\pi\hbar}\right)^\frac{1}{2}\int_{-\infty}^{\infty}x^2e^{\frac{-4m\omega}{h}x^2}dx=\hbar\omega$
Where I used that the momentum operator is $p=-i\hbar\frac{d}{dx}$
$\langle V\rangle=\dfrac{m\omega^2}{2}\left(\dfrac{4m\omega}{\pi\hbar}\right)^\frac{1}{2}\int_{-\infty}^{\infty}x^2e^{\frac{-4m\omega}{h}x^2}dx=\dfrac{\hbar\omega}{16}$
But then the Virial Theorem is not satisfied. I've read the virial theorem holds for any bound state and all states in a Quantum Harmonic Oscillator are bound. Can someone point out where I am going wrong?
Thank you
 A: The ground state of the harmonic oscillator is (see Wikipedia for example): $$\psi_0(x) = \left(\frac{\alpha}{\pi}\right)^{1/4} e^{-\alpha x^2/2},\quad \quad \text{where }\quad \alpha =\frac{ m \omega}{\hbar}$$
Your math is correct, it's just that the state you have is not a bound state of the harmonic oscillator, the parameters are slightly off. If you use the state provided above, you can indeed show that: $$\langle T \rangle = \frac{\hbar \omega}{4} = \langle V \rangle.$$
A: You can have Gaussian fields that are not eigenstates, but then they are not time independent -- and time independence is the  essential  element of the virial theorem. For example, the harmonic oscillator   time-dependent Schrödinger equation
$$
i\frac{\partial \psi}{\partial t} = -\frac 12 \frac {\partial^2 \psi}{\partial x^2} +\frac 12 \omega^2  x^2 \psi
$$
has a time-dependent  solution
$$
\psi(x,t)= \left(\frac{\omega}{\pi}\right)^{1/4}\frac 1{\sqrt{e^{i \omega  t} +R e^{-i\omega   t}}}\exp\left\{ - \frac \omega 2    \left(\frac{1-R\,e^{-2i\omega   t}}{1+R\,e^{-2i\omega  t}}\right)x^2\right\},
$$
where the parameter $|R|<1$. Only if $R=0$ are  its $x$ and $p$ distributions time independent. If $R\ne 0$ the gaussian "breathes" in and out. Your wavefunction is a snapshot of this one at some particular time.
Below is a visualisation of $|\psi(x,t)|^2$ (taking $\omega=1$) for different values of $R$, showing how the Gaussian "breathes". As you can see, as $R\to 0$, the probability distribution tends to not change as much.
                          
