2
$\begingroup$

I have a differential equation

y''[t] + 0.3*y'[t] - y[t] + (y[t])^3 == A*Cos[114.14*1.2*t]

with y'[0] == 0, y''[0] == 0

t varies from 0 to 1500, A varies from 0 to 1

How to plot bifurcation diagram (y versus A) of the same?

I tried this code

tab = Table[{sol, points} =  Reap@NDSolveValue[{y''[t] + 0.3*y'[t] - y[t] + (y[t])^3 == 0.3*Cos[114.14*1.2*t], y'[0] == 0, y''[0] == 0}, {y}, {t, 0,1500}];
   {\[Tau], #} & /@ 
    Union[Flatten[points], SameTest -> (Abs[#1 - #2] < .05 &)], {A, 
  0.2, 0.8, .02};
  ListPlot[Flatten[tab, 1]]

But it was not working. Any help and suggestions will be appreciated. Thanks.

$\endgroup$
1
  • $\begingroup$ You are using Reap, but where is Sow? Probably ParametricNDSolve is of some help? $\endgroup$
    – Alx
    Commented Nov 4, 2019 at 14:20

1 Answer 1

2
$\begingroup$

You may be looking for something like this,

data = Reap[Do[dsol = 
     NDSolveValue[{y''[t] + 0.3*y'[t] - y[t] + (y[t])^3 == 
        A*Cos[114.14*1.2*t], y''[0] == 0, y'[0] == 0}, 
      y[t], {t, 0, 1500}, MaxStepSize -> 0.01]; 
    Sow[Table[{A, dsol}, {t, 0, 1500}]], {A, 0, 1, 0.01}]][[2, 1]];
ListPlot[data]

Your system looks like a Duffing oscillator and it's always damped within the parameter space you have, i.e. $A\in[0,1]$. Therefore, I think you wouldn't see any bifurcation in your bifurcation diagram.

$\endgroup$
1
  • $\begingroup$ Thank you so much. It worked well. Yes, its a Duffing oscillator. $\endgroup$ Commented Nov 5, 2019 at 10:56

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.