Professional Documents
Culture Documents
ASSIGNMENT 3
A curve or geometrical figure , each part of which has the same statistical character
as the whole.
A fractal is a non regular geometric shape that has same degree of non - regularity
on all scales. So fractals can be thought of never- ending patterns.
Initially the Mandelbrot defined the fractals as follows: “ A fractals is a set for
which the Hausdorff - Besicovitch dimension strictly exceeds the topological
dimension.
Mathematical formula use to generate a fractal
Julia Set
The Julia Set equation is:
Zn+1 = (Zn)2 + c
A self squaring function
For the Julia Set, the value of c remains constant and
the value of Zn changes
If we start with the complex number Z1= 0.5 + 0.6j, and let
displaystyle{c}={0.3}
c=0.3 and then feed this into the formula above, we have:
Z5 = 0.3616768258
− 0.005418405698j
Name and Example of some fractals
Benoit B.Mandelbrot
November 1924 – 14 October 2010) was a Polish-born French-American
mathematician and polymath with broad interests in the practical sciences,
especially regarding what he labeled as "the art of roughness" of physical
phenomena and "the uncontrolled element in life". He referred to himself as a
"fractalist" and is recognized for his contribution to the field of fractal geometry,
which included coining the word "fractal", as well as developing a theory of
"roughness and self-similarity" in nature.
In 1936, while he was a child, Mandelbrot's family emigrated to France
from Warsaw, Poland. After World War II ended, Mandelbrot studied
mathematics, graduating from universities in Paris and the United States
and receiving a master's degree in aeronautics from the
California Institute of Technology. ..
Mandelbrot emphasized the use of fractals as realistic and useful models for
describing many "rough" phenomena in the real world. He concluded that "real
roughness is often fractal and can be measured.
Sierpinski
He was a Polish mathematician. He was known for contributions to set theory
(research on the axiom of choice and the continuum hypothesis), number theory,
theory of functions and topology. He published over 700 papers and 50 books.
Sierpiński enrolled in the Department of Mathematics and Physics at the
University of Warsaw in 1899 and graduated four years later. In 1903, while still
at the University of Warsaw, the Department of Mathematics and Physics offered
a prize for the best essay from a student on Voronoy's contribution to number
theory. Sierpiński was awarded a gold medal for his essay, thus laying the
foundation for his first major mathematical contribution.
Three well-known fractals are named after him (the Sierpiński triangle, the
Sierpiński carpet, and the Sierpiński curve), as are Sierpiński numbers
and the associated Sierpiński problem .
Self Similarity
{\displaystyle f(x,t)}
measured at different times are different but the corresponding dimensionless quantity at
given value of
{\displaystyle x/t^{z}}
remain invariant.
Five natural fractals with their name
Fern Sea Shells
Romanescu Lightning
Dancing Peacock
Iteration
Iteration means the repetition of a single formula again & again with slightly different value based on the
previous iteration result. Using iteration by the fractal function to generate complex pictures.
1. Integer iteration
{\displaystyle f^{n}(x)=f(f^{n-1}(x))}
is used to generate the sequence:
{\displaystyle \{f(x),f^{2}(x),f^{3}(x),...\}}
known as the natural iterates of f(x), which forms a monoid under composition.
For invertible functions f(x), the inverses are also considered iterates, and form the sequence:
{\displaystyle \{...,f^{-2}(x),f^{-1}(x),x,f(x),f^{2}(x),...\}}
known as the integer iterates of f(x), which forms a group under composition.
Fractional iteration :-
Solving the functional equation: f(x)=g^{n}(x) Once this functional equation is solved, then the
rational iterates f^{(m/n)}(x) are the integer iterates of g(x).
Continuous iteration :-
A generalization of the usual notion of iteration, where the functional equation (FE): f n(x) = f(f n-
1(x)) must be satisfied for all n in the domain (real or complex).
Sierpinski Gasket:-
#include <GL/glut.h>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
using namespace std
//points
float xa = 400;
float ya = 200;
float xb = 400;
float yb = 600;
float xc = 600;
float yc = 400;
float xd=600;
float yd=100;
float x = xa;
float y = ya;
//sierpinski
void draw_sierpinskl() {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glVertex2f(xa,ya);
glVertex2f(xb,yb);
glVertex2f(xc,yc);
float div=2;
float r;
r = (rand()%3);
if(r == 0) {
x = (x+xa)/div;
y = (y+ya)/div;
}
if(r == 1) { x = (x+xb)/div;
y = (y+yb)/div;
if(r == 2) {
x = (x+xc)/div;
y = (y+yc)/div;
glVertex2f(x,y);
glFlush();
glutInit(&argc, argv);
glutCreateWindow("Sierpinski");
glutInitWindowSize(1080, 720);
glutInitWindowPosition(150, 150);
glutDisplayFunc(draw_sierpinskl);
glutMainLoop();
return 0; }
Sierpinski gasket
Chaos_Game :-
#include <chrono>
#include <iostream>
#include <random>
#include <thread>
#include <GL/gl.h>
#define WIDTH 768
#define HEIGHT 768
using namespace std;
struct point{
double x;
double y;
};
glfwInit();
if(!window){
return -1;
}
glfwMakeContextCurrent(window);
glOrtho(-WIDTH/2, WIDTH/2, 0, HEIGHT, -1.0, 1.0);
int num_corners = 5;
point corners[num_corners];
corners[0].x = 0;
corners[0].y = HEIGHT;
corners[1].x = WIDTH/2;
corners[1].y = 0;
corners[2].x = -WIDTH/2;
corners[2].y = 0;
default_random_engine rand;
uniform_real_distribution<double> height_dist(0.0, (double) HEIGHT);
uniform_real_distribution<double> width_dist((double) -WIDTH/2.0, (double) WIDTH/2.0);
uniform_int_distribution<int> corner_dist(0, num_corners-1);
while(true){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
chrono::high_resolution_clock::time_point start = chrono::high_resolution_clock::now();
point p;
p.x = width_dist(rand);
p.y = height_dist(rand);
return 0;
}
chaos_game
Menger Sponge:-
#include <iostream>
#include <random>
#include <thread>
#include <GL/gl.h>
return -1;
}
glfwMakeContextCurrent(window);
glOrtho(0, WIDTH, 0, HEIGHT, -1.0, 1.0);
while(true){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.72f,0.72f, 0.0f);
glBegin(GL_QUADS);
chrono::high_resolution_clock::time_point start = chrono::high_resolution_clock::now();
for(int d = 0; d < max_depth; d++){
double depth = (double) three_pow(d);
for(int i = 0; i < depth; i++){
double x_step = WIDTH / depth;
for(int j = 0; j < depth; j++){
double y_step = HEIGHT / depth;
double center_x = x_step*double(i) + x_step/2.0;
double center_y = y_step*double(j) + y_step/2.0;
glVertex2i(center_x + x_step/6.0, center_y + y_step/6.0);
glVertex2i(center_x + x_step/6.0, center_y - y_step/6.0);
glVertex2i(center_x - x_step/6.0, center_y - y_step/6.0);
glVertex2i(center_x - x_step/6.0, center_y + y_step/6.0);
}
}
}
cout << chrono::duration_cast<chrono::duration<double>>
(chrono::high_resolution_clock::now() - start).count() << "\n";
glEnd();
glfwSwapBuffers(window);
this_thread::sleep_for(chrono::milliseconds(100));
}
return 0;
}
Menger Sponge
Fractal Tree:-
#include <GL/glut.h>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
return;
else
}
double lineLen = TREE_LINE_BASE_LEN * pow(TREE_FACTOR, current_Depth);
glBegin(GL_LINES);
glVertex2d(0, 0);
glVertex2d(0, lineLen);
glEnd();
glRotated(-angle1, 0, 0, 1);
drawTree(current_Depth + 1, maxDepth);
drawTree(current_Depth + 1, maxDepth);
glRotated(-angle2, 0, 0, 1);
glutInit(&argc, argv);
glutCreateWindow("fractal Tree");
glutInitWindowSize(1080, 720);
glutInitWindowPosition(150, 150);
glutDisplayFunc(drawTree);
glutMainLoop();
return 0;
}
Fractal Tree