Exercise 6: Galileo's experimentYou can create an animation of two falling spheres, from t = 0 to t = tmax by executing the following command. You will need to replace the definitions of y1 and y2 given below with your own definitions. You will also need to replace tmax.
In[52]:=
Clear[t,d,rho]
g = 980;
k2 = Pi d^2 rho/16;
tmax = 3.5;
mwood = 4/3 Pi 5^3 0.5;
k = k2 /. {d -> 10, rho -> 1.21 10^-3};
y0 = 5000; v0 = 0;
y1 = -1/2 g t^2 + v0 t + y0;
y2 = -m/k Log[Abs[Cosh[-Sqrt[k g/m] t]]] + y0 /. m -> mwood;
Here is the animation.
In[53]:=
<<Graphics`Master`
Clear[time]
rad = 0.1;
Do[
yposition1 = Max[Evaluate[y1 /. t -> time],0];
yposition2 = Max[Evaluate[y2 /. t -> time],0];
corners = Graphics[{RGBColor[1,1,1],
Point[{0,-rad/2}], Point[{1,-rad/2}],
Point[{0,y0*(1+rad/2)}],Point[{1,y0*(1+rad/2)}]}];
spheres = Graphics[{RGBColor[0,0,1],PointSize[0.1],
Point[ {0.3,yposition1}],
Point[ {0.7,yposition2}]},
PlotRange -> {{0,1},{-rad/2,y0+rad/2}}];
text1 = Graphics[Text["y1", Scaled[{0.15,0.9}]]];
text2 = Graphics[Text["y2", Scaled[{0.85,0.9}]]];
Show[text1, text2, corners, spheres, Frame -> True];,
{time,0,tmax,tmax/10}]
(This is the first frame of a 48996 byte mpg movie. Click on the graph to download the movie)
Up to 6. Applications