Genetic programming with the Mandelbrot kit

I read a chapter in this fascinating book about using genetic programming for interactive image development. Most of the feature set consists of simple arithmetic and trigger functions (which actually work and return images). These functions make up the internal nodes of the parsing trees that encode our images. The leaves of the tree or the final values ​​are random numbers and x, y coordinates.

There is a section on adding iterative functions of the complex plane to a set of functions:

Say that genetics inserts a specific set of Mandelbrot as a node somewhere in a bushy tree. The function expects two arguments: mandel (cReal, cImag), processing them as real and imaginary coordinates in the complex plane. If the genome just supplied pixel coordinates (x, y), and mandel () is the root of the node, you get the familiar Mset. But there is a possibility that cReal and cImag themselves are the result of whole branches of functions, with many examples of x, y coordinates scattered among the leaves. Enter an iteration loop, an orbit for a while, and finally, with some distance to the Mset attractor, such as the number of iterations.

My question is, how can you render the renderer for the Mandelbrot set as a function that takes the real and imaginary coordinates of a point on the complex plane as arguments and returns the rendering of the Mandelbrot set?

+3
source share
1 answer

I am not sure if this really answers your question, but my understanding of the text you are quoting just says that the function mandelis another function (e.g. multiplication, min, max, addition, etc.), which may appear in your genetic program.

mandel, , (in_1 in_2) . in_1 * in_2, mandel - :

int mandel(int in_1, int in_2) {
  x = 0
  y = 0
  iteration = 0
  max_iteration = 1000

  while( x*x + y*y <= (2*2) && iteration < max_iteration ) {
    xtemp = x*x - y*y + in_1
    y = 2*x*y + in_2
    x = xtemp

    ++iteration
  }

  if( iteration == max_iteration ) return 0
  else return iteration
}

mandel x, - y, (x,y) .

, , , x y. , , x, - x + 2*y? , x, mandel(x,y)?

+1

Source: https://habr.com/ru/post/1759618/


All Articles