Discrete Logistic Equation

Manipulate[
ListLinePlot[
      If[ drugi,
     {NestList[λ # (1-#)&,x0,maxT],
     NestList[λ # (1-#)&,If[x0+roz<0,0,If[x0+roz>1,1,x0+roz],x0+roz],maxT]},
       NestList[λ # (1-#)&,x0,maxT]] ,
      PlotRange->{0,1},
      PlotStyle->{Directive[RGBColor[.6,.73,.36], Thick] ,If[drugi,RGBColor[1,.47,0], RGBColor[.6,.73,.36]]},
     DataRange->{0,maxT},
     ImageSize->{600,350},ImagePadding->20
  ],
{{λ,2,"parameter λ"},0,4,0.01, Appearance->"Labeled"},
{{x0,0.3,"initial value (Subscript[x, 0])"},0,1,0.01, Appearance->"Labeled"},
{{maxT, 50, "end time"}, 10, 100, 1},
{{drugi, True, "second solution?"}, {True, False}},
{{roz, 0, "difference h between initial values"}, -x0, 1-x0, 0.01, Appearance->"Labeled"}
]

The discrete logistic equation is (Subscript[x, n+1])=(Subscript[λx, n])(1-(Subscript[x, n])). Vary λ to observe the change in behavior of the solution, with chaotic behavior when λ=4. Change the initial value (Subscript[x, 0]) to observe the dependence of the dynamics on the initial value. Alter checking the second solution check box, observe the second solution that starts at (Subscript[x, 0])+h, which illustrates the sensitivity of the solutions to the initial data. The last slider allows you to change the difference h.

Contributed by: Marek Bodnar

After work by: Phil Ramsden