Clear[wd, g, q, w0, th0, ndrive, tlim, sol, th, w, t]

Driven Damped Pendulum

Use dimensionless form of equations of motion.

BLA!!!
                                    BLA!!!
                                         
      BLA!!!
                                                (* Put in Damping factor          *) \(w0\  = \ 0. ; 
    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
     (*\ Initial\ velocity\ \ \ \ \ \ \ \ *) 
th0\  = \ 0. ; 
    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  (*\ 
      Initial\ angle\ \ \ \ \ \ \ \ \ \ \ *) 
ndrive\  = \ 200; 
    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  (*\ 
      Number\ of\ drive\ cycles\ \ *) 

    tlim\  = \ ndrive*2\ Pi/wd\ \ \ \ \ \  (*\ 
      Total\ time\ \ \ \ \ \ \ \ \ \ \ \ \ \ *) 
\)\(sol\  = \ 
      NDSolve[{\(th'\)[t]\  == \ w[t], 

          		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          \(w'\)[t]\ \  == \ FILL\ IN\ THIS\ \(\(PART!!\)!\), \ 

          		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          w[0]\ \  == \ w0, 

          		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          th[0]\  == \ th0}, 

        	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {w, 
          th}, {t, tlim}, \ MaxSteps\  -> 60000]\)

Plot[th[t] /. sol, {t, 800, 900}];

Plot[w[t] /. sol, {t, 800, 900}];

ParametricPlot[{th[t],  w[t]} /. sol,  {t, 800, 900}];

ParametricPlot[{Mod[th[t] + Pi, 2  Pi] - Pi,  w[t]} /. sol, 
       {t, 400, 700}];

\(\( (*\ Poincare\ Section\ *) 

phase\  = \ 0; 

    pw\  = \ Table[0, {i, 20, ndrive}]; 

    Do[{pw[\([i]\)]\  = \ 
          w[\((\((i + 20)\) + \ \ phase\ )\)*2\ Pi/wd\ ] /. sol[\([1]\)]}, {
        i, ndrive - 21}]; \)\)

pw;

\(pth\  = \ Table[0, {i, 20, ndrive}]; 

    Do[{pth[\([i]\)]\  = \ 
          Mod[th[\((\((i + 20)\)\  + \ phase\ )\)*2\ Pi/wd\ ] + \ Pi, 2\ Pi]
                \  - \ Pi /. sol[\([1]\)]}, {i, 1, ndrive - 21}]\)

pth;

ListPlot[Transpose[{pth, pw}], PlotRange -> All, 
      PlotStyle -> PointSize[ .02]];