On this site I have found many bifurcation algorithms which work exceptionally well for many cases, but for the following differential equation, they do not seem to work: $$\dot\theta=\frac{\sin(\theta)}{\mu+\cos(\theta)}$$

I got an idea of the bifurcation diagram by drawing it by hand, lines parallel to the $\mu$-axis with holes at $(1,\pi),(0,-\pi),(-1,\pi),$ etc.., but I was looking for something more precise. Can anyone help me create a bifurcation diagram with flow fields?

I was looking something similar to

enter image description here

  • 3
    $\begingroup$ "but for the following differential equation, they do not seem to work" - any code to support that statement? $\endgroup$ Oct 25, 2018 at 3:16
  • $\begingroup$ This equation can be solved symbolically. $\endgroup$ Oct 25, 2018 at 6:02

2 Answers 2


This is a pretty interesting problem. First, define the right-hand side.

f[θ_, μ_] := Sin[θ]/(μ + Cos[θ]);

If $|\mu|>1$, there are only the proper equilibria you noted at $\theta=n\pi$:

Plot[f[θ, 1.5], {θ, 0, 4 π}, AxesLabel -> {"θ", "θ'"}]

Mathematica graphics

However if $|\mu|<1$ the denominator might equal zero, resulting in the following:

Plot[f[θ, 0.5], {θ, 0, 4 π}, AxesLabel -> {"θ", "θ'"}]

Mathematica graphics

Those $\theta$ values where the denominator equals zero must also behave like stable equilibria, since $d\theta/dt>0$ below and $d\theta/dt<0$ above. I'll call them improper equilibria for lack of a better term. Any dynamicists please comment on the real name. They occur at $\theta=arccos(-\mu)$.

The following plots the proper and improper equilibria. I use linearization to assess the stability of the proper equilibria and just assume the improper ones are stable. Solid = stable, dashed = unstable.

λ[θ_?NumericQ, μ_?NumericQ] = D[f[θ, μ], θ];
eq = ContourPlot[{
  ConditionalExpression[f[θ, μ], λ[θ, μ] < 0] == 0, 
  ConditionalExpression[f[θ, μ], λ[θ, μ] > 0] == 0,
  (μ + Cos[θ]) == 0}, {μ, -2, 2},
  {θ, -10^-5, 4 π + 10^-5}, ContourStyle -> {Black, {Black, Dashed}},
  MaxRecursion -> 3, FrameLabel -> {μ, θ}]

Mathematica graphics

Finally, add some flow arrows.

streams = VectorPlot[{0, Sign[f[θ, μ]]}, {μ, -2, 2}, {θ, 0, 4 π},
  VectorMarkers -> "Arrow", VectorScale -> Tiny, 
  VectorPoints -> Flatten[Table[{μ, θ}, {μ, -1.8, 1.8, 0.2}, {θ, 0.25 π, 3.75 π, 0.5 π}], 1]];
Show[streams, eq, PlotRange -> {{-2, 2}, {0, 4 π}}, FrameLabel -> {μ, θ}]

Mathematica graphics

Verifying the behavior of the improper equilibria with NDSolve requires some trickery. Edit: My previous attempt at getting NDSolve to work was wrong, so I removed it.


What about this:

StreamDensityPlot[{0, Sin[\[Theta]]/(\[Mu] + Cos[\[Theta]])}, {\[Mu], -3,3},{\[Theta], -Pi, Pi}, ColorFunctionScaling -> False, ColorFunction ->"TemperatureMap", FrameLabel -> {\[Mu], \[Theta]}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.