(*Define the potential: Infinite Square Well*)
U[x_,a_,b_]:=({{\[Piecewise], ({{0, a≤x≤b}, {200, x<a}, {200, x>b}})}})
(*a and b are the bounds of the well*)

(*Define the wave functions; Eigenfunction Solutions*)
ψ[x_,a_,b_,n_]:=({{\[Piecewise], ({{0, x<a && x>b}, {Sqrt[2/(b-a)]*Sin[((n*π)/(b-a))*(x-a)], a≤x≤b}})}})
(*n is the Integer of our energy levels or eigenvalues*)

(*Energy*)
ℏ=1;
m=1;

e[n_,a_,b_]:=(n^2*π^2*ℏ^2)/(2*m*(b-a)^2)

(*Create a Plot for Potential: Infinite Square Well*)
Manipulate[Plot[{ψ[x,a,b,n]+e[n,a,b],U[x,a,b],e[n,a,b]},{x,-10,10},PlotStyle->{Thick,Thick,Dashed},PlotRange->{-1,5+e[n,a,b]},Exclusions->None,PlotLegends->{"Wave Function","Potential Well","Energy Level"}],{{b,5,"Upper Limit"},0.1,5},{{n,0,"Energy Level"},0,20,1},{{a,-5,"Lower Limit"},-5,0}]