Fractals: Self-Similarity, Infinite Complexity, and Artistic Expressions

Introduction

Fractals are intricate and infinitely complex patterns that are found both in nature and mathematics. They are characterized by self-similarity, meaning that smaller parts of the fractal resemble the whole structure. Fractals have fascinated mathematicians, scientists, and artists for centuries, offering a unique intersection of art and mathematics. This blog will explore the concept of fractals, their mathematical foundations, famous examples, and how they are used in generative art.

What are Fractals?

Fractals are patterns that repeat at different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. This recursive process results in structures that are self-similar and infinitely detailed.

Characteristics of Fractals

  1. Self-Similarity: Smaller parts of the fractal are similar to the whole structure.
  2. Infinite Complexity: Fractals can be zoomed into infinitely, revealing more detail at every scale.
  3. Fractional Dimension: Fractals often have dimensions that are not whole numbers, known as their fractal dimension.

Mathematical Foundations of Fractals

Fractals are often generated using recursive algorithms that apply a simple rule repeatedly. Some well-known fractals are defined by mathematical formulas and iterative processes.

The Mandelbrot Set

The Mandelbrot set is one of the most famous fractals, defined by the recursive formula:

𝑧𝑛+1=𝑧𝑛2+𝑐

z

n+1

=z

n

2

+c

where

𝑧

z and

𝑐

c are complex numbers. The set is generated by iterating this formula and determining whether the sequence remains bounded.

Example in p5.js:

javascript

Copy code

function setup() {

 createCanvas(600, 600);

 pixelDensity(1);

 loadPixels();

 for (let x = 0; x < width; x++) {

 for (let y = 0; y < height; y++) {

 let a = map(x, 0, width, -2.5, 1.5);

 let b = map(y, 0, height, -2, 2);

 let ca = a;

 let cb = b;

 let n = 0;

 let z = 0;

 while (n < 100) {

 let aa = a * a – b * b;

 let bb = 2 * a * b;

 a = aa + ca;

 b = bb + cb;

 if (abs(a + b) > 16) {

 break;

 }

 n++;

 }

 let bright = map(n, 0, 100, 0, 255);

 if (n === 100) {

 bright = 0;

 }

 let pix = (x + y * width) * 4;

 pixels[pix + 0] = bright;

 pixels[pix + 1] = bright;

 pixels[pix + 2] = bright;

 pixels[pix + 3] = 255;

 }

 }

 updatePixels();

}

This code generates the Mandelbrot set by iterating the complex formula and plotting the points that remain bounded.

The Julia Set

The Julia set is related to the Mandelbrot set and is generated using a similar recursive formula. However, each point in the complex plane is treated as the initial value, resulting in different fractal patterns.

Famous Fractals

Several fractals have become iconic due to their unique properties and visual appeal.

Koch Snowflake

The Koch snowflake is a simple fractal created by recursively adding triangles to each side of an equilateral triangle. The result is a snowflake-like pattern with infinite perimeter and finite area.

Example in p5.js:

javascript

Copy code

let points = [];

let depth = 5;

function setup() {

 createCanvas(600, 600);

 let p1 = createVector(300, 100);

 let p2 = createVector(500, 500);

 let p3 = createVector(100, 500);

 points = [p1, p2, p3];

 noLoop();

 kochSnowflake(points, depth);

}

function draw() {

 background(255);

 stroke(0);

 beginShape();

 for (let p of points) {

 vertex(p.x, p.y);

 }

 endShape(CLOSE);

}

function kochSnowflake(points, depth) {

 if (depth == 0) {

 return;

 }

 let newPoints = [];

 for (let i = 0; i < points.length; i++) {

 let a = points[i];

 let b = points[(i + 1) % points.length];

 let ab = p5.Vector.sub(b, a);

 let p1 = p5.Vector.add(a, p5.Vector.mult(ab, 1 / 3));

 let p2 = p5.Vector.add(a, p5.Vector.mult(ab, 2 / 3));

 let p3 = p5.Vector.add(p1, p5.Vector.fromAngle(ab.heading() – PI / 3, ab.mag() / 3));

 newPoints.push(a, p1, p3, p2);

 }

 points = newPoints;

 kochSnowflake(points, depth – 1);

}

This example generates the Koch snowflake by recursively dividing and adding new points to the sides of the initial triangle.

Sierpinski Triangle

The Sierpinski triangle is created by recursively removing smaller triangles from an equilateral triangle. The resulting pattern is a fractal with self-similar properties at different scales.

Example in p5.js:

javascript

Copy code

function setup() {

 createCanvas(600, 600);

 background(255);

 sierpinski(300, 50, 500);

}

function sierpinski(x, y, len) {

 if (len < 10) {

 fill(0);

 noStroke();

 triangle(x, y, x – len / 2, y + len, x + len / 2, y + len);

 } else {

 sierpinski(x, y, len / 2);

 sierpinski(x – len / 2, y + len / 2, len / 2);

 sierpinski(x + len / 2, y + len / 2, len / 2);

 }

}

This example creates the Sierpinski triangle by recursively drawing smaller triangles.

Applications of Fractals in Generative Art

Fractals have numerous applications in generative art. They can be used to create visually stunning patterns, simulate natural phenomena, and generate textures and landscapes.

Simulating Natural Phenomena

Fractals are used to simulate natural phenomena such as mountains, clouds, and coastlines. The self-similar properties of fractals make them ideal for creating realistic and complex natural landscapes.

Generating Textures and Patterns

Fractals can generate intricate textures and patterns that are used in graphic design, animation, and digital art. The infinite complexity of fractals provides a rich source of inspiration for artists.

Interactive Art and Visualizations

Interactive fractal art allows users to explore and manipulate fractal patterns in real-time. This can be achieved using web-based tools like p5.js, making fractals accessible and engaging for a wide audience.

Conclusion

Fractals are a powerful tool in generative art, offering endless possibilities for creating complex and beautiful designs. By understanding the mathematical foundations and learning how to implement fractals in code, you can explore the infinite complexity and beauty of fractal patterns. Whether you are simulating natural landscapes or creating intricate textures, fractals provide a rich and fascinating area for creative exploration.

TL;DR for Each Section

  1. Introduction: Fractals are self-similar, infinitely complex patterns found in nature and mathematics, offering endless possibilities in generative art.
  2. What are Fractals?: Fractals are patterns that repeat at different scales, characterized by self-similarity and infinite complexity.
  3. Mathematical Foundations of Fractals: Fractals are often generated using recursive algorithms, with famous examples like the Mandelbrot set and Julia set.
  4. Famous Fractals: Examples include the Mandelbrot set, Julia set, Koch snowflake, and Sierpinski triangle.
  5. Applications of Fractals in Generative Art: Fractals are used to simulate natural phenomena, generate textures, and create interactive art.
  6. Conclusion: Fractals offer endless possibilities for creating complex and beautiful designs in generative art.

FAQs

What is a fractal?

  1. A fractal is a pattern that repeats at different scales and is characterized by self-similarity.

What is the Mandelbrot set?

  1. The Mandelbrot set is a famous fractal generated by iterating a simple mathematical formula and plotting points that remain bounded.

How do you create fractals with code?

  1. Fractals are created using recursive algorithms that apply simple rules repeatedly to generate complex patterns.

What are some famous fractals?

  1. Famous fractals include the Mandelbrot set, Julia set, Koch snowflake, and Sierpinski triangle.

What is the Julia set?

  1. The Julia set is a fractal related to the Mandelbrot set, generated using a similar recursive formula.

How is the Koch snowflake created?

  1. The Koch snowflake is created by recursively adding triangles to each side of an equilateral triangle.

What is the Sierpinski triangle?

  1. The Sierpinski triangle is a fractal created by recursively removing smaller triangles from an equilateral triangle.

How are fractals used in generative art?

  1. Fractals are used to create complex patterns, simulate natural phenomena, generate textures, and create interactive art.

What is self-similarity in fractals?

  1. Self-similarity means that smaller parts of the fractal resemble the whole structure.

What is a recursive algorithm?

  1. A recursive algorithm is a process that calls itself with modified parameters to generate complex patterns.

Can fractals be generated in real-time?

  1. Yes, fractals can be generated in real-time using web-based tools like p5.js.

What is the fractal dimension?

  1. The fractal dimension is a measure of a fractal’s complexity, often not a whole number.

How are fractals used in nature?

  1. Fractals are found in natural phenomena like mountains, clouds, coastlines, and plants.

What is Perlin noise?

  1. Perlin noise is a type of gradient noise used in procedural generation to create natural-looking textures.

How do you create interactive fractal art?

  1. Interactive fractal art can be created using tools like p5.js, allowing users to explore and manipulate fractal patterns in real-time.

What is the significance of fractals in mathematics?

  1. Fractals have significant applications in mathematics, physics, and computer science, modeling complex systems and patterns.

How do fractals inspire artists?

  1. The infinite complexity and beauty of fractals provide a rich source of inspiration for artists in various fields.

Can fractals be used in animation?

  1. Yes, fractals can be used to create dynamic and visually stunning animations.

What are some tools for creating fractals?

  1. Tools for creating fractals include p5.js, Processing, Apophysis, and JWildfire.

Where can you learn more about fractals?

  1. Explore online tutorials, courses, and books dedicated to fractals and generative art.

Bibliography

  1. Mandelbrot, Benoit. “The Fractal Geometry of Nature”.
  2. Peitgen, Heinz-Otto, and Saupe, Dietmar. “The Science of Fractal Images”.
  3. Falconer, Kenneth. “Fractal Geometry: Mathematical Foundations and Applications”.
  4. Processing Official Website.
  5. p5.js Official Website.

Discover more from Visual Alchemist

Subscribe to get the latest posts sent to your email.

Discover more from Visual Alchemist

Subscribe now to keep reading and get access to the full archive.

Continue reading