Particle in a Box

(∫_0^L)((Sin[ Pi x / L])^2)\[DifferentialD]x

Integrate[((Sin[  2 Pi x / L])^2),{x,0,L}]

ψ[n_,x_]:=Sin[n Pi x]

Plot[ψ[2,x],{x,0,1},PlotRange->{{0,1},{-1,1}}]

Manipulate[
Plot[{ψ[n,x],((ψ[n,x])^2)},{x,0,1},AxesLabel->{"x","ψ(x)"},PlotLabel -> "Particle in a Box Wavefunctions",  PlotRange->{{0,1},{-1,1}},PlotTheme->"Scientific",PlotLegends->{"ψ","(ψ^2)"}],
{n,1,10,1}]

ψ2[nx_,ny_,x_,y_]:=Sin[nx Pi x]Sin[ny Pi y]

Plot3D[ψ2[2,2,x,y],{x,0,1},{y,0,1}]

Manipulate[
Plot3D[ψ2[nx,ny,x,y],{x,0,1},{y,0,1},AxesLabel->{"x","y","ψ(x,y)"},PlotLabel -> "Particle in a Box Wavefunctions",PlotRange->{{0,1},{0,1},{-1,1}}],
{nx,1,3,1},
{ny,1,3,1}]

average values

ψnorm[n_,x_]:=(Sqrt[(2/L)])Sin[n Pi x/L]

(∫_0^L)ψnorm[1,x] ψnorm[1,x] \[DifferentialD]x

avex=(∫_0^L)ψnorm[1,x] x ψnorm[1,x] \[DifferentialD]x

avexx=(∫_0^L)ψnorm[1,x] (x^2) ψnorm[1,x] \[DifferentialD]x

avep=(∫_0^L)ψnorm[1,x] (-i ℏ )D[ ψnorm[1,x] ,x]\[DifferentialD]x

avepp=(∫_0^L)ψnorm[1,x] (- (ℏ^2) )D[ψnorm[1,x],{x,2}]\[DifferentialD]x

Uncertainty Principle

σx=(Sqrt[avexx-(avex^2)])

σp=(Sqrt[avepp-(avep^2)])

Simplify[σx σp,Assumptions -> {ℏ >0, L >0}]

N[%]

eigenfunctions with different eigenvalues are orthogonal

(∫_0^L)Sin[ Pi x / L]Sin[2 Pi x / L]\[DifferentialD]x

(∫_0^L)Sin[ 2 Pi x / L]Sin[3 Pi x / L]\[DifferentialD]x