What is Fractal?

A fractal is a **curve **or **geometrical figure, **each part of which has the **same statistical character **as the whole. They are useful in modeling structures (such as snowflakes) in which similar patterns recur at progressively smaller scales.

In simpler words, a fractal is a **never-ending pattern. **Fractals are infinitely complex figures that are self-similar across different scales. They are created by repeating a simple process in an ongoing feedback loop. Driven by **recursion, **fractals are images of dynamic systems.

Image for post

Source: Wired.com

Mandelbrot Set:

Images of the Mandelbrot set to exhibit an elaborate and infinitely complicated boundary that reveals progressively **ever-fine recursive detail **at increasing magnifications. In other words, the boundary of the Mandelbrot set is a fractal curve.

It has become popular outside mathematics both for its aesthetic appeal and as an example of a complex structure arising from the application of simple rules. It is one of the best-known examples of mathematical visualization and sheer beauty.


Implementation

import numpy as np

import matplotlib.pyplot as plt

from numpy** import** newaxis

def compute_mandelbrot(N_max, some_threshold, nx, ny):

A grid of c-values

x = np.linspace(-2, 1, nx)

y = np.linspace(-1.5, 1.5, ny)

c = x[:,newaxis] + 1j*y[newaxis,:]

Mandelbrot iteration

z = c

for j in** range**(N_max):

z = z**2 + c

mandelbrot_set = (abs(z) < some_threshold)

return mandelbrot_set

mandelbrot_set = compute_mandelbrot(50, 50., 601, 401)

plt.imshow(mandelbrot_set.T, extent=[-2, 1, -1.5, 1.5])

plt.show()

#data-science #fractals #machine-learning #mandelbrot #data analysis

Fractals with Python
10.85 GEEK