New answers tagged

5

Please search the site properly for existing answers before asking a new question. Following the answer by @Mark McClure here , getting the centers of the Koch snowflake triangles is a very easy job. Centers at level n=2 (Mean /@ triangles[2]) Visualize them. Thx to the answer I linked above. Graphics[{Table[{Darker[LightYellow, 1 - 1/1.2^(k - 1)], ...


7

You can do it probably most efficiently in compiled code, if you're not too concerned about precision. Here you can use the listability of compiled functions over tensor arguments. Your function is basically the Mandelbrot iteration: mandelbrot = Compile[{{c, _Complex, 0}, {d, _Integer, 0}}, Block[{i = 0, z = c}, While[Abs[z] < 2.0 && i < ...


3

Again I will propose solving the problem by a recursive function. helper[c0_, c_] := Module[{r = (Abs[#] < 2 & /@ c)}, Pick[#, r] & /@ {c0, c^2 + c0}] z[n_Integer?Positive, c0_List] := z[n - 1, c0, c0^2 + c0] z[0, c0_, _] := c0 z[n_, c0_, c_] := z[n - 1, Sequence @@ helper[c0, c]] With[{stepSize = .0001, n = 46}, Module[{c0, p}, c0 = ...


1

The If requires a scalar argument. z2[12,#]& /@ c should work.



Top 50 recent answers are included