Wolfram Language

Partial Differential Equations

Observe a Quantum Particle in a Box

A quantum particle free to move within a two-dimensional rectangle with sides and is described by the two-dimensional time-dependent Schrödinger equation, together with boundary conditions that force the wavefunction to zero at the boundary.

Click for copyable input
eqn = I D[\[Psi][x, y, t], t] == -\[HBar]^2/(2 m) Laplacian[\[Psi][x, y, t], {x, y}];
Click for copyable input
bcs = {\[Psi][0, y, t] == 0, \[Psi][xMax, y, t] == 0, \[Psi][x, yMax, t] == 0, \[Psi][x, 0, t] == 0};

This equation has a general solution that is a formal infinite sum of so-called eigenstates.

Click for copyable input
DSolveValue[{eqn, bcs}, \[Psi][x, y, t], {x, y, t}]

Define an initial condition equal to a unitized eigenstate.

Click for copyable input
initEigen = \[Psi][x, y, 0] == 2 /Sqrt[xMax yMax] Sin[(\[Pi] x)/xMax] Sin[(\[Pi] y)/yMax];

In this case, the solution is simply a time-dependent multiple (of unit modulus) of the initial condition.

Click for copyable input
DSolveValue[{eqn, bcs, initEigen}, \[Psi][x, y, t], {x, y, t}]

Define an initial condition that is a sum of eigenstates. Because the initial conditions are not an eigenstate, the probability density for the location of the particle will be time dependent.

Click for copyable input
initSum = \[Psi][x, y, 0] == Sqrt[2]/Sqrt[ xMax yMax] (Sin[(2 \[Pi] x)/xMax] Sin[(\[Pi] y)/yMax] + Sin[(\[Pi] x)/xMax] Sin[(3 \[Pi] y)/yMax]);

Solve with the new initial condition.

Click for copyable input
sol = DSolveValue[{eqn, bcs, initSum}, \[Psi][x, y, t], {x, y, t}]

Compute the probability density, inserting values of the reduced Planck's constant, electron mass, and a box of atomic size, using units of the electron mass, nanometers, and femtoseconds.

Click for copyable input
\[HBar] = QuantityMagnitude[Quantity[1., "ReducedPlanckConstant"], "ElectronMass" * ("Nanometers")^2/"Femtoseconds"]
Click for copyable input
\[Rho][x_, y_, t_] = FullSimplify[ComplexExpand[Conjugate[sol] sol]] /. {m -> 1, xMax -> 1, yMax -> 1}

Visualize the probability density inside the box over time.

Click for copyable input
ListAnimate[ Table[Plot3D[\[Rho][x , y , t], {x, 0, 1}, {y, 0, 1}, PlotTheme -> {"Scientific", "SolidGrid"}, AxesLabel -> {"\!\(\* StyleBox[\"x\", \"SO\"]\) (nm)", " \!\(\* StyleBox[\"y\", \"SO\"]\) (nm)", "\!\(\* StyleBox[\"\[Rho]\", \"SO\"]\) (\!\(\*SuperscriptBox[\(nm\), \ \(-2\)]\))"}, ImageSize -> Medium, PlotRange -> {0, 7}], {t, 0, 19, .5}]]
Play Animation
Stop Animation

Related Examples

de es fr ja ko pt-br ru zh