Skip to content

Instantly share code, notes, and snippets.

@taroyabuki
Last active December 15, 2015 05:49
Show Gist options
  • Save taroyabuki/5211600 to your computer and use it in GitHub Desktop.
Save taroyabuki/5211600 to your computer and use it in GitHub Desktop.
マンデルブロ集合(Mathematica) http://blog.unfindable.net/archives/3512
Clear@f;
f[c_] := f[c, 0., 0]
f[_, _, 100] = -1;
f[c_, z_, i_] := With[{x = z^2 + c}, If[2 < Abs@x, i, f[c, x, i + 1]]]
xMin = -2;
xMax = 1;
yMin = -3/2;
yMax = 3/2;
dx = (xMax - xMin)/300;
dy = (yMax - yMin)/300;
time0 = AbsoluteTiming[
result = Table[f[x + y I], {y, yMin, yMax, dy}, {x, xMin, xMax, dx}];][[1]];
Print@time0;
ArrayPlot[result]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment