' gb2lib.bas - jackord@kw.igs.net - revised 28 Feb 08 - Liberty Basic v4.02 ' potential plot for -Q, +2Q, -Q charge array nomainwin WindowWidth=426 ' pixel scale 0-408 WindowHeight=374 ' pixel scale 0-336 UpperLeftX=100: UpperLeftY=50 button#1, "Plot", [plot], UL, 6, 6, 40, 18 open "Potential Plotted in Color" for graphics_nsb as #1 #1 "trapclose [quit]" #1 "backcolor pink": #1 "down" dim p(4), q(4), m(4), c$(6) p(1)=121: q(1)=216: p(2)=204: q(2)=216-166*sqr(3)/2: p(3)=287: q(3)=216 m(1)=0-1: m(2)=2: m(3)=m(1) c$(0)="blue": c$(1)="cyan": c$(2)="red" c$(3)="yellow": c$(4)="darkpink": c$(5)="green" for i=1 to 3 step 2 #1 "place "; p(i); " "; q(i) #1 "circlefilled 12" #1 "place "; p(i)-8; " "; q(i)+5: #1 "\-Q" next i #1 "backcolor lightgray" #1 "place "; p(2); " "; q(2) #1 "circlefilled 12" #1 "place "; p(2)-9; " "; q(2)+5: #1 "\2Q" [waitHere] wait [plot] for k=0 to 336 for j=0 to 408 u=0: plt=1 for i=1 TO 3 r2=(p(i)-j)*(p(i)-j)+(q(i)-k)*(q(i)-k) if r2>144 then u=u+m(i)/sqr(r2) else plt=0 next i if plt=1 then plt=int(285.65*(.1+u)): plt=plt-6*int(plt/6) #1 "color "; c$(plt) #1 "set "; j; " "; k end if next j scan next k goto [waitHere] [quit] close#1 end