Code for pendulum without friction
In[35]:=
<<Local`NullclinePlot` grayRegions = NullclinePlot[ {v, - 8 Sin[x]}, {x, -10, 10}, {v, -10, 10}, Nullclines -> True, NullclineShading -> True]; solution[{x0_, v0_}] := {x[t], v[t]} /. First[NDSolve[{ x'[t] == v[t], v'[t] == -8 Sin[x[t]], x[0] == x0, v[0] == v0}, {x[t], v[t]}, {t, -8, 10}]] initialValues = Join[ Table[{Pi, y}, {y, -7, 7, 1.6}], Table[{x, 0}, {x, -2 Pi, -Pi, Pi/4}], Table[{x, 0}, {x, 0, Pi, Pi/4}], Table[{x, 0}, {x, 2 Pi, 3 Pi, Pi/4}]]; orbits = ParametricPlot[Evaluate[Map[solution, initialValues]], {t, -8, 10}, DisplayFunction -> Identity]; Show[grayRegions, orbits, DisplayFunction -> $DisplayFunction, PlotRange -> {{-10, 10}, {-10, 10}}, FrameTicks->{{-5, 0, 5}, {-5, 0, 5}}, Epilog -> {{White, AbsolutePointSize[4], Point /@ initialValues}, Text[x, {10, -10.3}, {1, 1}], Text[x', {-10.2, 10}, {1, 1}]}];
If your output will be a sequence of graphs, select a display option.
Display as:
individual images
a movie
both of the above
In[36]:=
(* via VisualDSolve package <<Local`VisualDSolve` SecondOrderPlot[x'' == -8 Sin[x], x, {t, 0, 10}, {x, -10, 10}, {x', -10, 10}, Nullclines -> True, ShowInitialValues -> True, PointColor -> White, NullclineShading -> True, StayInWindow -> True, InitialValues -> Join[Table[{Pi, y}, {y, -7, 7, 1.6}], Table[{x, 0}, {x, -2 Pi, -Pi, Pi/4}], Table[{x, 0}, {x, 0, Pi, Pi/4}], Table[{x, 0}, {x, 2 Pi, 3 Pi, Pi/4}]]] *)
If your output will be a sequence of graphs, select a display option.
Display as:
individual images
a movie
both of the above
Up to
Appendix: Code generating the examples