Advertisement
Matthen

Julia Set

Mar 29th, 2014
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. c = -0.2546715638093696` - 0.6936732634062556` I;
  2. n = 12;
  3. step[ps_, t_] := With[{ps2 = Sqrt[ps - c]},
  4. Which[
  5. t < 1, (* shifting *)
  6. ps - t c,
  7. 1 <= t < 2, (* square rooting *)
  8.  
  9. Map[#^(1 - 0.5 (t - 1)) &, ps - c],
  10. 2 <= t <= 3, (* duplicating *)
  11. Join[ps2, ps2 + -2 (t - 2) ps2]
  12. ]
  13. ];
  14. topts[ps_] := Map[{Im[#], Re[#]} &, ps];
  15. p0 = Join[
  16. Table[0.7 (Cos[\[Theta]] + I Sin[\[Theta]]), {\[Theta], 0, 2 Pi,
  17. 0.1}], Table[
  18. 0.2 (Cos[\[Theta]] + I Sin[\[Theta]] + 0.8 + I), {\[Theta], 0,
  19. 2 Pi, 0.2}],
  20. Table[0.1 (Cos[\[Theta]] + I Sin[\[Theta]] - 3 + I), {\[Theta], 0,
  21. 2 Pi, 0.4}]];
  22. ps = NestList[step[#, 3] &, p0, n];
  23. Manipulate[
  24. Graphics[
  25. {Darker@Darker@Blue,
  26. Point[topts[step[ps[[Floor[t]]], 3 Mod[t, 1, 0]]]]},
  27. PlotRange -> 2, Background -> RGBColor[0.8, 0.9, 1.0]
  28. ],
  29. {t, 1, n + 0.99}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement