Live data from Hacker News

A new kind of fractal?

gibney.de

31–40 of 53 posts

Re: A new kind of fractal?

#31

It's not a fractal, but it is something familiar. 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,…

"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."

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.

Re: A new kind of fractal?

#32
post #30
post #5

Earlier quoted context omitted.

Wow, HN front page! Ok, will describe the algorithm. One moment...

You have the 4000x4000 file with a jpg suffix but it is actually a png? I ran the image through pngcrush and it decreased the file size by 50%. You might want to do the same and save on bandwidth / page loading... $ du -sh fractal* 14M fractal-optim.png 27M fractal.png

You are right! I had a png and a jpg version and uploaded the wrong one. Now the jpg is up. Thank you!

Re: A new kind of fractal?

#33

It's not a fractal, but it is something familiar. 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,…

I don't think this has anything to do with directed graphs. The operation looks like this. For nonzero c in C, compute the distance d(a(i+1)/c, Z+iZ) to the nearest Gaussian integer, where a is an integer.

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 
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.

Re: A new kind of fractal?

#34

It's not a fractal, but it is something familiar. 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,…

"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." 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 direct…

OK, for a less abstract description, the site gives:

"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 (Probably riddled with mistakes, should really be revising for my final Maths exam tomorrow morning...)

Re: A new kind of fractal?

#36
Are you using a large fixed point system or floating point? I hope the fractal-ness isn't just floating point rounding writ large.

Re: A new kind of fractal?

#37
post #36

Are you using a large fixed point system or floating point? I hope the fractal-ness isn't just floating point rounding writ large.

Its Javascript numbers. As far as I know they are always 64bit floating points. Yes, its possible that floating point artefacts play a role in this.

Re: A new kind of fractal?

#38
post #34

Earlier quoted context omitted.

"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." 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 direct…

OK, for a less abstract description, the site gives: "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…

Humm tried to implement it simply using std::complex but it does not give me meaningful results. What did I do wrong?

template void CalcRealPercentage( const complex from, const complex to, const int intervalSize, std::vector& 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 c = from; c.imag()  g(i, i);
                complex result = g / c;
                auto imagPart = result.imag();
                if (imagPart == 0) {
                    intensityMap.at(c.imag() * width + c.real())++;
                }
            }
        }
    }
}

Re: A new kind of fractal?

#39
post #34

Earlier quoted context omitted.

"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." 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 direct…

OK, for a less abstract description, the site gives: "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…

jc-denton replied, but appears to be hellbanned. His reply looks like this: ---

Humm tried to implement it simply using std::complex but it does not give me meaningful results. What did I do wrong?

template void CalcRealPercentage( const complex from, const complex to, const int intervalSize, std::vector& 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 c = from; c.imag()  g(i, i);
                complex result = g / c;
                auto imagPart = result.imag();
                if (imagPart == 0) {
                    intensityMap.at(c.imag() * width + c.real())++;
                }
            }
        }
    }

Re: A new kind of fractal?

#40
post #13

Earlier quoted context omitted.

Cool, how high up the gaussian integers do you go to get that sort of detail?

For the first image up to 100+100i. Please be aware, that I only use gaussian integers of the form x+xi where the real and imaginary part are the same. Im not sure if that is clear from my description. If there is demand, I can put up the source. Its Javascript.

yes please, put the javascript source.
Post reply on HN