Skip to content

Instantly share code, notes, and snippets.

@1tgr
Created December 3, 2012 23:32
Show Gist options
  • Select an option

  • Save 1tgr/4199059 to your computer and use it in GitHub Desktop.

Select an option

Save 1tgr/4199059 to your computer and use it in GitHub Desktop.

Chaotic Sequence

Logistic Map definition

let logistic a x0 = Seq.unfold (fun xn -> Some(xn, a * xn * (1.0 - xn))) x0

For low a, the sequence is converging to a fixed point

let f_stable = logistic 1.0 0.2 |> Seq.take 100 |> Seq.toArray

As a goes up, the sequence becomes cyclical

let f_cycle = logistic 3.0 0.2 |> Seq.take 100 |> Seq.toArray

Increase a more, and we pass from 2-cycles to 4-cycles

let f_cycle4 = logistic 3.5 0.2 |> Seq.take 100 |> Seq.toArray

For values of a close to 4.0, the sequence becomes chaotic, with no cycles

let f_chaos = logistic 3.9 0.2 |> Seq.take 100 |> Seq.toArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment