Time Evolution of the
Harmonic Oscillator

Explanation

Hamilton-Function for a particle in a static potential

H  =  - ((p^2)/(2 m))   +   V(
              x) ;      (V(x) = (Subscript[V, 0]) for  |x| ≤  a;  0 otherwise)

Schrödinger-Equation 

\(TraditionalForm\`\(-\(h\&~\^2\/\(2\ m\)\)\)\ d\^2\/dx\^2\) Ψ(x)  +  V(x) Ψ(x)  =  E Ψ(x) 

dimensionsless quantities

x       =    ξ   (Subscript[x, 0])
\(TraditionalForm\`x\_0\ \ \ \  = \ \((h\&~\^2\/\(2\ m\^2 | V\_0 | \))\)\^\(1/2\)\)
E       =  ϵ  Abs[(Subscript[V, 0]) ]
σ        =  
        sign((Subscript[V, 0]))

\(TraditionalForm\`Φ(ξ)\  = \ Ψ(ξ\ x\_0)\)

Schrödinger-Equation

-\(TraditionalForm\`Φ'' \((ξ)\) + \ σ\ \ \(Θ(\(|\)\(ξ\)\(|\)\(-α\))\)\ \ \(Φ(ξ)\)\ \ \  = \ \ \ ϵ\ \ \ \(Φ(ξ)\)\) ;

Discretization

ξ → (Subscript[ξ, j]) := j Δ + (Subscript[ξ, 0]);    j=1,2,..,n;  Δ = ((Subscript[ξ, max])-(Subscript[ξ, 0]))/n

Φ(ξ) → (Subscript[Φ, j]) := Φ((Subscript[ξ, j]))

- ((Subscript[Φ, j - 1])  -  
                2  (Subscript[Φ, j])  +  (Subscript[Φ, j + 1]))/(Δ^2)+ σ Θ(|(Subscript[ξ, j])|-α) \(TraditionalForm\`Φ\_j\ \  = \ ϵ\ \ Φ\_j\)

Hamilton-Matrix

Definition

Clear["Global\.b4*"];
\(\(M[n_, ξ0_, ξ1_] := 
        Block[{a, Δ}, Δ = \ \((ξ1 - ξ0)\)/
              n; 
							a = 
            1/Δ\^2; 
							H = 
            Table[If[i == j, 
                2  a\  + \ \((ξ0\  + \ i\ Δ\ )\)^2, 
                If[Abs[i - j] == 1, \(-a\), 0]], {i, 1, n}, {j, 1, 
                n}]
						];\)\)

Meaning of Parameters:
n:		dimension of Hamilon-matrix
Δ:		step size of finte differences in spacial derivatives

Display Matrix

M[20, -2, 
        2]//MatrixForm

Dynamics

Definition:

\(\(OneStep[DM_, x_, Δ_, Φ_, n_, ξ0_] := 
        Block[{xmean, app, 
            yyy, }, 
										xmean = \ 
            x\  . Abs[Φ]^2/\((Abs[Φ]\  . 
                  Abs[Φ])\); 
										app\ \ \ \ \  = \ {{xmean, 
                0}, {xmean,  .1}}; 
										yyy\ \ \ \ \  = \ 
            Join[Transpose[{x, Abs[Φ]\^2}], 
              app]; 
										ListPlot[yyy, 
            PlotJoined -> True, 
            PlotRange -> {{ξ0, 
                  n\ Δ\  + \ ξ0}, {0,  .1}}]; 
										ϕ\ \ \ \ \ \ \ \ \  = 
            DM . Φ; 
										norm\ \  = \ \@\(Conjugate[ϕ] . ϕ\)\ ; 
										ϕ = \ ϕ/norm];\)
\)
\(\(dyn[n_, ξ0_, ξ1_, tmax_, dt_, x0_, σ_] := 
        Block[{nt = 
              tmax/dt, Δ = \((ξ1 - ξ0)\)/
                n}, 
									H = 
            M[n, ξ0, ξ1]; 
									x = 
            Table[ξ0\  + \ i\ Δ, {i, 1, 
                n}]; 
									xt\  = \ 
            Table[i\ dt, {i, 0, 
                nt - 1}]; 
									Φ = E\^\(-\(\((x - x0)\)\^2\/\(2\ σ\^2\)\)\)\ ; 
									norm\  = \ \@\(Conjugate[Φ] . Φ\); 
								\ \ \ \ \ \ \ \ \ ϕ = \ ϕ/norm; 
									DM = 
            MatrixExp[I\ dt\ H]; 
									xm\  = \ 
            xt; 
									Table[
										xm[\([i]\)]\ \  = \ \ x\  . 
                Abs[Φ]^2; 
										Φ = 
              OneStep[DM, x, Δ, Φ, 
                n, ξ0]\ ;\ , {i, 1, 
              nt}]; 
									p1 = 
            ListPlot[Transpose[{xt, xm}], 
              PlotRange -> {{0, 
                    tmax}, {ξ0, ξ1}}]; 
									p2 = 
            Plot[\(-5\)\ Cos[2\ t], {t, 0, 
                10}]; 
									Show[{p1, 
              p2}];
								];\)
\)

Meaning of parameter:
n:		dimension of Hamilon-matrix
		in DynExact only needed for plot-resolution
Δ:		step size of finte differences in spacial derivatives
tmax:		time-evolution up to time tmax
dt:		time-steps for plot
x0:		center of initial gaussian wave-package
σ:		width of initial gaussian wave-package
Mmax:		max # of states included in spectral theorem

Time-evolution of gaussian wave-package

dyn[n = 200, ξ0 - 10, ξ1 = 10, tmax = 10, dt =  .05, 
      x0 = -5, σ0 = 1]