str2d.mandelbrot

str2d.mandelbrot(height, width, x_range, y_range, char='*')[source]

Create a Mandelbrot set. Visualize the Mandelbrot set. The Mandelbrot set as a Str2d object.

Parameters:
  • height (int) – The number of rows.

  • width (int) – The number of columns.

  • x_range (Tuple[float, float]) – The range of the x values.

  • y_range (Tuple[float, float]) – The range of the y values.

  • char (str, optional) – The character to use, by default ‘*’.

Returns:

A new Str2D object with the Mandelbrot set.

Return type:

Str2D

See also

is_in_mandelbrot

Determines if the point is in the Mandelbrot set.

Examples

Let’s create a Mandelbrot set.

str2d.mandelbrot(
    44, 88,
    (-2, .5),
    (-1.25, 1.25),
    '*'
).strip2d().box()
╭───────────────────────────────────────────────────────────────╮
│                                           ****                │
│                                        * ***** *              │
│                                       *********               │
│                                        ********               │
│                           ***     * * * *******  *  *         │
│                            **** ********************      * * │
│                             *******************************   │
│                            *******************************    │
│                        *************************************  │
│            *            **************************************│
│                        ***************************************│
│       *** *******     *************************************** │
│       *************   ****************************************│
│     **************** *****************************************│
│    ********************************************************** │
│************************************************************   │
│************************************************************   │
│    ********************************************************** │
│     **************** *****************************************│
│       *************   ****************************************│
│       *** *******     *************************************** │
│                        ***************************************│
│            *            **************************************│
│                        *************************************  │
│                            *******************************    │
│                             *******************************   │
│                            **** ********************      * * │
│                           ***     * * * *******  *  *         │
│                                        ********               │
│                                       *********               │
│                                        * ***** *              │
│                                           ****                │
╰───────────────────────────────────────────────────────────────╯