! sine curve let c=1 def x=c*t def y=sin(c*t) ! X = xi + yj def vx=c def vy=c*cos(c*t) ! V = vxi + vyj def ax=0 def ay=-c*c*sin(c*t) ! A = axi + ayj sub keypressed if key input then get key key get key key if key=ord(" ") then call init if key=ord("q" ) then let done=1 else let done=0 end if end sub sub init let t=0 let done=0 let dskip= .5 let skip=0 let dt=.05 set mode "graphics" close #1 open #1 : screen 0,1,0,1 clear set color "white" box lines 0,1,0,1 let xmin=-.5 let xmax=5.5 let ymin= -2 let ymax=-ymin set window xmin,xmax,ymin,ymax plot xmin,0 ; xmax,0 plot 0,ymin ; 0,ymax set color "yellow" print "Velocity" set color "red" print "Acceleration" end sub sub vector(x1,x2,y1,y2) let m=12 let d1=(y1-x1)/m let d2=(y2-x2)/m plot plot x1,x2; for vect=1 to m let x1=x1+d1 let x2=x2+d2 plot x1,x2; next vect box area x1-d1,x1,x2-d2,x2 plot end sub ! main program call init do set color "yellow" call vector(x,y,x+vx,y+vy) set color "red" call vector(x,y,x+ax,y+ay) set color "green" do until t>=skip plot x,y let t=t+dt call keypressed loop let skip=skip+dskip loop until done=1 end