(*very basic simulation of damped and driven pendulum*)
(*exhibit chaotic motion using only Dynamics, not Manipulate. CDF file *)
(* can be created with just dynamics
(* by Nasser M. Abbasi, Nov 10, 2012 *)

DynamicModule[{sol,angle,bob,r,time=0,animationRate=1},

Dynamic@Grid[{
             {Trigger[Dynamic[time],{0,Infinity,0.01},animationRate,
              AppearanceElements->{"PlayPauseButton","ResetButton"}
              ],
               Style["time (sec)",10],
               Dynamic[time]
              }
              ,
              {
              Dynamic@Show[Graphics[{
                          {Dashed,Gray,Thin,Circle[{0,0},1]},
                          {Red,Thick,Line[{{0,0},bob}]},
                          {Blue,PointSize[0.1],Point[bob]}
                          },ImagePadding->10],ImageSize->300],SpanFromLeft
              }
              },Frame->True,Alignment->Left 
              ],

Initialization:>
(
  sol:=First@NDSolve[{y''[t]+0.1 y'[t]+Sin[y[t]]==1.5 Cos[t],
                      y[0]==Pi/4,y'[0]==0},
                      y,{t,time,time+1},Sequence@ndsolveOptions];

  bob:={Sin[(y/.sol)[time]],- Cos[(y/.sol)[time]]};

  ndsolveOptions={MaxSteps->Infinity,
                  Method->{"StiffnessSwitching",
                  Method->{"ExplicitRungeKutta",Automatic}
                 },AccuracyGoal->10,PrecisionGoal->10};
)
]