from pylab import * x=0 y=10 theta=pi/100 xall=[x]; yall=[y]; ysum=0; for t in range(100): ysum=ysum+y #theta=theta-pi/20*sign(y) #theta=theta-pi/200*y theta=theta-0.1*pi/20*y-0.2*ydif*pi/20 #theta=theta-pi/200*y+0.02*ysum*pi/200 x=x+2*cos(theta) ydif=2*sin(theta) y=y+ydif xall.append(x) yall.append(y) plot(xall,yall) xlabel('x') ylabel('y')