# Julia Set Explorations

Compiled function operations can be made faster by targeting C code generation and linking.
 In[1]:= Xcjc = Compile[{{power, _Integer}, {c, _Complex}}, Module[{imax = 1000, dzmax = 2500., maxpt = 10^5, z, dz, roots, branches, i = 2, res = 0. + 0. I, pt = 0}, branches = Table[Exp[-2. N[Pi] I k/power], {k, 0, power - 1}]; z = Table[0. + 0. I, {imax}]; dz = Table[1. , {imax}]; roots = Table[1, {imax}]; Map[{Re[#], Im[#]} &, NestWhileList[ Function[ z[[i]] = branches[[roots[[i]]]] (z[[i - 1]] - c)^(1/power); dz[[i]] = power Abs[z[[i]]]^(power - 1) dz[[i - 1]]; res = z[[i]]; If[i < imax && dz[[i]] < dzmax, i++; roots[[i]] = 1 (* else *), While[i > 1 && roots[[i]] == power, roots[[i]] = 1; i--]; roots[[i]]++]; res], 0. + 0. I , Function[(i > 1) && (pt++ < maxpt)]]]], CompilationTarget -> "C", RuntimeOptions -> "Speed"]; Graphics[{PointSize[0.0001], Point[cjc[3, -0.040000000000000036` + I * -0.78`]]}, AspectRatio -> 1]
 Out[1]=

#### Use Manipulate to explore the Julia set and discover interesting points.

 In[2]:= XManipulate[ Graphics[{PointSize[0.0001], Point[cjc[p, d[[1]] + I d[[2]]]]}, AspectRatio -> 1], {{p, 3}, Range[10]}, {{d, {-.5, -.05}}, {-2, -2}, {2, 2}}]
 Out[2]=