/QPlotPot [ module ]
NAME
QPlotPot
AUTHOR
W. Hergert
PACKAGE
QPAck.m
USAGE
QPlotPot[x_,v_,vl_,vr_] plots a piecewise constant or linear potetential
INPUT
- vl : constant potential on the left hand side
- vr : constant potential on the right hand side
- x : list of points, defining the intervalls in the potentials {x1,x2,...xN}
- v : list of potential values vi at the points xi
OUTPUT
plot of the potential
ERROR MESSAGES
- If lists x and v have different length or symbols appear in the input
- If options are not "linear" or "constant"
OPTIONS
- QPlotRange : length of constant potential at the left and right hand side
- QPotential : "constant" - piecewise constant potential, "linear" - piecewise linear potential
LITERATURE
- Einfuehrung in die Quantphysik
- W. Hergert, Transfermatrixmethoden zur Loesung quasi-eindimensionaler quantenmechanischer Probleme "
TODO
PROBLEMS
SOURCE
37 QPlotPot[x_,pot_,vl_,vr_,OptionsPattern[{QPlotRange->1,QPotential->"constant"}]]:=Module[{}, 38 lx=Length[x];lpot=Length[pot];If[lx===lpot,pl=Join[x,pot,{vr,vl}]; 39 Do[If[NumberQ[pl[[i]]],Null,Print["--> QPlotPot - Error : Symbol in Eingabe"]],{i,1,Length[pl]}]; 40 If[OptionValue[QPotential]=="constant", 41 pl={{x[[1]]-OptionValue[QPlotRange],vl},{x[[1]],vl}}; 42 Do[pl=Append[pl,{x[[k]],pot[[k]]}]; 43 pl=Append[pl,{x[[k+1]],pot[[k]]}],{k,1,lx-1}]; 44 pl=Append[pl,{x[[lx]],pot[[lx]]}]; 45 pl=Append[pl,{x[[lx]],vr}]; 46 pl=Append[pl,{x[[lx]]+OptionValue[QPlotRange],vr}], 47 If[OptionValue[QPotential]=="linear",pl={{x[[1]]-OptionValue[QPlotRange],vl},{x[[1]],vl}}; 48 Do[pl=Append[pl,{x[[k]],pot[[k]]}],{k,1,lx}]; 49 pl=Append[pl,{x[[lx]],vr}]; 50 pl=Append[pl,{x[[lx]]+OptionValue[QPlotRange],vr}],Print["--> QPlotPot - Error : falsche Option QPotential"];Abort[]]]; 51 52 ListPlot[pl,Joined->True,Frame->True,PlotStyle->{Thick,Blue},PlotLabel->"Potentialverlauf",FrameLabel->{"x","V(x)"}], 53 Print["--> QPlotPot - Error : Listen haben falsche Laenge !"] 54 ]]