<< Graphics`Animation`;
<< Graphics`Shapes`;
<< Graphics`Arrow`;

\(\(\(	\)\(τ = \(\(mℓ\^2\) θ\&¨\  = \ \(-mgl\)\ sin\ θ\)

    	θ\&¨\ \  = \ \(-\((g\/ℓ)\)\)\ sin\ θ


    	\(1\/2\) \(ml\^2\) \((θ\& . \_0)\)\^2 = \(1\/2\) \(ml\^2\) \((θ\& . )\)\^2 + 
        mgℓ \((1 - cos\ θ\ )\)

    	\(θ\& . \) \((θ)\) = \((\((θ\& . \_0)\)\^2 - 2 \( g\/ℓ\) \((1 - cos\ θ\ )\))\)\^\(1\/2\)


    	T - mg\ cos\ θ\  = \ 
      m \( θ\& . \^2\) ℓ

    	T = 
      mg \((θ\& . \^2/\(g\/ℓ\) + 
            cos\ θ\ )\)


    critical\ \(speed : \ θ\& . \)\  = \ 
      0\ at\ top\ \((θ = π)\)

    	\(\(->\)\(\ \)\(θ\& . \_0\)\)\  = 
      2\ \@\(g\/ℓ\)

    critical\ \(tension : T\)\  = \ 0\ at\ top

    	\(\(->\)\(\ \)\(θ\& . \)\) = \ \(\@\(g\/ℓ\) -> \ \ θ\& . \_0\  = \ \@\(5  g\/ℓ\)\)


    above\ critical\ \(speed : \ 
        Period\ of\ rotation\ T\_R\)

    	T\_R = ∫\_0\%\(2  π\)dθ\/\(\(\ \)\(θ\& . \)\)

    below\ \ critical\ \(speed : \ 
        Period\ of\ oscillation\ T\_O\)

    	T\_O = 
      4 \(∫\_0\%\(θ\_m\)dθ\/\(\(\ \)\(θ\& . \)\)\)

    where\ \ \((θ\& . \_0)\)\^2 = 
      2 \( g\/ℓ\) \((1 - cos\ θ\_m\ )\)

    \)\)\)

qdot[qd0_, gol_, 
          q_] := (qd0^2 - 
              2*gol*(1 - Cos[q]))^ .5;
qdot0[qmax_, 
          gol_] := (2*
              gol*(1 - Cos[qmax]))^ .5;
qmaxed[qd0_, gol_] := 
        ArcCos[1 - (qd0^2)/(2*gol)];
ttend[gm_, gol_] := 
        NIntegrate[(4*gm^2 - 2*(1 - Cos[q]))^(- .5), {q, 0, 
              2*Pi}]/gol;

tq1[qd0_, gol_] := 
        NIntegrate[
          1/(qdot[qd0, gol, q]), {q, 0, 2*Pi}];
tq2[qd0_, gol_]:=4*NIntegrate[1/(qdot[qd0, gol, q]),{q, 0, qmaxed[qd0, gol]}
,MaxRecursion ->  30,MinRecursion -> 12];

g1 = 
        Plot[tq2[qd, 1]/(2*Pi), {qd, 0.01, 1.99},  
          PlotRange  -> { {0, 3}, {0, 10}}, 
          DisplayFunction -> Identity];

    g2 = 
        Plot[tq1[qd, 1]/(2*Pi), {qd, 2.01, 6},  
          PlotRange  -> { {0, 3}, {0, 10}}, 
          DisplayFunction -> 
            Identity];

Show[g1, g2,  PlotRange  -> { {0, 6}, {0, 3}}, 
      DisplayFunction -> $DisplayFunction]

len = 1; 
    mgscale =  .125*len;
gol = 1; 
    qd0 = 1.5*5^ .5*gol;
solution=NDSolve[{qq''[t]==-1*gol*Sin[qq[t]],qq[0] == 0,qq'[0] == qd0},qq,{t, 0, 25},MaxSteps -> 2000];
qd[t_] := 
        First[First[
            Evaluate[{qq[t]} /. solution]]];
xd[
        t_] := len*Cos[qd[t] - Pi/2]; 
    yd[t_] := len*
        Sin[qd[t] - Pi/2];
Tln[
          t_] := (((qd'[t])^2)/(gol) + Cos[qd[t]])*
          mgscale;
Null

Animate[
	Show[
	Graphics[{RGBColor[.3,.3,.3],Line[{{xd[t],  yd[t]}, {0, 0}}]}],

	Graphics[{RGBColor[.2,.6,.6],Disk[{xd[t], yd[t]}, { .1,  .1}]}],
	Graphics[{RGBColor[.2,.2,.8],Arrow[{xd[t],  yd[t]}, {xd[t],  yd[t] - mgscale}, 
                    HeadLength  ->   .04]}],
	Graphics[{RGBColor[.8,.2,.2],Arrow[{xd[t],  
                      yd[t]}, {(1 - Tln[t])*xd[t],  (1 - Tln[t])*
                        yd[t]}, HeadLength  ->   .04]}],
	PlotRange  -> { {-1.8, 1.8}, {-1.8, 
                  1.8}},ImageSize->{288, 288},AspectRatio -> 1],
{t, 0, tq1[qd0, gol], tq1[qd0, gol]/25}]

Do[
t = tus*tq1[qd0, gol];	
Display[ToString[
                StringForm["C:\\mmanim\\vcircle\\vc_v_lg``.gif", tus]],
	Show[
	Graphics[{RGBColor[.6,.6,.6],Thickness[ .01],Line[{{xd[t],  yd[t]}, {0, 0}}]}],

	Graphics[{RGBColor[.2,.6,.6],Disk[{xd[t], yd[t]}, { .1,  .1}]}],
	Graphics[{RGBColor[.2,.2,.8],Arrow[{xd[t],  yd[t]}, {xd[t],  
                            yd[t] - mgscale}, HeadLength  ->   .04]}],
	Graphics[{RGBColor[.8,.2,.2],Arrow[{xd[t],  
                            yd[t]}, {(1 - Tln[t])*
                              xd[t],  (1 - Tln[t])*yd[t]}, 
                          HeadLength  ->   .04]}]

,DisplayFunction -> $DisplayFunction,ImageSize -> {500, 500},PlotRange  -> { {-1.8, 1.8}, {-1.8, 
                        1.8}},AspectRatio -> 1]
	,"GIF"]
	,  {tus,  .01, 1.0,  .01}]