0

I have a mapping function (cubic logistic map) $f(x)=rx(1-x^2)$ and I need to make multiple bifurcation diagrams, showing stable equilibria and periodic orbits for $400$ equally spaced $r$ values between $0$ and $3$. Once for $x_0=0.7$ and another diagram for $x_0=-0.7$ I tried to do this, but it is only plotting one of the stable points at a time instead of the typical chaotic branching I'd like to make. How could I modify my code to do this?

My attempt:

iterfunc[r_] := Nest[r # (1 - #^2) &, 0.7, 1200];
iterfunc2[r_] := Nest[r # (1 - #^2) &, -0.7, 1200];
rvalues = Range[0, 3., 3/400];
rResults = iterfunc /@ rvalues;
rResults2 = iterfunc2 /@ rvalues;

ListPlot[Transpose[{rvalues, rResults}], AxesLabel -> {r}, 
  PlotStyle -> Directive[Blue]]

ListPlot[Transpose[{rvalues, rResults2}], PlotStyle -> Directive[Red]]

ListPlot[
 {Transpose[{rvalues, rResults}], 
  Transpose[{rvalues, rResults2}]}, 
  PlotStyle -> {Directive[Blue], Directive[Red]}]
xyz
  • 605
  • 4
  • 38
  • 117
Kenny L
  • 63
  • 1
  • 6
  • 2
    Please do not post a new question that is simply an updated version of your prior question that itself was closed as a duplicate (what is wrong with the answers in the linked reason for closing there - multiple methods to do what you're after are shown). In any case, edit your original, it will be marked for review of re-opening. – ciao Jun 03 '15 at 05:53
  • I am not just asking how to get the final result. I am wondering why it is that my method is giving me part of the solution as opposed to the plot I'm trying to recreate. I am new to Mathematica and I believe making my own method will help me learn it better, but as of yet I have received zero help in figuring out why my code only plots part of the diagram. – Kenny L Jun 03 '15 at 06:07

2 Answers2

4

I am not sure if this is what you are wanting:

im[r_] := r # (1 - #^2) &
it[r_, n_, s_] := Nest[im[r], s, n]
bd[n_, s_, d_] := 
 ListPlot[Table[{j, it[j, n, #]}, {j, 0, 3, d}] & /@ {s, -s}, 
  PlotStyle -> Red]
Manipulate[
 bd[1200, x0, d], {x0, 0, 1, 
  Appearance -> "Labeled"}, {{d, 0.01}, {0.1, 0.01, 0.005, 0.001}}]

enter image description here

ubpdqn
  • 60,617
  • 3
  • 59
  • 148
1

This is not an answer but a remark on a funny optical illusion related to the bifurcation map question.

Consider this

f[x_] := r x (1 - x^2)

Nest[f, 1/2, 8]

Notice that the lines of the output seem to have a positive slope, although they are perfectly horizontal.

Dr. Wolfgang Hintze
  • 13,039
  • 17
  • 47
  • Never fear, you can make it straight again by de-rotating: Rotate[Nest[f, 1/2, 10], -0.5 Degree] – bill s Jun 03 '15 at 11:28
  • @ bill s : very nice, thanks. I didn't know that Rotate[] works also for normal source code (for example Rotate[x^2 + a x + b, 90 Degree]). – Dr. Wolfgang Hintze Jun 03 '15 at 12:36