simonjtyler

Mandelbrot One-Liner

Dec 1st, 2011
448
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (* http://blog.wolfram.com/2011/12/01/the-2011-mathematica-one-liner-competition/ *)
  2. (* Stephan Leibbrandt's Mandelbrot one-liner *)
  3.  
  4.  
  5. (* Escape times for Mandelbrot set *)
  6.  
  7. data = Compile[{}, Block[{i, x, p},
  8. Table[i = 0; x = 0. I; p = r + I c;
  9. While[Abs@x <= Sqrt[2] && i < 9^3, x = x^2 + p; ++i];
  10. i, {c, -1, 1, .01}, {r, -2, 1, .01}]]][];
  11.  
  12.  
  13. (* Examine behaviour of scaling function tanh *)
  14.  
  15. Manipulate[Plot[Tanh[Power[x/c, (i)^-1]], {x, .1, 9^3},
  16. PlotRange -> {0, 1}], {c, 1, 729}, {i, 1, 10}]
  17.  
  18.  
  19. (* Note that image interprets a 2d array of numbers as a grayscale data. *)
  20. (* Numbers outside of [0,1] are truncated. As a simple example, play with *)
  21.  
  22. Image[Table[i*j/100, {i, 10}, {j, 10}]]
  23.  
  24.  
  25. (* Produce a range of Mandelbrot images *)
  26.  
  27. Table[{i, c, Image[Tanh[Power[data/9.0^c, (i)^-1]],
  28. ImageSize -> Small]}, {i, 2, 10}, {c, 1, 3}]
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×