A new kind of fractal?
gibney.de
gibney.de
Multiply two complex numbers z and c is equivalent to taking z and applying a rotation and dilation to it, the rotation through arg(c) and the dilation through |c|. Division is the inverse of both, so z/c is z rotated by -arg(c) and dilated by 1/|c|.
What you're looking at, then, is taking the operation defined by c (rotate by -arg(c) and dilate by 1/|c|) and asking, if you take the Gaussian integers as the vertexes of a directed graph, what fraction of the vertexes are the source of an edge.
Consider the 1 dimensional analogy using real numbers. Given some real number c, take all the integers as the vertexes of a graph, and if z/c (for some integer z) is also an integer, I put a directed edge from z to z/c. When are these connected? Well, if c is irrational, never. If c is rational, then there will be an infinite number of connections, but how infinite? When c is 2, there will be twice as many edges on average in any subset of the source vertexes as when c is 4. If we can write c as p/q, then the smaller p is, the more edges we'll get, and the brighter the pixel in your image.
The 1 dimensional analogy will have a spike at 1/2, smaller spikes at 1/3 and 2/3, yet smaller spikes at 1/4 and 3/4, smaller ones yet at 1/5, 2/5, 3/5, and 4/5, etc. The spikes will all be distinct (because between any two rationals there is an irrational), but will be infinitely close (because the rationals are dense in the reals). As you keep zooming in, you will get more and more edges like this.
What you're seeing is a variation on the classical structure of the rationals dense within the reals.
Now, a fractal is a set with a fractional Hausdorff dimension. We have to extract a set from your function of c in order to talk about fractal dimension. We could take the support of the function (everywhere it's not zero). In the one dimensional case, that's the rationals. We could take level sets farther up (the set of c such that f(c) = k, for a constant k). Those are subsets of the rationals. However, the rationals, while dense in the reals, are of measure zero in the reals, and have Hausdorff dimension zero, and so do all the level sets. So it's not a fractal.
Doesn't make it any less pretty though.
Is there an authoritative definition of a fractal? The one you use rules out structures like Hilbert curves, which are generally considered fractals.
Sort of. I believe Mandelbrot's original definition required only that the Hausdorff dimension exceeds the topological dimension. And that kinda-sorta includes Hilbert curves, if you count them as topologically 1-dimensional.
But I've seen other definitions, including a rather hazy one that was not a definition in the formal sense, but just talked about properties that certain interesting sets tend to have: self-similarity, etc.
In any case, I have yet to find a situation in which the formal definition of "fractal" actually mattered significantly. (If someone knows of one, I'd be interested.)
This doesn't sound like a mathematical operation. Can you give a more mathematical definition of the full graph? For Gaussian integers a+ib, c+id, (a+ib, c+id) is a directed edge from a+ib to c+id if and only if what?
Whatever this directed graph (V, E) is, where V = Z + iZ and E \subseteq V \times V, it is not clear how the complex number c relates to the proportion of z in V such that there exists w in V with (z, w) in E. We have to know what E is before we can answer this.
"For each complex number c calculate the following: For all gaussian integers g like 1+1i, 2+2i, 3+3i... when calculating g/c which percentage results in a gaussian integer again? The higher the percentage, the lighter the pixel."
So, Imagine you have:
c = a+bi
g = x+xi
Division by complex numbers is simplified with a trick of multiplying both numerator and divisor by the complex conjugate of the divisor, so we compute:- 1 / c = c' / ( c * c' )
And we know that c * c' will always be real rather than complex. 1 / c = (a-bi) / (a^2 + b^2)
Now it's just a case of iterating through the possibilities of g and seeing if g time this value of 1/c produces a gaussian integer again. x+xi * a-bi = ( x*a - x*b*i^2 ) + i*(x*a - x*b)
= x ( a+b + i(a-b) )
So, g/c = x [ a+b + i(a-b) ) / (a^2 + b^2) ] where g = x+xi
So for any g = x+xi this will only be a gaussian integer if both:- (a^2 + b^2) | x*(a+b)
(a^2 + b^2) | x*(a-b)
And the original algorithm is testing all gaussian integers where 0 <= x <= 100(Probably riddled with mistakes, should really be revising for my final Maths exam tomorrow morning...)
Humm tried to implement it simply using std::complex but it does not give me meaningful results. What did I do wrong?
template<class T> void CalcRealPercentage( const complex<T> from, const complex<T> to, const int intervalSize, std::vector<int>& intensityMap ){ auto height = to.imag() - from.imag(); auto width = to.real() - from.real();
assert(intervalSize > 0 && height > 0 && width > 0 && from > 0);
intensityMap.resize(width * height, 0);
for (complex<T> c = from; c.imag() < to.imag(); c.imag(c.imag() + 1)) {
for (; c.real() < to.real(); c.real(c.real() + 1)) {
for (auto i = 0; i < intervalSize; i++) {
complex<T> g(i, i);
complex<T> result = g / c;
auto imagPart = result.imag();
if (imagPart == 0) {
intensityMap.at(c.imag() * width + c.real())++;
}
}
}
}Not sure why he was hellbanned and not Zed after that little exchange.
PG should have, instead of removing vote totals, removed usernames. But of course that would get in the way of the ego stroking..
(I am of course no exception)
The max distance is A = 1/sqrt(2) so color the point a(1+i)/c proportionally by
(A - d(a(i+1)/c, Z+iZ))/A
I'm taking a liberty with the description, since computing "the percentage of a(i+1)/c's that are Gaussian integers" is open to interpretation, and if taken literally could mean something else entirely, such as computation of the ratio #(A(c,n)\cap Z+iZ) / n
where A(c, n) = { a(i+1)/ c : 1 <= a <= n }
which is asking for a proportion products that become Gaussian integers--this is a divisibility test. However, this doesn't show how to vary the brightness of the images.Also, do you allow the result of the division to be near a gaussian integer, or do you do an exact floating point equals?
Yes, I allow the result to be near a gaussian integer. For the first image I counted everything as a gaussian integer where (real%1<0.1 && imaginary%1<0.1)
$ du -sh fractal*
14M fractal-optim.png
27M fractal.pnghttp://www.wikipaintings.org/en/m-c-escher/square-limit-colo...
This is old-school, but a long time ago I wrote a java applet to help explore this function on the complex plane:
http://www.math.nyu.edu/~neylon/applet1/
If you move around the red square, you see a lot of the circular shapes that look similar to those in the fractal.
I don't completely understand the algorithm being used, so I'm not sure how to gain more confidence on this guess.
https://gist.github.com/3903785
Hadn't figured out if there is a way of vectorising it further. Would appreciate any tips if anyone has any.
Anyways, here's my take for a generalization : http://imgur.com/qD0aZ