Skip to main content

differential equations - Plotting a Bifurcation diagram


I have the following system equation


v'(t)=2*G*J1[v(t-τ)]cos(w*τ)-v(t)

How do you plot the bifurcation diagram, τ in the x axis, Vmax in the y axis? I have written these lines but how can one plot using the following



Table[NDSolve[{v'[t] == 
2*G*BesselJ[1, v[t - τ + i]]*Cos[ω*(τ + i)] -
v[t], v[0] == 0.001}, v, {t, 0, 500}], {i, 0, 4, 0.01}]

τ is varied from 1 to 4 using step 0.01,G=3.55, ω=2*Pi*12*10^6



Answer



An alternative representation is


G = 3.55; ω = 2*Pi*12*10^6;
s = ParametricNDSolveValue[{v'[t] == 2*G*BesselJ[1, v[t - τ]] Cos[ω*τ] - v[t],
v[t /; t <= 0] == 0.001}, {v, v'}, {t, 0, 120}, {τ}];

Manipulate[ParametricPlot[{s[τ][[1]][t], s[τ][[2]][t]}, {t, 60, 120},
AxesLabel -> {v, v'}, AspectRatio -> 1], {{τ, 2}, 1, 4}]

enter image description here


Note that the diagram becomes progressively more complex as τ is increased, and the run time increases correspondingly.


Addendum


The bifurcations can be seen even more clearly from a return map, for instance,


tab = Table[{sol, points} = Reap@NDSolveValue[{v'[t] == 
2*G*BesselJ[1, v[t - τ]] Cos[ω*τ] - v[t], v[t /; t <= 0] == 0.001,
WhenEvent[v'[t] > 0, If[t > 150, Sow[v[t]]]]}, {v, v'}, {t, 0, 250}];

{τ, #} & /@ Union[Flatten[points], SameTest -> (Abs[#1 - #2] < .05 &)],
{τ, 1.7, 2.4, .01}];
ListPlot[Flatten[tab, 1]]

enter image description here


where v is sampled whenever v' passes from positive to negative values. A blow-up of the map near the transition to chaos is (with SameTest deleted)


enter image description here


It is anyone's guess precisely where the transition to chaos occurs. Perhaps, very near τ = 2.32.


enter image description here


Additional Material in Response to Comments



Recent comments by udichi, the OP, and by Chris K prompted me to consider this problem further. Stability windows typically occur within the chaotic region, udichi now wanted to see them. A straightforward three-hour computation produced interesting results, but no windows. (Note that WorkingPrecision -> 30 is used to reduce the chance that numerical inaccuracies might corrupt the results.)


tab = ParallelTable[{sol, points} = 
Reap@NDSolveValue[{v'[t] == 2*G*BesselJ[1, v[t - τ]] Cos[ω*τ] - v[t],
v[t /; t <= 0] == 10^-3, WhenEvent[v'[t] > 0, If[t > 500, Sow[v[t]]]]}, {v, v'},
{t, 0, 1000}, WorkingPrecision -> 30, MaxSteps -> 10^6]; {τ, #} & /@
Union[Flatten[points]], {τ, 1, 15, 1/100}];
ListPlot[Flatten[tab, 1], AspectRatio -> .75/GoldenRatio,
ImageSize -> Full, PlotStyle -> PointSize[Tiny]]

enter image description here



Here are diagrams for interesting values of τ. Typical plots for τ > 8 are


f[τ_] := Module[{}, 
ss = NDSolveValue[{v'[t] == 2*G*BesselJ[1, v[t - τ]] Cos[ω*τ] - v[t],
v[t /; t <= 0] == 10^-3}, {v, v'}, {t, 0, 1000},
WorkingPrecision -> 30, MaxSteps -> 10^6];
GraphicsRow[{ParametricPlot[Through[ss[t]], {t, 500, 1000},
AxesLabel -> {v[t], v'[t]}, AspectRatio -> 1, PlotPoints -> 200],
ParametricPlot[First[ss][#] & /@ {t, t - τ}, {t, 500, 1000},
AxesLabel -> {v[t], v[t - τ]}, AspectRatio -> 1, PlotPoints -> 200]},
ImageSize -> Large]]


f[15]

enter image description here


The left plot depicts v' vs. v, similar to some of the earlier plots although much more chaotic. The solution appears to move randomly between two chaotic attractors. The right plot depicts v[t - τ] vs. v[t], as suggested here. The advantage of this alternative representation will soon become evident. Typical plots from the transition region, centered around τ == 7, are


f[15/2]

enter image description here


while typical plots from smaller but chaotic values of τ look much different.


f[3]


enter image description here


Finally, plots for τ = 2.285, the approximate onset of chaos (as determined by Chris K) are


enter image description here


Plots for τ as large as 2.4 are qualitively similar, although obviously chaotic. This suggests computing a return map based on v[t - τ] == 2.5.


tab = ParallelTable[{sol, points} = 
Reap@NDSolveValue[{v'[t] == 2*G*BesselJ[1, v[t - τ]] - v[t],
v[0] == 10^-3, tem[0] == 1500, WhenEvent[v[t] > 5/2, tem[t] -> t],
WhenEvent[t > tem[t] + τ, If[t > 1500, Sow[v[t]]]]}, {v[t], tem[t]}, {t, 0, 2200},
DiscreteVariables -> {tem}, WorkingPrecision -> 30, MaxSteps -> 10^6];

{τ, #} & /@ Flatten[points], {τ, 225/100, 240/100, 1/2000}];
ListPlot[Flatten[tab, 1], AspectRatio -> .75/GoldenRatio, ImageSize -> Full,
PlotStyle -> PointSize[Tiny]]

enter image description here


It shows the transition to chaos (at about τ = 2.286) as well as the first three windows of stability within the region of chaos. Note that a comparatively long run-time in t is necessary to allow solutions near bifurcation points to reach asymptotic states. High resolution in τ is, of course, also needed. Incidentally, this last computation throws the warning message described in the second section of question 157889, but it can be ignored.


Plots in Windows of Stability


As suggested by Chris K, it may be useful to provide plots in the three windows of stability shown in the last figure.


f[2303/1000]


enter image description here


f[2330/1000]

enter image description here


f[2348/1000]

enter image description here


These plots differ strikingly from their chaotic neighbors, say τ == 3, above.


Comments

Popular posts from this blog

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...

mathematical optimization - Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. vars = u@# & /@ Range[3]; cons = Flatten@ { Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; Minimize[{Total@((vec1[[#]] - vec2[[u[#]]])^2 & /@ Range[1, 3]), cons}, vars, Integers] The error I get: Part::pkspec1: The expression u[1] cannot be used as a part specification. >> Answer Ok, it seems that one can get around Mathematica trying to evaluate vec2[[u[1]]] too early by using the function Indexed[vec2,u[1]] . The working MWE would then look like the following: vars = u@# & /@ Range[3]; cons = Flatten@{ Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; NMinimize[ {Total@((vec1[[#]] - Indexed[vec2, u[#]])^2 & /@ R...

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]