Bifurcation Diagrams with Flow Fields

bifurcationPoints[eqn_, par_, var_]:= Cases[{par, var}/.Solve[{D[eqn, var]==0, eqn==0}, {var, par}], {Except[_Complex], Except[_Complex]}];

equilibriumCurvePlots[eqn_, {par_, parMin_, parMax_},{var_, varMin_, varmax_}]:= Module[{bifPoints, criticalPoints, parRanges, equilibriumBranches, eigenValues, stabilityCharacteristics, plotSegments},
bifPoints=bifurcationPoints[eqn, par, var];
criticalPoints= Union[{parMin, parMax}, bifPoints[[All, 1]]];
parRanges=Partition[criticalPoints, 2,1];
equilibriumBranches= Solve[eqn==0, var];
eigenValues=D[eqn, var]/.equilibriumBranches;
stabilityCharacteristics=Flatten@Map[If[Re[#]≤  0, Dashing[{}], Dashing[{0.0025,0.01}]]& , Outer[(#1/.par-> #2)&, eigenValues, Mean /@parRanges], {2}];
plotSegments=Distribute[{var/.equilibriumBranches, parRanges}, List];
MapThread[Plot[#1[[1]], Evaluate@Join[{par}, #1[[2]]],PlotStyle-> {Black, Thick,#2}]&, {plotSegments, stabilityCharacteristics}]
]

normalForms={ {"saddle node bifurcation", λ+(y^2)},{"saddle node bifurcation", λ-(y^2)}, {"pitchfork bifurcation supercritical", λ y-(y^3)}, {"pitchfork bifurcation subcritical", λ y+(y^3)},{"transcritical bifurcation", λ y-(y^2)}};

Manipulate[
eqn=normalForms[[type, 2]];
equilibriumPoints=Quiet@Thread[{par, Select[y/.Solve[(eqn/.λ-> par)==0, y], Element[#, Reals]&]}];
Show[If[showStreamLines, StreamPlot[{0, eqn}, {λ, -3, 3}, {y, -3, 3}, StreamColorFunction-> (ColorData["TemperatureMap"][Arg[#4]]&),StreamColorFunctionScaling-> False], Plot[{},{λ, -3, 3}]], If[showEC, equilibriumCurvePlots[eqn, {λ, -3, 3}, {y, -3, 3}],Plot[{},{λ, -3, 3}]], PlotRange-> {{-3,3}, {-3,3}}, Axes-> False, AspectRatio-> 1, PlotLabel-> Style[ToString[normalForms[[type, 1]]]<>"\n equilibrium points: "<> ToString[equilibriumPoints]],Epilog-> Join[{PointSize[Large], Point /@  equilibriumPoints},{PointSize[Large],Brown}, Point /@ bifurcationPoints[eqn, λ, y]],Frame-> True, FrameLabel-> {"λ", Style["y",Italic]},ImageSize->{400,400}],
{{type,3, "((dy)/(dt)) ="}, Array[Rule[#, normalForms[[#,2]]]&, Length[normalForms]] , PopupMenu}, {{par, 0, "bifurcation parameter λ"}, -3, 3,Appearance->"Lab
eled"},  {{showEC, True, "show equilibrium curves"}, {True, False}, Checkbox}, {{showStreamLines, True, "show streamlines"}, {True, False}, Checkbox}, 
ControlPlacement-> {Top, Top, Left, Left},SaveDefinitions-> True,TrackedSymbols->True]

CAPTION

Bifurcations indicate qualitative changes in a system's behavior. For a dynamical system ((dy)/(dt))=f(y,λ), bifurcation points are those equilibrium points at which the Jacobian ((∂f)/(∂y)) is singular. This Demonstration shows the bifurcation diagrams of several normal form bifurcations in one dimension. The bifurcation point, equilibrium points, and the flow of the vector field are visualized. The bifurcation is shown as a brown point. Solid black lines indicate stable equilibrium branches and dashed black lines indicate unstable ones.

DETAILS

R. Seydel, Practical Bifurcation and Stability Analysis: From Equilibrium to Chaos, New York: Springer-Verlag, 1994.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Bifurcation Diagrams with Flow Fields" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/BifurcationDiagramsWithFlowFields/

Contributed by: Suba Thomas

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »