6 \(x''(t)+f(x)x'(t)+x(t)=0\) and periodic solutions

This shows dependence of having perodic solutions for \(x''(t)+f(x)x'(t)+x(t)=0\) where \(f(x)=x^2+x+a\) on the value of \(a\). This simulations shows the solution and the phase space as \(a\) changes from \(-2\) to \(1\). A specific orbit with I.C. \(x(0)=1,x'(0)=0\) is highlighted in red.


Pause Play Restart Step forward Step back

The program is written using Mathematica. Here is the notebook

Source code

(*version 2:21 AM, 4/16/2020 *) 
Manipulate[ 
 Module[{f1, f2, x1, x2, sol, x, t, ode}, 
  f1 = x2; 
  f2 = (-x1^2 - x1 - a)*x2 - x1; 
  ode = x''[t] + (x[t]^2 + x[t] + a)*x'[t] + x[t] == 0; 
  sol = NDSolve[{ode, x[0] == 1, x'[0] == 0}, x, {t, 0, 30}]; 
  Grid[{ 
    {Row[{"a = ", NumberForm[a, {4, 2}]}]}, 
    { 
     StreamPlot[{f1, f2}, {x1, -5, 5}, {x2, -7, 7}, 
      ImageSize -> 300, 
      StreamPoints -> {{{{1, 0}, Red}, Automatic}}], 
     Plot[Evaluate[x[t] /. sol], {t, 0, 30}, 
      PlotRange -> {Automatic, {-4, 4}}, 
      ImageSize -> 300, 
      GridLines -> Automatic, GridLinesStyle -> LightGray, 
      PlotStyle -> Red, 
      AxesLabel -> {"time", "x(t)"}, 
      BaseStyle -> 12, 
      PlotLabel -> "Solution to  x''+f[x] x' + x = 0" 
      ] 
     } 
    } 
   ] 
  ], 
 {{a, -2, "a"}, -2, 1, 0.1, Appearance -> "Labeled"}, 
 TrackedSymbols :> {a} 
 ]