BarnCamp 2011 The HTML 5 element as seen through a fractal eye: a brief introduction.

Slides:



Advertisements
Similar presentations
What is a Fractal? A fractal is a mathematical object that is both self-similar and chaotic. self-similar: As you magnify, you see the object over and.
Advertisements

Fractals Part 1: In which we attempt to describe what a fractal is, because people will ask (but perhaps they will not really want to know the answer).
FIELD DAY TOK: Mathematics and Imagination
Fractals everywhere ST PAUL’S GEOMETRY MASTERCLASS II.
Jochen Triesch, UC San Diego, 1 Rendering of the Mandelbrot set: perhaps the most famous fractal Fractals.
Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Fractals Jennifer Trinh Benoît Mandelbrot, “father of fractal geometry”
Fractals Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New.
The infinitely complex… Fractals Jennifer Chubb Dean’s Seminar November 14, 2006 Sides available at
Course Website: Computer Graphics 11: 3D Object Representations – Octrees & Fractals.
Notes, part 5. L’Hospital Another useful technique for computing limits is L'Hospital's rule: Basic version: If, then provided the latter exists. This.
CS 4731: Computer Graphics Lecture 5: Fractals Emmanuel Agu.
Complex Numbers? What’s So Complex?. Complex numbers are vectors represented in the complex plane as the sum of a Real part and an Imaginary part: z =
CS4395: Computer Graphics 1 Fractals Mohan Sridharan Based on slides created by Edward Angel.
Fractals.
Notes, part 4 Arclength, sequences, and improper integrals.
Approaches To Infinity. Fractals Self Similarity – They appear the same at every scale, no matter how much enlarged.
Applied Mathematics Complex Systems Fractals Fractal by Zhixuan Li.
Mandelbrot Set the Who Is Mandelbrot?  Benoit Mandelbrot –Mandelbrot was born in Poland in He studied mathematics in France under Gaston Julia.
HONR 300/CMSC 491 Computation, Complexity, and Emergence Mandelbrot & Julia Sets Prof. Marie desJardins February 22, 2012 Based on slides prepared by Nathaniel.
FRACTALS OF THE WORLD By Leslie Ryan. Common Terms Iteration- To repeat a pattern multiple times, usually with a series of steps. Reflection- An image.
1 GEM2505M Frederick H. Willeboordse Taming Chaos.
Structured Chaos: Using Mata and Stata to Draw Fractals
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
Fractals. Similar Figures Same shape Corresponding angles are congruent Corresponding sides are proportional.
Fractals Nicole MacFarlane December 1 st, What are Fractals? Fractals are never- ending patterns. Many objects in nature have what is called a ‘self-
Fractals Siobhán Rafferty.
SPSU, Fall 08, CS6353 Alice In Wonderland! Richard Gharaat.
Ch 9 Infinity page 1CSC 367 Fractals (9.2) Self similar curves appear identical at every level of detail often created by recursively drawing lines.
Fractals Douglas reeves.
Bellwork Last Nights Homework c. 4 d
Fractional Dimensions, Strange Attractors & Chaos
David Chan TCM and what can you do with it in class?
Fractals in nature.
Fractal Project Mariellen Hemmerling. Fractals “A fractal is "a rough or fragmented geometric shape that can be split into parts, each of which is (at.
Imagine you were playing around with Apophysis when some other GHP Math student student came up behind you and said “Gee that’s pretty! What is that a.
FRACTALS FRACTALS The Geometry of Nature ϕ π Σ Π ξ ρ τ ω ψ Ξ Ω μ ε γ λ η ζ θ β α By Michael Duong.
1 GEM2505M Frederick H. Willeboordse Taming Chaos.
AUGUST 2. MATH 104 Calculus I Review of previous material…. …methods and applications of integration, differential equations ………..
Section 6.1 Images Viewing a Gallery of Fractals. Look for patterns.
1 Bounding Iterated Function Systems Orion Sky Lawlor CS 497jch November 14, 2002.
Fractals and fractals in nature
Dynamical Systems 4 Deterministic chaos, fractals Ing. Jaroslav Jíra, CSc.
Mandelbrot Set Fractal
CSE 423 Computer Graphics | MUSHFIQUR ROUF CSE423:
Fractals! Bullock Math Academy March 22, 2014 Brian Shelburne
Fractals Ed Angel Professor Emeritus of Computer Science
 Introduction  Definition of a fractal  Special fractals: * The Mandelbrot set * The Koch snowflake * Sierpiński triangle  Fractals in nature  Conclusion.
Fractals Cassi Blum.
The Mandlebrot Set Derek Ball University of Kentucky Math 341- College Geometry.
A Primer on Chaos and Fractals Bruce Kessler Western Kentucky University as a prelude to Arcadia at Lipscomb University.
1 What did we learn before?. 2 line and segment generation.
Infinity and Beyond! A prelude to Infinite Sequences and Series (Chp 10)
Fractals and L-Systems
HONR 300/CMSC 491 Computation, Complexity, and Emergence
Loops BIS1523 – Lecture 10.
Iterative Mathematics
CS 1321.
Fractals Project Natalie Rowe.
FUN With Fractals and Chaos!
Chapter 5 Curves and Fractals.
S.K.H. Bishop Mok Sau Tseng Secondary School
The Wonderful World of Fractals
The Mystery of the Fractal
Modeling with Geometry
Six Gems for AS Further Pure Mathematics
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Fractals: A Visual Display of Mathematics
ECE 448: Spring 2016 Lab 5 Julia Set Fractal.
Presentation transcript:

BarnCamp 2011 The HTML 5 element as seen through a fractal eye: a brief introduction

Why? ● I like Fractals, they're pretty to look at and it amazes me how such beauty can come from a simple little bit of Maths. ● It's a good little Maths meets programming meets pretty pictures meets art kind of a topic. ● It means I keep my brain active by thinking about some hard sums and actually doing some coding. ● I can grow them on the allotment too, so it's not all sat in front of the screen tapping away.

What is a fractal? An object which has some of these properties: ● Self-similar (the same patterns repeat themselves at different magnifications) ● Fine structure are arbitrary small scales. ● It can't be described by Euclidean geometry. ● It has a simple and recursive definition. ● It has a Hausdorff dimension which is greater than its topological dimension – I think this means that it's boundary is greater than the area that it bounds.

Types of fractals ● Iterated Function Systems (IFS) - Cantor set, Sierpinski carpet, Sierpinski gasket, Peano curve, Koch snowflake, Harter-Heighway dragon curve, T-Square, Menger sponge ● Strange attractors – Lorenz attractor ● Random fractals – such as those made from Brownian motion, fractal landscapes, etc. ● Escape-time fractals – Mandelbrot Set, Julia Set, Nova and Lyapunov fractals.

Strange Attractors Lorenz Attractor

IFS Sierpinski Triangle Menger Sponge IFS – Iterative Function System means 'do something, then do it again, and again and again to the same thing ad infinitum'. Hilbert Curve

Escape-time fractals

Who's behind them? Edward N Lorenz ( ) David Hilbert ( ) Wacław Sierpiński ( ) Benoit Mandelbrot ( ) Gaston Julia ( ) Pierre Fatou ( )

GASTON JULIA – 1873 to 1978 Born in French Algiers Lost his nose in World War I At the age of 20 Julia Sets C = i

Along with Pierre Fatou, Gaston Julia predicted that some pretty interesting shapes would come out from the iteration of the equation: For a fixed value of C, where Z and C are complex numbers. A complex number is a number that has a real part and an imaginary part. And is written in the format: C, a complex number = a + bi, where a is a real number and bi is the imaginary part. Gaston Julia

Enter: Benoît Mandlebrot Benoît is pronnounced 'ben-waa' and Mandlebrot is Yiddish for Almond Bread. Born in Warsaw in In 1979 he got hold of a big “supercomputer” at IBM and played about with writing computer programmes to plot Julia's work described many years before. He came up with the idea of plotting a map of z => z^2 + c for every value of C in the complex plan and a miraculous pattern came out of the trusty old IBM plotter.

The Mandelbrot Set (Mandelbrot's Baby) ● Self-similar. ● Infinitely complex. ● A finite area enclosed by an infinite border. ● Plethora of beautiful images. ● Very simple equation. ● Easy to programme.

Fractals and I ● Was into them in the eighties because you could produce pretty pictures on your home computer. Bought of couple of hard maths books to try to understand them. ● Went to see Benoit Mandelbrot speak at the Arnolfini once, he signed my book! ● Wrote various programs with my mate Dan, including one for the Atari ST that was on an ST Format cover disk – Fractal Engine 3. ● Mandelbrot died last autumn and therefore I thought of doing this in tribute to him.

But first... A rather daft previous Fractal experiment.... The Mandelbrot Generator

HTML 5 ( = HTMLXR3i) ● New HTML standard developed by the World Wide Web Consortium (W3C) ● A hybrid of HTML 4.01 & XHTML 1.1 and a lot more. ● HTML 4.01 was a mess ● But XHTML 1.1 was too idealistic for folk to do interesting stuff. ● HTML 5 is a compromise and features the exciting, and tags and features like drag-and-drop and cross- document messaging

HTML 5 & the element ● The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, or other visual images on the fly. ● Great! ● Latest published version of HTML5 (May 2011) is available at

Defining and using In HTML: In JavaScript: var canvas = document.getElementById("mset_canvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#000000"; ctx.fillRect(ix,iy,1,1);

Mandelbrot/Julia Algorithm: Maths ● Thus; Z = x + iy and C = a + ib ● So; (x + iy) → (x+iy)(x+iy) + (a+ib). ● (x + iy) → (x*x + iy*iy + 2*x*iy) + (a + ib) ● (x + iy) → x2 - y2 +2iy + a + ib ● A complex number is an imaginary number + a real number (it is written as a+ i b) ● A real number (a) is an ordinary number. ● An imaginary number ( i b) is a real number multiplied by i, the square root of 1. Z → Z 2 + C Where Z and C are complex numbers.

Mandelbrot/Julia Algorithm: Maths (x + iy) → x2 - y2 +2iy + a + ib Therefore: x → x2 - y2 + a y → ib + 2iy As i = √1, so i 2 = 1 ● A computer cannot handle complex numbers directly*, so we split up the real and imaginary parts to form two equations and calculate them separately. ● * note that C++ does have a type complex Z → Z 2 + C Where Z and C are complex numbers.

Why's this equation interesting? ● Normal quadratic equation in real plane y = x 2 – 4x - 5 ● Iterative equation in the complex plan z → z 2 + c

The Mandelbrot/Julia Algorithm We call the following algorithm every point on our “slice” of the complex plane. Our range is from -2.5 <= x <= 0.8 and <= iy <= ALGORITHM: MsetLevel (cx, cy, maxiter) BEGIN x:=y:=x2:=y2:=0.0 iter:=0 WHILE (iter<maxiter) AND (x2 + y2 < ) DO temp:=x2 – y2 + cx y:= 2 * x * y + cy x:=temp x2:=x * x y2:=y * y iter:=iter+1 END WHILE RETURN (iter) END

Rendered in JavaScript function compute_point(x,y,cx,cy,maxiter,thresh) { var x2 = x * x; var y2 = y * y; var iter = 0; while ( (iter < maxiter) && ( (x2 + y2) < thresh) ) { var temp = x2 - y2 + cx; y = 2 * x * y + cy; x = temp; x2 = x * x; y2 = y * y; iter++; } return iter; }

Plotting our image … WHILE (iter<maxiter) AND (x2 + y2 < ).... If the sum of the squares is greater than (the threshold) then we assume the value of Z is spiralling to infinity, we break out and plot a colour depending on the number of iterations of the algorithm that it took. If we hit maxiter (the maximum number of iterations) then plot black. So, the black set is the orderly part that is not tending to infinity, that part that is on the inside. The colourful part is the chaotic part, tending to infinity.

The Mandelbrot Set plotting code function mandelbrot() { var canvas = document.getElementById("mset_canvas"); var ctx = canvas.getContext("2d"); for (var iy = 0; iy < res_y; iy++) { var cy = y_min + iy * y_prop; for (var ix = 0; ix < res_x; ix++) { var cx = x_min + ix * x_prop; var x = 0.0; var y = 0.0; var iter = compute_point(x,y,cx,cy,maxiter,thresh); if(iter == maxiter) { // if we didn't get to infinity by the time we // used up all the iterations, then we're in the set // colour it black ctx.fillStyle = "#000000"; } else { // otherwise colour it according to the number // of iterations it took to get to infinity (thresh) ctx.fillStyle = pallette[iter % num_colours]; } ctx.fillRect(ix,iy,1,1); } } }

The end result

In summary ● Fractals are pretty and still cool. ● XHTML 1.0/1 was nice and clean, but anally so and people forgot to live a little ● HTML 5 looks promising and the new as well as and tags look well exciting. ● Reconstructive surgery has improved greatly since Gaston Julia's time. ● Maths can be fun!

Thanks