# Plotting the bifurcation diagram for $\dot\theta=\frac{\sin(\theta)}{\mu+\cos(\theta)}$

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

• "but for the following differential equation, they do not seem to work" - any code to support that statement? – Vitaliy Kaurov Oct 25 '18 at 3:16
• This equation can be solved symbolically. – Αλέξανδρος Ζεγγ Oct 25 '18 at 6:02

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 -> {"θ", "θ'"}]


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

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


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 -> {μ, θ}]


streams = VectorPlot[{0, Sign[f[θ, μ]]}, {μ, -2, 2}, {θ, 0, 4 π},

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.
StreamDensityPlot[{0, Sin[\[Theta]]/(\[Mu] + Cos[\[Theta]])}, {\[Mu], -3,3},{\[Theta], -Pi, Pi}, ColorFunctionScaling -> False, ColorFunction ->"TemperatureMap", FrameLabel -> {\[Mu], \[Theta]}]