from visual import * floor = box(length=4, height=4, width=0.1, color=color.blue) ball = sphere(pos=(1.0, 0.0, 0.0), color=color.red,radius=0.1) xaxis=curve(pos=[(-2,0,0.06),(2,0,0.06)],color=color.white) yaxis=curve(pos=[(0,-2,0.06),(0,2,0.06)],color=color.white) h = 0.01 x=1.0 v=0.0 while 1: rate(100) k1=h*v l1=-2.0*h*x*x*x k2=h*(v+0.5*l1) l2=-2.0*h*(x+0.5*k1)*(x+0.5*k1)*(x+0.5*k1) k3=h*(v+l2) l3=-2.0*h*(x+k2)*(x+k2)*(x+k2) x=x+(k1+4.0*k2+k3)/6.0 v=v+(l1+4.0*l2+l3)/6.0 ball.pos = vector(x,v,0.0)