mandel¶
Module that calculates the mandelbrot set for a given range. It uses a c extensions to speed up the computation.
- mandel.create_fractal(min_x, max_x, min_y, max_y, image, iters)[source]¶
Compute the mandelbrot set in a given range.
- Parameters
min_x (double) – Minimum x value of the range where to calculate the mandelbrot set
max_x (double) – Maximum x value of the range where to calculate the mandelbrot set
min_y (double) – Minimum y value of the range where to calculate the mandelbrot set
max_y (double) – Maximum y value of the range where to calculate the mandelbrot set
image (2 dimensional numpy array) – Array for the storage of mandelbrot set calculation results
iters (int) – Maximum number of iterations that are calculated to check if the mandelbrot sequence does converge
- Returns
Array that was passed as
image
argument- Return type
2 dimensional numpy array
- mandel.mandel(x, y, iters)[source]¶
Compute the mandelbrot set at a given point.
Calculates how many iterations are needed at a given point to determine if the mandelbrot sequence is divergent.
- Parameters
x (double) – x component of the point where to calculate the mandelbrot sequence
y (double) – y component of the point where to calculate the mandelbrot sequence
iters (int) – Maximum number of iterations that are calculated to check if the mandelbrot sequence does converge.
- Returns
Numbers of iterations scaled to the interval [0, 255].
- Return type
int