The time dependent pendulum

Equation of motion

pendulum[α_,β_,γ_]:=D[θ[t],{t,2}]+γ D[θ[t],{t,1}]+(α-β Cos[t])Sin[θ[t]]

pendsol[α_,β_,γ_,pos_,vel_,init_,fint_,maxstep_]:=NDSolve[{pendulum[α,β,γ]==0,θ[init]==pos,(D[θ[t],t]/.t->init)==vel},θ,{t,init,fint},Method->{"Automatic"},MaxSteps->maxstep]

list of available options for the numerical integrator

Options[NDSolve]

Ways to plot a solution

sol[1]=Evaluate[{θ[t],Mod[θ[t],2 π,-π],D[θ[t],t]}/.pendsol[0.5,0.63,0.03,0.,0.1,0.,1.0 (10^4),2 (10^5)][[1]]]

Phase-space plot

plotting : parametric plots draws lines between the spurious discontinuities introduced by the mod 2 π operation

ParametricPlot[Evaluate[Table[sol[1][[i]],{i,2,3}]],{t,0,13π}]

ParametricPlot[Evaluate[Table[sol[1][[i]],{i,2,3}]],{t,0,(10^3)}]

plotting : plotting points removes the problem

ListPlot[Table[Evaluate[{sol[1][[2]],sol[1][[3]]}/.t->(10^(-2))i],{i,0,Ceiling[((13π)/(10^(-2)))]}],Joined->False,Filling->False,PlotStyle->Directive[Red,PointSize[Tiny]]]

ListPlot[Table[Evaluate[{sol[1][[2]],sol[1][[3]]}/.t->(10^(-2))i],{i,0,(10^5)}],Joined->False,Filling->False,PlotStyle->Directive[Red,PointSize[Tiny]]]

Plot of the angular variable

After a transient for the initial value we used the trajectory converges to to a periodic orbit. See

Hyperlink[Chaos:From Simple Models to Complex Systems,"http: //denali.phys.uniroma1.it/~chaosbookCCV09/Site/%22 Chaos %3 A_from _simple _models _to _complex _systems %22 _companion _site.html"]

by Massimo Cencini, Fabio Cecconi and Angelo Vulpiani (2009) for more details

Plot[Evaluate[sol[1][[1]]],{t,0,4.0 (10^3)}]

Plot of the angular variable modulo 2 π in the interval [-π,π]

DiscretePlot[Evaluate[sol[1][[2]]],{t,Table[(10^(-2))i,{i,0,(10^4)}]},Joined->False,Filling->False,PlotStyle->Directive[Red,PointSize[Tiny]]]

mathematica provides the exclusion command to remove discontinuities but it is  slow and not very reliable.

Plot[Evaluate[sol[1][[2]]],{t,0,4 π},Exclusions->{Sin[sol[1][[2]]]==0}]