# Harmonic Oscillator

Usually, when one looks at the quantum harmonic oscillator, only the stationary states are studied (we will look at them in the next chapter). Here, we are going to take a look at some really nice dynamic examples. We are going to take the same wave packet described in the previous sections and place it in a harmonic oscillator potential:

$$
V(x) = \frac{1}{2}\omega^2x^2
$$

We present below two animations with slighly different initial conditions. Both of them start at the center of the domain with a momentum of 50 (dimensionless units). The only difference between the packets is their initial width. The first one has the same with as the ground state of the harmonic oscilattor, while the second has a random one.

```
Numerical Domain
xmin = -3
xmax =  3
Nx = 3000
CFL = 0.125
Nt = 320000

CASE 1
Initial Conditions for the quasi-classical state
omega = 12.5d0*pi
p0 = 50.0d0
psi = (omega/pi)**0.25 *exp(-0.5*omega*x**2)*exp(cmplx(0.0d0,p0*x))

CASE 2
Initial Conditions for the different wave packet
omega = 12.5d0*pi
p0 = 50.0d0
psi = (omega/pi)**0.25 *exp(-1.0*omega*x**2)*exp(cmplx(0.0d0,p0*x))
```

Below is the evolution of the first case. We can see that the wave packet moves from one side to the other of the domain. It can also be seen that the wave lenght of the oscilations inside the packet changes over time. When the packet is the center of the domain, the wave length is really small (the function oscillates many times); and when the packet is at one of the return points, the wavelength is infinite (no nodes are visible), indicating that it has no momentum. An amazing fact is that the expectation values of the position and momentum operators follow the same trajectory that a classical particle would follow under the same conditions. The uncertainties on position and momentum are also constant and their produc is exactly 0.5.

<figure><img src="/files/hyWTouEq1M2xs6VXMUbL" alt=""><figcaption></figcaption></figure>

Bellow is the evolution of the second case. this wave packet also follows the same trajectory, however, its width changes over time. It is thiner on the center of the domain and wider at the return points.

<figure><img src="/files/lIoVdSUc32jFWFaEF0df" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://servicio-social.gitbook.io/computational-physics/time-dependent-schrodinger-equation/harmonic-oscillator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
