In [1]:
from __future__ import division, print_function
from ivisual import *
from math import *
In [9]:
scene=canvas("Particle on Rotating Turntable")
R=10
x0=5
y0=0
Omega=1
vx0=-2.5
vy0=-2.5
v=vector(vx0,vy0,0)
r=vector(x0,y0,0)
table=cylinder(pos=vector(0,0,-1), axis=vector(0,0,1), radius=R, color=color.red)
particle=sphere(pos=r, radius=R/20, color=color.yellow, make_trail=True, retain=1000)
t=0
dt=0.01
while t<10:
rate(100)
x=cos(Omega*t)*(x0+vx0*t)+t*(vy0+Omega*x0)*sin(Omega*t)
y=-sin(Omega*t)*(x0+vx0*t)+t*(vy0+Omega*x0)*cos(Omega*t)
r=vector(x,y,0)
particle.pos=r
t=t+dt
In [4]:
In [ ]: