' felelib.bas - jackord@kw.igs.net - revised 8 Sep 02 - Liberty Basic v3.01 ' motion of electrons in a field with cylindrical symmetry ' field set up by conduction plates in the x-z plane with a narrow gap ' between them - positive (attractive) plate in the left half-plane ' - negative (repulsive) plate in the right half-plane ' the source emits monoenergetic electrons in the x-y plane ' Initialize Window nomainwin button#1, "Plot", [plt], UL, 5, 5, 40, 20 WindowWidth=410 ' pixel scale 0-400 WindowHeight=230 ' pixel scale 0-200 UpperLeftX=100: UpperLeftY=100 open "Electron Orbits" for graphics_nsb as #1 #1 "trapclose [quit]" pi=4*atn(1): gosub [grid] [waitHere] wait [plt] gosub [grid] vo=(pi/2)^.5: dt=1 for i=0 to 11 ' Angle loop phi=pi*i/6: vx=vo*cos(phi): vy=vo*sin(phi) x=100: y=100: r2=x*x+y*y: #1 "place 300 100" vx=vx-y/r2*dt/2: vy=vy+x/r2*dt/2 ' Half-step while x>0-200 and x<200 and y>0 and y<200 ' Feynman loop x=x+vx*dt: y=y+vy*dt: #1 "goto "; 200+int(x); " "; 200-int(y) r2=x*x+y*y: vx=vx-y/r2*dt: vy=vy+x/r2*dt wend next i goto [waitHere] [grid] #1 "backcolor white ; cls ; down ; backcolor red" #1 "color pink ; line 0 200 200 200" #1 "color green ; line 200 200 400 200" #1 "color darkcyan" for i=40 to 160 step 40 #1 "place 200 200 ; circle "; i next i #1 "color red ; place 300 100 ; circlefilled 5 ; color blue" return [quit] close #1 end