Finite Potential Well

Make sure to choose "Evaluate Initialization Cells" under the "Evaluation" menu below before using this notebook.

psias[z_, γ_, xa_]:= Which[xa<-1, -Sin[z] (E^(Sqrt[(γ^2)-(z^2)])) (E^((Sqrt[(γ^2) - (z^2)]) xa)) , -1≤xa≤1, Sin[z xa], xa>1, Sin[z] (E^(Sqrt[(γ^2)-(z^2)])) (E^(-(Sqrt[(γ^2) - (z^2)]) xa))]
psis[z_, γ_, xa_]:= Which[xa<-1, Cos[z] (E^(Sqrt[(γ^2)-(z^2)])) (E^((Sqrt[(γ^2) - (z^2)]) xa)) , -1≤xa≤1, Cos[z xa], xa>1,Cos[z] (E^(Sqrt[(γ^2)-(z^2)])) (E^(-(Sqrt[(γ^2) - (z^2)]) xa))]
zed[er_,γ_]:= (Sqrt[(γ^2)(er + 1)])

Manipulate[
Grid[
{
{(* start Grid - row 1 *)
Column[
{Labeled[zed[er,g],z,Left],If[((zed[er,g])/(π/2))<Round[(g/(π/2))]&&er≠0,FindRoot[Tan[z]==(Sqrt[(((g/z))^2)-1]),{z,zed[er,g]}],"No Root"]}
],(* end Column *)
Show[
Plot[
{Tan[z], ((Sqrt[(g^2) -(z^2)])/z)}, {z,0,zm},
PlotRange->{{0,zm},{-5,ym}},
Ticks->{ Range[(π/2),zm-(π/2),π]},
GridLines->{Range[(π/2),zm-(π/2),π],{0}},
GridLinesStyle->Directive[Gray,Dashed],
PlotStyle->{Blue,Orange},
 Exclusions->Table[n(π/2), {n,1,100,1}], 
AxesLabel-> {z,""},
PlotLabel->Row[{" \!\(\*SqrtBox[\(\*SuperscriptBox[\((\*FractionBox[SubscriptBox[\(z\), \(0\)], \(z\)]\\ )\), \(2\)] - 1\)]\)",", ",Tan[z]}]
],(* end Plot *)
 ListPlot[
{{zed[er,g],((Sqrt[(g^2) -((zed[er,g])^2)])/(zed[er,g]))}},
PlotMarkers->{"○"},
PlotStyle->{Red}
],(* end ListPlot *)
ImageSize->{410,375}
],(* end Show *)
Plot[
{psis[zed[er,g],g, xa]}, {xa,-2.0,2.0},
 PlotPoints-> 1000,
 PlotRange-> 1.1,
PlotStyle->{Blue},
 AxesLabel-> {"(x/a)","(Subscript[Ψ, even]) — unnormalized"},
Epilog->{Dashed,Line[{{-1,-1.1},{-1,1.1}}],Line[{{1,-1.1},{1,1.1}}]},
ImageSize->{410,375}
](* end Plot *)
},(* end Grid - row 1 *)
{(* start Grid - row 2 *)
Column[
{Labeled[zed[er,g],z,Left],If[((zed[er,g])/π)<Round[(g/π)]&&er≠0,FindRoot[Cot[z]==-(Sqrt[(((g/z))^2)-1]),{z,zed[er,g]}],"No Root"]}
],(* end Column *)
Show[
Plot[
{-Cot[z], ((Sqrt[(g^2) -(z^2)])/z)}, {z,0,zm},
PlotRange->{{0,zm},{-5,ym}},
Ticks->{ Range[0,zm,π]},
GridLines->{Range[0,zm,π],{0}},
GridLinesStyle->Directive[Gray,Dashed],
PlotStyle->{Purple,Orange}, 
Exclusions->Table[n(π/2), {n,1,100,1}], 
AxesLabel-> {z,""},
PlotLabel->Row[{" \!\(\*SqrtBox[\(\*SuperscriptBox[\((\*FractionBox[SubscriptBox[\(z\), \(0\)], \(z\)]\\ )\), \(2\)] - 1\)]\)",", ", -Cot[z]}]
],(* end Plot *)
 ListPlot[
{{zed[er,g],((Sqrt[(g^2) -((zed[er,g])^2)])/(zed[er,g]))}},
PlotMarkers->{"○"},
PlotStyle->{Red}
],(* end ListPlot *)
ImageSize->{410,375}
],(* end Show *)
Plot[
{psias[zed[er,g],g, xa]}, {xa,-2.0,2.0},
 PlotPoints-> 1000,
 PlotRange-> 1.1,
PlotStyle->{Purple},
 AxesLabel-> {"(x/a)","(Subscript[Ψ, odd]) — unnormalized"},
Epilog->{Dashed,Line[{{-1,-1.1},{-1,1.1}}],Line[{{1,-1.1},{1,1.1}}]},
ImageSize->{410,375}
](* end Plot *)
}(* end Grid - row 2 *)
}
],(* end Grid *)
{{g,20,"(Subscript[z, 0])"},1,100,Appearance->"Labeled"},
 {{er,-0.7,"ρ"},-0.9975,0,Appearance->"Labeled"},
 {{zm,7π,"(Subscript[z, max])"},3π,20π,π,Appearance->"Labeled"},
 {{ym,20,"(Subscript[y, max])"},5,80,1,Appearance->"Labeled"},
SaveDefinitions-> True,TrackedSymbols->True
] (* end Manipulate *)