Skip to content

revanth3003/Fractals

Repository files navigation

All fractals arengenerated using turtle pakage

[1] Sierpinski’s Triangle

The technique of subdividing a shape into smaller copies of itself, removing one or more copies, and continuing recursively can be extended to other shapes.

The Sierpiński triangle is a fractal attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles. Start with an equilateral triangle. Subdivide it into four smaller congruent equilateral triangles and remove the central triangle. Repeat step 2 with each of the remaining smaller triangles infinitely. The below figure is the Sierpinski Triangle’s output generated for stage 4 source: https://en.wikipedia.org/wiki/Sierpiński_triangle

Sierpinski’s Triangle

image

Input - s - Number of stages or interaction (Example: s = 4) (Should be a positive integer)

[2] Sierpinski’s Carpet

The technique of constructing Sierpinski’s carpet is like that of Sierpinski’s Triangle. The construction of the Sierpiński carpet begins with a square. The square is cut into 9 congruent sub squares in a 3-by-3 grid, and the central sub square is removed. The same procedure is then applied recursively to the remaining 8 sub squares and goes infinitely. The below figure is the Sierpinski Carpet’s output generated for stage 2. Source: https://en.wikipedia.org/wiki/Sierpiński_carpet

Sierpinski’s Carpet

image

Input - s - Number of stages or interaction (Example: s = 2) (Should be a positive integer)

[3] Koch Curve/Snowflake

The Koch snowflake can be built up iteratively, in a sequence of stages. The first stage is an equilateral triangle, and each successive stage is formed by adding outward bends to each side of the previous stage, making smaller equilateral triangles. The areas enclosed by the successive stages in the construction of the snowflake converge to 8/5 times the area of the original triangle, while the perimeters of the successive stages increase without bound. Consequently, the snowflake encloses a finite area, but has an infinite perimeter. The below figure is Koch's snowflake generated for stage 3. Source: https://en.wikipedia.org/wiki/Koch_snowflake

Koch Curve/Snowflake image

Input - s - Number of stages or interaction (Example: s = 2) (Should be a positive integer)

[4] Fern Leaf

The fern is a mathematically generated pattern that can be reproducible at any magnification or reduction. Like the Sierpinski triangle, the Barnsley fern shows how graphically beautiful structures can be built from repetitive uses of mathematical formulas with computers.The below matrix figure is Barnsley's matrix of constants whereas f1 (x , y) forms stem, f2 (x , y) forms successively smaller leaflets, f3 (x , y) forms largest left-hand leaflets and f4 (x , y) form largest right-hand leaflets. (x, y) is randomly generated points.The figure below is the Barnsley’s fern generated for 100,000 random points. Source: https://en.wikipedia.org/wiki/Barnsley_fern

image

Fern Leaf

image

Input - n - Number of stages (Example: n = 100000) (Should be a positive integer) (For better results the points should be more than 100,000) p - probability factor (Generated as Uniform random points (0,1)

[5] Fibonacci Series

The Fibonacci numbers, commonly denoted Fn , form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence commonly starts from 0 and 1. Starting from 0 and 1, the first few values in the sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,55,89, 144.The figure below is the fibonacci spiral generated for stage 4. Source: https://en.wikipedia.org/wiki/Fibonacci_number

Fibonacci Spiral

image

Input - s - Number of stages or interaction (Example: s = 4) (Should be a positive integer)

[6] Pentaflake

A pentaflake, or sierpinski pentagon, is formed by successive flakes of six regular pentagons Each flake is formed by placing a pentagon in each corner and one in the center. Its Hausdorff dimension is equal to log (6) \ log (1+ φ) ≈ 1.8617, where φ= (1+sqrt (5)) / 2 (golden ratio). The log (6) \ log (1+ φ) is obtained because each iteration has 6 pentagons that are scaled by (1+ φ). The boundary of a pentaflake is the Koch curve of 72 degrees.

There is also a variation of the pentaflake that has no central pentagon. Its Hausdorff dimension equals log (5) \ log (1+ φ) ≈ 1.6723. This variation still contains infinitely many Koch curves, but they are somewhat more visible. The figure below is the pentaflake generated for stage 4. Source: https://en.wikipedia.org/wiki/N-flake

Pentaflake

image

Input - s - Number of stages or interaction (Example: s = 4) (Should be a positive integer)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published