' fbwllib - jackord@kw.igs.net - revised 24 Jul 02 - Liberty Basic v3.01 ' particle sliding in a bowl with friction ' Initialize Window nomainwin button#1, "Plot", [plot], UL, 10, 10, 50, 20 WindowWidth=510 ' pixel scale 0-500 WindowHeight=389 ' pixel scale 0-360 UpperLeftX=50: UpperLeftY=100 open "Sliding in a bowl with friction" for graphics_nsb as #1 #1 "trapclose [quit]" gosub [pin] [waitHere] wait [plot] gosub [pin] gr=9.8: r=10: u=.12: dt=.001: pi=4*atn(1) z$="turns": rr=220: cc=300 t=0: s=r*pi/2: v=0 #1 "color blue ; place 88 12" dv=0-gr*dt: v=v+dv/2: vo=v ' Feynman Algorithm while z$="turns" t=t+dt: s=s+v*dt: gosub [acc]: dv=a*dt: v=v+dv theta=s/r*180/pi #1 "goto "; 88+int(20*t); " "; 12+int(5*(90-theta)/3) if vo*v<0 then if abs(u/tan(s/r))>1 then z$="stops" #1 "place "; cc; " "; rr #1 "\"; z$; " at theta = "; using("###.##",theta) #1 "place "; 88+int(20*t); " "; 12+int(5*(90-theta)/3) rr=rr+20: u=0-u end if vo=v wend goto [waitHere] [pin] #1 "cls ; down ; color black" #1 "place 88 12 ; box 488 312 ; line 88 162 488 162" #1 "place 85 332": #1 "\0" #1 "place 481 332": #1 "\20" #1 "place 268 344": #1 "\Time" #1 "place 64 318": #1 "\-90" #1 "place 72 168": #1 "\0" #1 "place 68 18": #1 "\90" #1 "place 16 93": #1 "\Theta" #1 "place 24 243": #1 "\deg" return [acc] ' Newton's Law w=v+dv/2: a=u*(gr*cos(s/r)+w*w/r)-gr*sin(s/r) return [quit] close #1 end