\(\( (*\ 
      planar\ pendulum\ with\ initial\ condition\ x = 
        0
	\((x\ stands\ for\ the\ angle\ theta\ in\ the\ notes)\), \ 
      p = \(pin = YOUR\ CHOICE\)\ , \ below\ I\ picked\ 1\ , \ 
      you\ can\ try\ other\ values, \ 
      the\ 
		separation\ is\ at\ pin = 2\ ; 	

      You\ can\ also\ adjust\ tmax\ the\ time\ you\ run\ the\ ODE*) 

    pin = 1; tmax = 20; 

    
 (*\ You\ do\ not\ need\ to\ modify\ anything\ below\ *) 
 (*\ 
      building\ the\ vector\ field\ \((v, w)\)\ *) 

    h[x_, p_] := \((1/2)\)*\((p^2)\) + g*\((1 - Cos[x])\); 
g = 1; 

    v[t_] := D[h[x, p], p] /. {x -> x[t], p -> p[t]}; 

    w[t_] := \(-D[h[x, p], x]\) /. {x -> x[t], p -> p[t]}; 
{v[t], w[t]}; 
    
 (*\ Integrating\ the\ differential\ equation\ *) 
acgoal = 10; 

    precgoal = 16; 

    aa = NDSolve[{\(x'\)[t] == v[t], \(p'\)[t] == w[t], x[0] == 0, 
          p[0] == pin}, {x, p}, 
	{t, 0, tmax}, MaxSteps -> 10000, 
	
        AccuracyGoal -> acgoal, PrecisionGoal -> precgoal]; 

    fig = ParametricPlot[{\((x[t] /. aa)\)[\([1]\)], 
          \((p[t] /. aa)\)[\([1]\)]}, {t, 0, tmax}, PlotPoints -> 2000, 
        AxesLabel -> {x, p}, PlotRange -> All]

\)\)