Schrodinger Equation:
 -((♄^2)/2m) ψ”(x) + V(x) ψ(x) = E ψ(x)

Particle in a one-dimensional box: V = 0 ( 0 ⩽ x ⩽ L)

eqn=(-♄^2 / (2m))ψ''[x]==En ψ[x]

DSolve[eqn,ψ[x],x]

sol=DSolve[{eqn,ψ[0]==0},ψ,x]

eqnE = ψ[L]==0 /. sol

psi[n_,x_]:=Sin [n Pi x / L]

energy[n_]:=n^2 h^2/(8 m L^2)

L=.

energy[1]

Do[Print[i,"  ",energy[i]],{i,5}]

Integrate[psi[1,x]^2,{x,0,L}]

(L/2)

npsi[n_,x_]:=Sqrt[2/L] psi[n,x]

Integrate[npsi[1,x]^2,{x,0,L}]

L=1

Plot[npsi[1,x],{x,0,L}]

Plot[npsi[2,x],{x,0,L}]

n = 3

Plot[npsi[3,x],{x,0,L}]

Plot[{npsi[1,x],npsi[2,x],npsi[3,x],npsi[4,x]},{x,0,L}]

Uncertainty Principle: Δp Δx ≥ ♄/2

L=.

meanx=Integrate[x npsi[1,x]^2,{x,0,L}]

meanx2 =Integrate[x^2 npsi[1,x]^2,{x,0,L}]

△x = Sqrt[meanx2 - meanx^2]

meanp2 = -♄^2 Integrate[npsi[1,x] D[npsi[1,x],{x,2}],{x,0,L}]

meanp=Integrate[npsi[1,x] D[npsi[1,x],x],{x,0,L}]

△p = Sqrt[meanp2 - meanp^2]

△x △p

N[%]

Simplify[%,{L > 0,♄ >0}]