Some other requirements for the project

Sparse matrix

Sparse matrix are very efficient when we need to use a matrix with a lot of zeros-values. To illustrate its use, we need a function that will randomly spread numbers with a chosen density.

sparse_matrix(wi, leng, den)

Creates a sparse matrix.

It uses random number to place the values (non-null values).

Parameters
  • wi (integer) – the width of the matrix

  • leng (integer) – the length of the matrix

  • den (float) – density of non-null number in the matrix

Returns

The representation of a sparse matrix

Return type

matplotlib plot

Pixel colors

When we use the mandel_loop function, one can visualize the speed of divergence of the \((z_n)_n\) sequence. We built an histogram representing each color for the speed of divergence on the \((0,x)\) axis and the associated number of pixels in a chosen window on the \((0,y)\) axis.

histogram(x=- 0.5, y=0, window=1.5)

Creates a histogram.

Histogram display for each color density.

Parameters
  • x (float) – coordinate for the points of mandelbrot set

  • y (float) – coordinate for the points of mandelbrot set

  • window (float) – size of the viewing window

Returns

histogram

Return type

matplotlib plot