Animating the Brachistochrone Problem

This notebook demonstrates the commands in the package Brachistochrone.m,
which aid in visualizing the brachistochrone problem.  This problem was
first posed by Johann Bernoulli in 1696 and is easily stated.  Find the
curve along which a particle will slide most rapidly first one given point
to another, the second point not directly below the first.  The effect of
friction is ignored.  The solution is a cycloid.  If the top point is at
coordinate (0, a), then the cycloid is given parametrically by the
equations:

x (t ) =3D c 2(t - sint )/2,     y (t ) =3D a - c=2(1 - cost )/2

the parameter c  is determined by the location of the second point. To find
the parameterization passing through the points (0, 1) and (0, 1) we use
the FindRoot command:

FindRoot[{csq(tend - Sin[tend]) == 1, csq(1 - Cos[tend]) == 1},
{csq,2.}, {tend, 2.}]

csq = csq /. %

tend = tend /. %%

Here, csq is the value of c 2/2, and tend is the final value of the
parameter t.  To animate a particle sliding down this curve, we load the
package, and use the BrachAni command.

<<Brachistochrone.m

BrachAni[{{csq(t - Sin[t]),1 - csq(1 - Cos[t])},{t,0.,tend}}];

Although the cycloid is the optimal curve, it may be instructive to "race"
particles down competing curves.  The command designed for this purpose is
BrachCompare.  For instance, here is a race between the straight line and
the quarter circle connecting (0, 1) and (1, 0).

BrachCompare[
   {{t,1 - t},{t,0.,1.}},
   {{1 - Cos[t], 1 - Sin[t]},{t,0.,N[Pi/2]}}];