Chapter Two:

Rolling Circles

2.1  Discovering the Cycloid

rotate[point_, t_, center_] := center + 
	{{Cos[t], Sin[t]}, {-Sin[t], Cos[t]}} . (point - center)

rotate[{0, 0}, t, {0, 1}] + {t, 0}

cycloid[t_] := {t - Sin[t], 1 - Cos[t]};
ParametricPlot[cycloid[t], {t, 0, 4 Pi}, AspectRatio->2/(4 Pi)]

cycloid[t_] := {t - Sin[t], 1 - Cos[t]};
baseline = Line[{{-2, 0}, {10.5, 0}}];
pi = N[Pi];
dots = {PointSize[.006]};		
Do[  AppendTo[dots, Point[cycloid[t]]];
     Show[Graphics[{{GrayLevel[.5], Disk[{t, 1}, 1]},
				   Line[{{t, 1}, cycloid[t]}],	  (* spoke *)
				   baseline,
				   dots}],
		AspectRatio->3/12,
		PlotRange->{{-1.5, 10.5}, {-.5, 2.5}}],
    {t, 0., 59/40 2 pi, 2 pi/15}]

Do[ParametricPlot[{t - r Sin[t], 1 - r Cos[t]},
									{t, 0, 2 Pi 58/40},
  PlotRange->{{-1,8.6},{-1.2, 3.2}}, AspectRatio->4.4/9.5],
 {r, 0, 2, .1}]

2.2  The Derivative of the Trochoid

trochoid[t_] := {t - 1.3 Sin[t], 1 - 1.3 Cos[t]}
velocity = trochoid'

ParametricPlot[velocity[t], {t, 0, 2 Pi}, AspectRatio->1]

vectors = Table[{
    trochoid[t], trochoid[t] + velocity[t]}, {t, 0, 8, .3}];
Show[Graphics[{Thickness[.0005], Map[Line, vectors]}],
	AspectRatio->4/8]

Show[Graphics[Table[
		Line[{{0,0}, velocity[t]}], {t, 0, 2 Pi, .3}]], 	
		AspectRatio->1]

2.3  Circles Rolling on Circles

all code in this section is in the Appendix

2.4  The Cycloid and Gravity

cycloid[t_] := {t - Sin[t], Cos[t] - 1}
norm[u_] := Sqrt[u.u]
norm[cycloid'[t]]/Sqrt[2g(cycloid[t0][[2]] - cycloid[t][[2]])]

ExpandAll[%] /. Cos[w_]^2 + Sin[w_]^2 -> 1

<<IntegralTables.m;

Version 2.0 note

The following integration does not work in 2.0. Bug?

And note that if Cos[t0] is replaced by, say, 0.34, the integration does not work in 1.2. But if 34/100 is used instead of 0.34, then
the integration does work.

Integrate[Sqrt[(1 - Cos[t])/(Cos[t0] - Cos[t])], t] / Sqrt[g]

% /. ArcTan[r_] -> ArcCos[1/Sqrt[r^2+1]]

Simplify[%] /. Cos[w_]^2 + Sin[w_]^2 -> 1

MapAll[Factor, %]

% /. Cos[x_] -> Cos[x/2]^2 - 1

t /. First@  Solve[% == time, t]

pi = Pi//N;
cycloid[t_] := {t - Sin[t], -1 + Cos[t]}
cycloidplot = ParametricPlot[cycloid[s], {s, 0, pi}, 
	Axes->None, PlotStyle->Thickness[.0005], MaxBend->5,
	DisplayFunction->Identity];

showframe := Show[cycloidplot, 
		Graphics[{Thickness[.0004], 
	  	    Disk[posn, radius],
	  	    {Thickness[.002], Line[{{pi,-2.1}, {pi,-1.8}}]}}],
	 PlotRange->{{-.2,  2 pi + .2}, {-2.2, .2}},
	 AspectRatio->2.4/(2 pi + .4),
	 DisplayFunction->$DisplayFunction];

t0 = N[Input["Enter initial t-value for start time on 
			cycloid:  0 † t < Pi"]];
radius = .07;
g = 980 2 pi /15;
inc = 1./100;
Do[	t = 2 ArcCos[Cos[t0/2] * Cos[Sqrt[g]*time/2]];
	posn = cycloid[Min[t, pi - radius/2]];
	showframe,
  {time, 0, pi/Sqrt[g], inc}]

degree = . 		(* code in this cell is changed from first printing 
					of book because of errors I made in the theory *)
pi = Pi//N;
y[t_] := -2 (t/pi) ^ degree;
g = 980 2 pi / 15;
h[t_] := (1 - y'[t]) / Sqrt[-y[t] 2 g];
Integrate[h[t], t]

error[eps_] := Release[(% /. t-> eps) - Sqrt[-2 y[eps]/g]]

Table[degree = 1/n; N[error[.001]], {n, 2, 10}]

t = .   (* Clears t so it can be used as a dummy variable *)
time[n_] := (degree = n;
	Sqrt[2 y[.001] / -g] +    (* Time to fall straight down *)
	NIntegrate[Sqrt[(1 + y'[t]^2) / (-y[t])] / Sqrt[2g],
			 	{t, .001, Pi}])  /; n != 1.
time[1.] := norm[{pi,-2}] / Sqrt[g]

TableForm[Table[{n, time[n]}, {n, 8}]]  
	(* this and following cell take a while *)

Plot[time[n], {n, 1, 15}, Axes->{0, 0.155}]