normal order

Monday, March 28, 2016

today in oblique approaches

If your standard library offers complex numbers and you're not in any hurry, you can't ask for much simpler (or more obscure!) ways to compute Π than this.
import Data.Complex (magnitude, Complex((:+)))
pi = length $ takeWhile (< 2) $ map magnitude zs
where
zs = iterate (\z -> z^2 + ((-0.75) :+ 0.0000001)) 0
view raw mandelbrot_PI.hs hosted with ❤ by GitHub
Posted by sacheie at 3:06 PM 0 comments
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: complex plane, curio, fractals, real numbers
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2019 (1)
    • ►  June (1)
  • ►  2018 (2)
    • ►  May (1)
    • ►  March (1)
  • ►  2017 (6)
    • ►  December (1)
    • ►  May (1)
    • ►  March (1)
    • ►  February (3)
  • ▼  2016 (5)
    • ►  June (1)
    • ▼  March (1)
      • today in oblique approaches
    • ►  February (2)
    • ►  January (1)
  • ►  2015 (11)
    • ►  December (4)
    • ►  November (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  March (1)
    • ►  February (2)
  • ►  2014 (3)
    • ►  September (1)
    • ►  August (1)
    • ►  January (1)
  • ►  2012 (2)
    • ►  July (1)
    • ►  April (1)
  • ►  2011 (4)
    • ►  October (1)
    • ►  June (1)
    • ►  May (1)
    • ►  February (1)
  • ►  2009 (1)
    • ►  October (1)
Powered by Blogger.