Generic code that gives the absolute value for integers and reals, and the Euclidean norm for `Complex`

You don't need the Euclidean norm to generate the Mandelbrot set--all norms on a finite-dimensional vector space are compatible, so a sequence blows up in the Euclidean norm if and only if it blows up in the max norm as well. (I.e. it doesn't generate "nearly the same plots". Unless you have a bug in your implementation, it generates exactly the same plots.)

This may not actually matter for computing digits of π, either, because requiring a few more or less iterations to blow up only changes the low-order digits in the iteration count, but the approximation to π is in the high-order digits (it would matter if the values required, say 10% more iterations). I haven't really studied the method in question, however, so I can't tell you off the top of my head what precisely will happen here.

edit
After thinking about it for a minute, the iteration counts are necessarily within O(1) of each other, so it also has no effect on the computation of the digits of π. You'll see slightly different values, but the approximations must converge at the same rate, and actually for any reasonable implementation should only vary in the final digit.


All that said, if you really want a Euclidean length defined on anything conforming to Numeric, what you have is as reasonable a definition as anything, so long as you're clear that the default implementation will be incorrect for some third-party types that may conform.

1 Like