Back to Blog

Quantum Well

Solving the time-independent Schrödinger equation for a finite square quantum well using numerical eigensystem methods. This notebook computes the first few bound-state energy levels and wavefunctions, and provides an interactive visualization.

JerryIJune 8, 2024
quantum-physicsresearch

Initial parameters

Clear all symbols to avoid conflicts. We use natural units where ℏ = 1 throughout.

ClearAll[v0, hb, d, m, V, op, u, V, x];

Potential and Hamiltonian operator

Define the finite square well potential V(x) — zero inside the well (|x| < d) and v0 outside — and the 1D Hamiltonian operator −(ℏ²/2m) ∂²/∂x² + V(x).

V[x_, v0_, d_] := (*TB[*)Piecewise[{{(*|*)0(*|*),(*|*)-d<=x<d(*|*)},{(*|*)v0(*|*),(*|*)True(*|*)}}](*|*)(*1:eJxTTMoPSmNkYGAo5gESAZmpyanlmcWpTvkVmUxAAQBzVQdd*)(*]TB*) ;

op[u_[x_], m_, rest__] := - (*FB[*)(((*SpB[*)Power[hb(*|*),(*|*)2](*]SpB*))(*,*)/(*,*)(2 m))(*]FB*) u''[x] + V[x, rest] u[x];

Interactive eigenstate viewer

Use NDEigensystem to numerically solve for the first 6 energy eigenvalues and eigenfunctions with Dirichlet boundary conditions. The wavefunctions are shifted vertically by their energy for easy visualization. The black line shows the potential profile. Adjust V0 (well depth), Mass, and d (half-width) with the sliders.

Manipulate[Block[{ev, ef, hb = 1.0},

  {ev, ef} = NDEigensystem[{
    op[u[x], m, v0, d], DirichletCondition[u[x] == 0, True]
  }, u[x], {x, -2, 2}, 6];

  Plot[Evaluate[ef + ev], {x,-2,2}, PlotRange->Full, Epilog->{
    Line @ Table[{x, V[x, v0, d] 2}, {x,-2,2,0.1}]
  }]
], 
  {{v0, 7, "V0"}, 1,7,3},
  {{m, 1.0, "Mass"}, 1,5,1},
  {{d, 0.1 3, "d"}, 0.1,0.1 5,0.1},
  ContinuousAction->True
]
(*VB[*)(FrontEndRef["7f2661eb-8445-45e4-b197-f448c12e871c"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKm6cZmZkZpibpWpiYmOqamKaa6CYZWprrppmYWCQbGqVamBsmAwB6LRUk"*)(*]VB*)

Try it