Wednesday 27 August 2014

Pure Web Mandelbrot Explorers

I love tools that are purely web based.

The benefits are huge - you don't need to install any software, the software is automatically updated by the supplier, it works across any operating system or device or brand as long as it supports modern open web standards. You can carry on working between devices, from different location, and you don't lose your work if your local device breaks.

You can do quite a lot with pure web technologies - Google's office productivity suite is a great example, so is wakari.io's IPython in the cloud.

You can explore the Mandelbrot fractals purely with a web browser too.

I love the following tools I discovered recently:







Tuesday 26 August 2014

The Complex Plane And Plottable Arrays

Some readers have asked me to explain the slightly complicated translation between the complex plane (where the Mandelbrot set really lives) and the Python arrays used to plot the images.

The reason for the complexity is that:
  • The complex plane is continuous, just like the real number line.
  • Python arrays are discrete, filled with finite boxes. 
  • What's more, the elements of python arrays are labelled using integers starting from zero. You can have array[2, 3] but not array[-2.34, +4.3398]. 
  • We have to plot arrays, even though we really want to see the complex plane. This is the core reason we need to translate between the complex number plane world, and the python array world.

The translation itself is simple. We divide up the complex plane into equally spaced and sized sections. There are an integer number of these - and so they can be represented by the elements of an array.

So when we choose an element n out of N along a section which started at x1 and ended ay x2, the element n corresponds to x1 + (x2-x1)*(n/(N-1)). You can see here that n/N is the proportion between x1 and x2 that n lies.

If this expression looks complicated to you - it's just working out how far from x1 towards x2 we need to go in the same proportion as n out of N pieces.

Ah - and don't forget n starts at 0 and ends at N-1, which makes sense so that when n=0 we have the position x1. Similarly when n is the last N-1,  it corresponds to x2.

The following diagram shows our explanation visually: (click to enlarge)

The Deep Connection Between Julia and Mandelbrot Fractals

The Julia and Mandelbrot fractals are intimately connected.

They are both generated by iterating the simple function z2 + c.

For the Mandelbrot set, z starts as the value of the point being tested on the complex plane, and c is zero. In effect the function becomes z2 because c is zero.

For the Julia sets, c is set to a contant value throughout all the calculations. In thisway, c uniquely defined that particular Julia fractal. That same c always generates that same pattern.

If you've explored the Julia and Mandelbrot sets, you may suspect that there is a connection between the two. In fact there is:

  1. Julia sets whose unqiue c value falls inside the Mandelbrot set are connected - that is, they are all one piece.
  2. Julia sets whose unique c value fall outside the Mandelbrot set are not connected - that is, they consist of many disconnected pieces. 
  3. Julia sets whose c lies further away from the Mandelbrot set have greater fragmentation, until they become almost dust like.

The following digram summarises this deep connection: (click to enlarge)


Saturday 9 August 2014

Slides.com for PyData London Meetup

I'll be presenting a five minute flash presentation on Make Your Own Mandelbrot on the 2nd September for the London PyData Meetup.

A perfect excuse to try out alternative slide presentation tools!

Prezi was nice but it's expensive. Impress.js is flexible but not great if you don't want to hand edit code.

Slides.com is great! Easy, beautiful, and with a free option too.

He's the current iteration:

Saturday 2 August 2014

Home Schooling

I was pleased to hear a friend of mine bought the Make Your Own Mandelbrot ebook to  inspire his child who was struggling to be excited by mathematics.

He hoped that the easy, conversational, approach and the connection with unusual behaviours, and some fantastic images would excite his secondary school boy.

He also hoped the introduction to Python would ease the path into computer literacy, addressing a fear of the "technical stuff that happens under the hood". I found this suprising because most boys, including this one, were avid computer and games console users - but upon reflection that is different from playing with programming and electronics, and ultimately computational thought.

I wish him well and I hope others will too! The summer holidays are an ideal time to play with mathematics and computer programming in a fun recreational way, and not have the pressure of any teacher marking your work!