{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Fo nt 0" -1 256 1 {CSTYLE "" -1 -1 "Helvetica" 1 12 128 0 128 1 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE "" -1 -1 "Courier" 1 11 0 128 128 1 2 1 2 0 0 0 0 0 0 } 0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "PHYSICS RESOURCE PACKETS P ROJECT File: LEVELSQR.MS" }}{PARA 0 "" 0 "" {TEXT -1 109 "Rose-Hulman Institute of Technology \+ Authors: Perry Peters & Dr. Moloney" }}{PARA 0 "" 0 "" {TEXT -1 97 "http://www.rose-hulman.edu/~moloney \+ Software: Maple V Release 4" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 52 "Search engine for energy \+ levels in a potential well." }}{PARA 0 "" 0 "" {TEXT -1 34 "Solves for even and odd solutions." }}{PARA 0 "" 0 "" {TEXT -1 120 "Other potent ial functions can be used in the program, but the program is not able \+ to normalize every potential function." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 85 "h-bar^2 /2m is coefficient of first t erm. ( x' = ax, where x in m, x' in nm. a=10^9)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 28 "d/dx = dx'/dx d/dx'; x'= 1nm" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "restart;with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "hbar:=6.6260755E-34;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "Me :=9.1093987E-31;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "ec:=1.6 0217733E-19;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "ck:=evalf(( hbar*1E9/(2*Pi))^2 /(2*Me * ec));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 48 "En ter in maximum width(nm) and depth(eV) of well" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "depth:=4; width:=2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "Enter in a function for the well shape" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "V := -depth*(1-Heaviside(abs(x)-width/2));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "g1:=plot(V,x=-width/2-1..wi dth/2+1,color=blue,axes=framed,title=`V vs x`,labels=[nm,eV]): #see if V looks ok" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "g1;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 36 "Sc hrodinger's steady-state equation." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "eq1:=-ck*diff(y(x),x,x)+V*y(x) = eV*y(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 61 "Solve Schrodinger's eq uation numerically as a function of eV." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "s_odd:= k -> dsolve(\{subs(eV=k,eq1),D(y)(0)=1,y(0)=0\},y(x),n umeric);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "s_even:= k -> d solve(\{subs(eV=k,eq1),D(y)(0)=0,y(0)=1\},y(x),numeric);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 150 "Look at what the equation does outside t he barrier. The goal is to find the energy levels at which the wave f unction decays to 0 outside the barrier." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "test_point:=width/2+4;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "r_odd:= p -> (rhs(s_odd(p)(test_point)[2]));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "r_even:= p -> (rhs(s_even(p) (test_point)[2]));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 189 "Draw vertical lines where the function outside t he barrier changes signs, i.e. goes from negative to positive, or posi tive to negative. This tells us what the allowable values for eV are. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "r_oddl:= p -> 3*sign(rhs(s_odd (p)(test_point)[2]));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "r_ evenl:= p -> 3*sign(rhs(s_even(p)(test_point)[2]));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 31 "Dummy function for plot command" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "f:=p->p;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Plot an energy band diagram of the allowable energy levels." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 115 "plot([r_oddl,f,-depth..0],view=[0. .2,-depth..0],color=blue,labels=[` `,eV],xtickmarks=0,title=`odd energ y levels`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 117 "plot([r_eve nl,f,-depth..0],view=[0..2,-depth..0],color=blue,labels=[` `,eV],xtick marks=0,title=`even energy levels`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Enter in approximations of where the energy levels fall on the graphs produced above. You need only enter the levels of the wave fu nctions you wish to plot." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 89 "levels :=[even,-3.9],[odd,-3.7],[even,-3.3],[odd,-2.8],[even,-2.1],[odd,-1.3] ,[even,-0.4];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "This calulates t he number of levels you have chosen to graph." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "numlevels:=nops([levels]);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 146 "Definition of the derivative, used later to do Newton' s method. Newton's method is used to a more exact value of eV for the approximations above." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "dr:=x->(r (x+0.000001)-r(x))/0.000001;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "P lot the wave functions specified in \"levels\"" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "for j from 1 to num levels do" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 36 "Pick an energy level out of \"levels\"" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "level:=levels[j][1];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "mid:=levels[j][2];" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 45 "level is used to determine which DE to solve." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "if level='odd'" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 24 "then r:=r_odd; s:=s_odd;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "else r:=r_even; s:=s_even;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "fi;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 202 "Use Newton's method to find an energy level that decay s to 0 outside the barrier. \"mid\" is used as an initial guess. The loop exits after 10 iterations, or after a certain precision has been obtained." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "mid0:=0: counter:=0: " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "while (abs(mid-mid0)>0.00000000 2) and (counter < 10) do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "mid0:=m id:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "mid:=mid0-r(mid0)/dr(mid0): " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "print(mid);" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 21 "counter:=counter + 1:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "od:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 72 "Plot the well, the wave function, and its energy level \+ on the same graph" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "energy:=conver t(mid,string);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 99 "g2:=odeplot(s(mid ),[x,y(x)],-width/2-1..width/2+1,axes=framed,title=`Ev = `.energy,labe ls=[nm,eV]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "print(display([g2,g 1]));" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 38 " Print the energy levels to the screen." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "print(s(mid.j));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "mid.j:= mid;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "s.j:=s(mid.j);" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 16 "print(Ev=mid.j);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "od:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "Plot |psi| ^2 and find the area under |psi|^2" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "for j from 1 to numlevels do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "s_abs.j:=(x) -> rhs(s.j(x)[2])^2;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "energy:=convert(mid.j,string);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "plot(s_abs.j,-width/2-1/2..width/2+1/2,title=`original |psi|^2 \+ Ev=`.energy);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "area.j:=evalf(Int( s_abs.j,-width/2-1/2..width/2+1/2));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "od;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "Plot a the normalized wave functions" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "for j from 1 to \+ numlevels do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "s_norm.j:= (x) -> r hs(s.j(x)[2])/sqrt(area.j);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "ener gy:=convert(mid.j,string):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 111 "g2:= plot(s_norm.j,evalf(-width/2-1..width/2+1),labels=[nm,eV],title=`norma lized psi Ev=`.energy,axes=framed):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "print(display([g2,g1]));" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "od :" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "Animate several wave functio ns in the well." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 40 "Value of hbar in this coordinate system." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "hbar1:=hbar/ec;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 126 "Make the wave functions time dependent and find |Psi|^2 \+ of the sum of the wave functions. Add or delete equations as desired. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y1:= (x,t) -> rhs(s1(x)[2])*exp (-I*mid1*t/hbar1)/sqrt(area1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y2:= (x,t) -> rhs(s2(x)[2])*exp(-I*mid2*t/hbar1)/sqrt(area2); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y3:= (x,t) -> rhs(s3(x) [2])*exp(-I*mid3*t/hbar1)/sqrt(area3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y4:= (x,t) -> rhs(s4(x)[2])*exp(-I*mid4*t/hbar1)/sqrt (area4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y5:= (x,t) -> r hs(s5(x)[2])*exp(-I*mid5*t/hbar1)/sqrt(area5);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 61 "y6:= (x,t) -> rhs(s6(x)[2])*exp(-I*mid6*t/hbar 1)/sqrt(area6);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y7:= (x, t) -> rhs(s7(x)[2])*exp(-I*mid7*t/hbar1)/sqrt(area7);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "Y:=(x,t)->abs(y1(x,t)+y2(x,t)+y3(x, t)+y4(x,t)+y5(x,t)+y6(x,t)+y7(x,t))^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "View value of function at any point and time. Y(x,t)" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "Y(1.5,0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "V1:= X -> subs(x=X,V);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 31 "g1:=plot(V1,-2..2,color=black):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 151 "g2:=animate(Y,-2..2,0..4E-14,axes=framed,l abels=[nm,eV],title=`Wave function sloshing in potential well`,color=r ed,frames=40,numpoints=100,color=blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "display([g2,g1]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "40 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }