The wavefunction for the state for a harmonic oscillator is computed by applying the raising operator times to the ground state. The expectation values of the dimensionless position and momentum operators raised to powers are also computed. The button allows you to toggle between the expectation values for the position operator and expectation values for the momentum operator.

Excited states of the harmonic oscillator can be computed by applying the raising operator to the ground state wavefunction . Applying the raising operator times gives an unnormalized . The wavefunction can be normalized by dividing by . One can also define a lowering operator . The position and momentum operator can be expressed in terms of and as and . The variable is dimensionless and is related to the physical distance by where is the mass of the oscillator and is the angular frequency.