Skip to content

Instantly share code, notes, and snippets.

@carsten-j
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carsten-j/b97b62c5bc39136426ec to your computer and use it in GitHub Desktop.
Save carsten-j/b97b62c5bc39136426ec to your computer and use it in GitHub Desktop.
Alternative impl
let iterate c = Seq.unfold (fun z -> Some(z ** 2.0 + c, z ** 2.0 + c)) Complex.Zero
let countIterations startingPoint maxIterations =
iterate startingPoint
|> Seq.truncate maxIterations
|> Seq.takeWhile (fun z -> z.Magnitude < 2.0)
|> Seq.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment