I have been trying to create a certain fractal with Mathematica but the main issue is that if I try and do something like
ComplexPlot[
Nearest[{I, -2 + I, 3 - 2 I}, z],
{z, -2 - 2 I, 2 + 2 I}
]
and then try to graph it, I keep getting these error messages:
Nearest::neard: The default distance function does not give a real numeric distance when applied to the point pair z and I.
Nearest::neard The default distance function does not give a real numeric distance when applied to the point pair SystemComplexPlotsDump
nz$. and I.
General::stop: Further output of Nearest::neard will be suppressed during this calculation.
I have tried doing this with normal plot and real numbers, which works just fine, and I know that nearest can handle complex numbers as it can do things like Nearest[{I + 2, 3I}, 0]
and will output 2 + I
. So the issue is something with ComplexPlot
. The final image given is also just a red square, which is unexpected. Anyone know how to help?
nf = Nearest[{I, -2 + I, 3 - 2 I}]; nfx[z_?NumericQ] := nf[z]
and then try usingnfx[z]
instead in your plot. $\endgroup$nfx[]
at some arbitrary argument, you'd find that it gives a list and not a number. Perhapsnfx[z_?NumericQ] := First[nf[z]]
is what you wanted instead? $\endgroup$