{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 81 "PHYSICS RESOURCE PACKETS P ROJECT File: LEVELPAR.MWS" }}{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 "" {TEXT -1 122 "* ** Some commands may return errors when you execute the worksheet. If so, run the same command again until it works. ***" }}{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.60217733E-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 "Enter 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 61 "V := depth*((x/(width/2))^ 2-1)*(1-Heaviside(abs(x)-width/2));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "g1:=plot(V,x=-width/2-1..width/2+1,color=blue,axes=f ramed,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 "Schrodinger's steady-stat e 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 equation 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),numeric);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "s_even:= k -> dsolve(\{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 the barrier. T he goal is to find the energy levels at which the wave function 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 "D raw vertical lines where the function outside the barrier changes sign s, i.e. goes from negative to positive, or positive 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 "D ummy 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 dia gram 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,labe ls=[` `,eV],xtickmarks=0,title=`odd energy levels`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 117 "plot([r_evenl,f,-depth..0],view=[0..2,-d epth..0],color=blue,labels=[` `,eV],xtickmarks=0,title=`even energy le vels`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Enter in approximatio ns of where the energy levels fall on the graphs produced above. You \+ need only enter the levels of the wave functions you wish to plot." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "levels:=[even,-3.6],[odd,-2.8],[eve n,-2.05],[odd,-1.3],[even,-0.5];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "This calulates the 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, use d later to do Newton's method. Newton's method is used to a more exac t 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 "Plot the wave functions specified in \"le vels\"" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "for j from 1 to numlevels 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 determin e which DE to solve." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "if level='o dd'" }}{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 energ y level that decays to 0 outside the barrier. \"mid\" is used as an i nitial guess. The loop exits after 10 iterations, or after a certain \+ precision has been obtained." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "mid 0:=0: counter:=0:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "while (abs(mid -mid0)>0.000000002) and (counter < 10) do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "mid0:=mid:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "mid: =mid0-r(mid0)/dr(mid0):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "print(mi d);" }}{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:=convert(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,labels=[nm,eV]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "p rint(display([g2,g1]));" }}{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/4..width/2+1/4));" }}{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) -> rhs(s.j(x)[2])/sqrt(area.j);" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 30 "energy:=convert(mid.j,string):" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 111 "g2:=plot(s_norm.j,evalf(-width/2-1..width/2+1),lab els=[nm,eV],title=`normalized 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 functions in the well." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 40 "Value of hbar in this coo rdinate 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);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y2:= (x,t) -> rhs(s2(x)[2])*exp(-I*mid2*t/h bar1)/sqrt(area2);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y3:= (x,t) -> rhs(s3(x)[2])*exp(-I*mid3*t/hbar1)/sqrt(area3);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y4:= (x,t) -> rhs(s4(x)[2])*exp(-I*mid4*t/hbar1)/sqrt (area4);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "y5:= (x,t) -> rhs(s5(x) [2])*exp(-I*mid5*t/hbar1)/sqrt(area5);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "Y:=(x,t)->abs(y1(x,t)+y2(x,t)+y3(x,t)+y4(x,t)+y5(x,t))^2;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "View value of function at any poin t 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 150 "animate(\{Y,V1\},-2..2,0..5 .1E-14,frames=50,axes=framed,labels=[nm,`|Psi|^2`],title=`Wave functio n sloshing in potential well`,color=red,numpoints=100);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 3 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }