Chaotic behaviour arises from very simple number transformation. Plots (blue pen dots) final results of repeating: Xnext → R*X(1-X) then shows sample of oscillations (moving red circle). If x is .01 and R=1 then Xnext time is .01(1 - .01). Keep repeating that and plot where x ends up. Then we gradually increase R, and repeat the x transformations. When R just over 3, the transformation doesn't settle on one final x, but two! That's a bifurcation (watch the red sprite). Then when R is larger, there are 4 final x oscillating, another bifurcation, then for larger R it gets really chaotic.
This is chaotic behavior resulting from a deterministic and simple transformation: Xnext → R*X(1-X) That so-called logistic equation is a simple iterated transformation that has a built in limiting feedback (like a population that begins to starve after eating all it's resources). Robert May discovered this case of deterministic chaos in 1976, doing these x calculations without a fancy computer. Here, we start at x = .01 and R=1, and iterate the x transformation of 50 times, then we increase R by a bit, repeats all this until R=4. I picked 50 repetitions because the resulting x levels seems to stabilize after that many. This also and keeps code simple. Red sprite traces oscillations staring at R=2.5 (to highlight the oscillations resulint in this blue map of points). Aim is a quick and simple demonstration. (No need for turbo, and turbo makes the final oscillation demo with red sprite to quick to see)