I have existing code to plot bifurcation diagram for coupled first order differential equations. It seems to work for coupled differential equations. To test the code further, I use the simplest case which is a logistic map. However, it is in iteration format. Therefore, it needs to be converted to first order differential equation form. The plot shows me incorrect results. I still want to use the same code because I can use it for coupled differential equations. I do not understand why it does not work for single differential equation.
Remove[x, data1, dsol, xt];
LogisticODE[r_] := x'[t] - r*x[t] (1 - x[t]) + x[t] == 0;
solution2[r_] :=
NDSolve[{LogisticODE[r], x[0.] == 0.5}, x, {t, 0, tmax},
MaxSteps -> Infinity];
(* Bifurcation Plot *)
tmax = 1000 T; tmin = tmax - 50 T;
w = 7;
T = 2 Pi/w;
data1 = {};
For[A1 = 0.0, A1 <= 4.0, A1 += 0.01,
dsol = solution2[A1];
xt = x[t] /. dsol[[1]];
For[t = tmin, t <= tmax, t += T, AppendTo[data1, {A1, N[xt]}]];
Clear[t]] // AbsoluteTiming
{8.58766, Null}
ListPlot[data1, PlotRange -> Automatic, Frame -> True, Axes -> False,
PlotStyle -> {PointSize[0.006]}]
I have tried $ x'[t]- r x[t] (1 - x[t])$ and $ x'[t]- (r x[t] (1 - x[t])-x[t])/T^2$ But still, I do not get a proper bifurction diagram for logistic map because I believe that transformation from map to ODE is incorrect or code need to change slightly for single ODE equation. Why I am not getting a correct bifurcation diagram? What I am missing?
LogisticODE[r]
. $\endgroup$