(*
Solving the Schrodinger Equation for the "Particle-in-a-Box"
of length L in 1-Dimension, namely x-------J.K. Blasie *)

(Should you run this with Mathematica, your output statements may look slightly different than those in this presentation.)

(* Neglecting constants h & m, ie., for {(h^2)/8m(Pi)^2}=1,
and the 1-D Schrodinger Equation INSIDE the box where
V(x)=0 becomes *)

DSolve[y''[x]+E*y[x]==0,y[x],x]


(* at x=0, V(x)->infinity, ie., y(x=0)->0 *)

Solve[C1+C2==0,C1]

{{C1 -> -C2}}

(* at x=L, V(x)->infinity, ie., y(x=L)->0 *)

Solve[-C2*Exp[-I*Sqrt[E]*L]+C2*Exp[I*Sqrt[E]*L]==0]

Solve::svars: Warning: Equations may not give solutions for all "solve" variables.
Solve::ifun: Warning: Inverse functions are being used by Solve, so some solutions may
not be found.
Solve::svars: Warning: Equations may not give solutions for all "solve" variables.
Solve::svars: Warning: Equations may not give solutions for all "solve" variables.
General::stop: Further output of Solve::svars
will be suppressed during this calculation.


(* L=Pi/Sqrt(E) provides E=(Pi/L)^2 AND y(x)=C2*i*Sin(Pi*x/L)
OR y(x)=C2*i*Sin(n*Pi*x/L) IN GENERAL for integer "n" *)

(* Normalizing y(x) via setting integral[(y(x))^2]=1, ie. *)

y[x]=C2*I*Sin[n*Pi*x/L]


Integrate[(y[x])^2,{x,0,L}]



(* since Sin(2nPi)=0 for integer n, C2=iSqrt(2/L) AND
y(x)=Sqrt(2/L)*Sin(n*Pi*x/L) *)

(* Inserting y[x] into the Differential Equation provides the
allowed Energy "Eigenvalues" *)

y[x]=Sqrt[2/L]*Sin[n*Pi*x/L]


D[y[x],{x,2}]



Solve[((Sqrt[2]*Sqrt[1/L]*((n*Pi)^2)*Sin[n*Pi*x/L])/L^2)-E*y[x]==0,E]


ParticleBoxSoln.Mathematica.JKB

This ends the first Mathematica file for this section.

"Particle-in-a-Box" Wave-Functions 1-D and 2-D:

(* "Particle-in-a-Box" Wave-Functions---J.K. Blasie *)

(* in 1-D, for Box of length Lx=10,
where En~(n/Lx)^2 or simply En~n^2,
and for n=1 *)

Plot3D[((Sqrt[2/10]*Sin[1Pi*x/10])^2)+1,{x,0,10},
{y,0,10},PlotRange->{0.5,1.5},PlotPoints->30]

-SurfaceGraphics-

(* and for n=2 *)

Plot3D[((Sqrt[2/10]*Sin[2Pi*x/10])^2)+4,{x,0,10},
{y,0,10},PlotRange->{3.5,4.5},PlotPoints->30]

-SurfaceGraphics-

(* and for n=3 *)

Plot3D[((Sqrt[2/10]*Sin[3Pi*x/10])^2)+9,{x,0,10},
{y,0,10},PlotRange->{8.5,9.5}, PlotPoints->30]

-SurfaceGraphics-

(* in 2-D for Box of length Lx=10 in x and
length Ly=20 in y, where
Enx,ny~{(nx/Lx)^2+(ny/Ly)^2} or simply
Enx,ny~{nx^2+(ny/2)^2},
and for nx=ny=1 *)

Plot3D[((Sqrt[2/10]*Sin[1Pi*x/10]*
Sqrt[2/20]*Sin[1Pi*y/20])^2)+1.25,{x,0,10},
{y,0,20},PlotRange->{1.23,1.27},PlotPoints->30]


-SurfaceGraphics-

(* for nx=2, ny=1 *)

Plot3D[((Sqrt[2/10]*Sin[2Pi*x/10]*
Sqrt[2/20]*Sin[1Pi*y/20])^2)+4.25,
{x,0,10},{y,0,20},PlotRange->{4.23,4.27},
PlotPoints->30]

-SurfaceGraphics-

(* for nx=2, ny=2 *)

Plot3D[((Sqrt[2/10]*Sin[2Pi*x/10]*
Sqrt[2/20]*Sin[2Pi*y/20])^2)+5,
{x,0,10},{y,0,20},PlotRange->{4.98,5.02},
PlotPoints->30]

-SurfaceGraphics-

(* for nx=2, ny=3 *)

Plot3D[((Sqrt[2/10]*Sin[2Pi*x/10]*
Sqrt[2/20]*Sin[3Pi*y/20])^2)+6.25,
{x,0,10},{y,0,20},PlotRange->{6.23,6.27},
PlotPoints->30]

-SurfaceGraphics-

(* etc. for nx=2, ny=3 and etc., etc.! *)

ParticleBoxWaveFunctions;1D&2D.JKB

You can now return to the notes.