SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Newton Fractal x Mandelbrot Set

Hello, this is 108Hassium.

Recently, I discovered this fractal figure.

You can see a silhouette that looks like the Mandelbrot set of $${z^2+c}$$, but

if you look closely at the details, you can see complex patterns like those of a Newton fractal.

In this article, I will introduce how to generate this fractal figure and other related figures.

Generation Method

To put it simply, that fractal figure is like a "Newton fractal Mandelbrot set of $${f^{10}(z)}$$".

However,

  • $${f(z)=z^2+c}$$

  • $${f^m(z)=\underbrace{f(f(f(…f(}_mz)…)))}$$

.

To be a bit more precise, it is the result of performing the following operation on a complex number $${c}$$:

  1. Calculate the sequence $${z_{n+1}=z_n-\frac{f^{10}(z_n)}{f^{10}(z_n)'},z_{0}=c}$$.

  2. When the difference between $${z_n}$$ and $${z_{n-1}}$$ becomes small, consider it converged and color $${c}$$ using the value of $${n}$$.

By the way, $${\frac{f^m(z)}{f^m(z)'}}$$ can be found using the following recurrence relation:

$${a_{m}=\frac{1}{2}a_{m-1}+\frac{(2a_{m-1}-a_{m-2})^2}{8ca_{m-1}},a_0=z,a_1=\frac{z^2+c}{2z}}$$

*The explanation of how to derive this formula is omitted.

The code implemented in Processing is as follows.

void setup(){
  size(2000,2000);
  background(0);
  noStroke();
  double x,y,px,py,cx,cy,ax,ay,pax,pay,ppax,ppay;
  boolean o;
  for(int a=0;a<2000;a++){
    for(int b=0;b<2000;b++){
      cx=(double)a/500.0-2.0;
      cy=(double)b/500.0-2.0;
      x=cx;
      y=cy;
      o=true;
      for(int c=0;c<5000000&&o;c++){
        px=x;
        py=y;
        pax=x;
        pay=y;
        ax=divx(x*x-y*y+cx,2.0*x*y+cy,2.0*x,2.0*y);
        ay=divy(x*x-y*y+cx,2.0*x*y+cy,2.0*x,2.0*y);
        for(int d=0;d<10;d++){
          ppax=pax;
          ppay=pay;
          pax=ax;
          pay=ay;
          ax=pax/2.0+divx((2.0*pax-ppax)*(2.0*pax-ppax)-(2.0*pay-ppay)*(2.0*pay-ppay),2.0*(2.0*pax-ppax)*(2.0*pay-ppay),cx*pax-cy*pay,cx*pay+cy*pax)/8.0;
          ay=pay/2.0+divy((2.0*pax-ppax)*(2.0*pax-ppax)-(2.0*pay-ppay)*(2.0*pay-ppay),2.0*(2.0*pax-ppax)*(2.0*pay-ppay),cx*pax-cy*pay,cx*pay+cy*pax)/8.0;
        }
        x=px-ax;
        y=py-ay;
        if((x-px)*(x-px)+(y-py)*(y-py)<1e-10){
          o=false;
          fill(cr(sqrt(c)*17.0),cr(sqrt(c)*18.0)/256.0,cr(sqrt(c)*19.0));
          rect(a,b,1,1);
        }
      }
    }
  }
}

float cr(float c){
  return (c%256)*(256-(c%256))/65;
}

double divx(double a,double b,double x,double y){
  return (a*x+b*y)/(x*x+y*y);
}

double divy(double a,double b,double x,double y){
  return (-a*y+b*x)/(x*x+y*y);
}

Applications

☝Newton fractal Mandelbrot set of f^5(z) for f(z)=z^2+c

Reducing the number of calculations for $${f(z)}$$ makes the Mandelbrot set-like appearance of $${z^2+c}$$ fade, while the detailed lines characteristic of Newton fractals become more prominent.

☝Newton fractal of $${f^5(z)}$$ for $${f(z)=z^2+0.25}$$
☝Newton fractal of $${f^5(z)}$$ for $${f(z)=z^2-0.1+0.7i}$$
☝Newton fractal of $${f^{10}(z)}$$ for $${f(z)=z^2-0.1+0.7i}$$

You can also render Julia sets by rewriting the code just a little bit.

By the way, the coloring method for the three images above has also been changed; in addition to the number of calculations $${n}$$ until convergence, the absolute value of the convergence point is also used to determine the color. (Parameters are fine-tuned individually for each image)

☝Mandelbrot set of the Newton fractal of $${f^{10}(z)}$$ for $${f(z)=z^2+c}$$

When the coloring method using the absolute value of the convergence point is applied to the Mandelbrot set, delicate and beautiful gradients appear that were not seen in the Julia set.

However, when the generated image is pasted into note, for some reason it is converted into a dirty image with the gradients broken and jagged as shown above.

☝Mandelbrot set of the Newton fractal of $${f^{11}(z)-z}$$ for $${f(z)=z^2+c}$$

The roots (of which there are $${m}$$) of $${f^{m}(z)-z}$$ are the points that constitute the $${m}$$-periodic cycle of the Julia set of $${z^2+c}$$.

So, I thought, 'If I render the Newton fractal of $${f^{m}(z)-z}$$, wouldn't features related to the Julia set or Mandelbrot set of $${z^2+c}$$ appear?' and I discovered this before the $${f^m(z)}$$ one.

I used the following sequences to render this image.

  • $${a_{n+1}=\frac{b_n^2(a_n-z)^2+(c-z)(a_n-b_n)^2}{2b_n(a_n-z)^2-(a_n-b_n)^2}}$$

  • $${b_{n+1}=\frac{1}{2}b_n+\frac{c(a_n-b_n)^2}{2b_n(a_n-z)^2}}$$

If my calculations are correct, $${a_n=\frac{f^n(z)-z}{f^n(z)'-1}}$$ holds true.

As an aside, writing the code to calculate the above sequences was so tedious that I went out of my way to look up how to use a feature called 'classes' that I had never used before. (If you write out complex number multiplication and division naively, the formula for $${a_n}$$ becomes incredibly long, making it easy to make typos and difficult to find where the errors are)

☝Newton fractal of $${f^9(z)-z}$$ for $${f(z)=z^2-0.4+0.6i}$$
☝Newton fractal of $${f^9(z)-z}$$ for $${f(z)=z^2+0.3}$$

The Newton fractal of $${f^m(z)}$$ was point-symmetric, but it seems that $${f^m(z)-z}$$ becomes asymmetric.

☝Mandelbrot set of the Newton fractal of f^5(z) for f(z)=z^2+c (z_0=1)
☝Mandelbrot set of the Newton fractal of f^10(z) for f(z)=z^2+c (z_0=1)
☝Mandelbrot set of the Newton fractal of f^5(z) for f(z)=z^2+c (z_0=i)
☝Mandelbrot set of the Newton fractal of f^10(z) for f(z)=z^2+c (z_0=i)

It seems that even with the same formula, changing the initial value results in different silhouettes.

When I checked because I had a hunch, these looked exactly like the Mandelbrot sets for z^2+c when z_0=1 and z_0=i, respectively.

☝Reference: Mandelbrot set of z^2+c for z_0=1, i
☝Mandelbrot set of the Newton fractal of f^5(z) for f(z)=2z/3+1/(3z^2)
☝Mandelbrot set of the Newton fractal of f^5(z) for f(z)=2z/3+1/(3z^2)+c

Thinking there might be a formula that is easier to calculate, I tried the Nova fractal formula.

※☟Explanation of Nova fractal

The reason I had been using cumbersome recurrence relations instead of calculating f^m(z) and f^m(z)' directly until now is that direct calculation usually leads to overflow.

However, with f(z)=2/3z+1/(3z^2)+c, there should be no risk of overflow unless you accidentally hit a singularity.

Looking at the actually generated images, there is no sign of divergence, but the appearance is significantly different from the previous ones, and the silhouette of the original Mandelbrot set did not appear.