Tuesday 31 March 2009

Thinking four dimensionally

Prompted by Alan Davies' maths programme on the telly just now, in which they didn't explain four-dimensional thinking very well IMHO (i.e. a fourth dimension in space, not time), I shall try and explain it better (this is something that has bugged me for ages).

Let's imagine you run a shoe shop, and you keep a record of all the shoes you sell in a year.  For each sale, you record four items of information (four 'dimensions'):
1. What size are the shoes.
2. At what time of the day you sold them.
3. What type of shoes they are (e.g. are the shoes for a baby, a child, a teenager, a woman or a man).
4. The date on which you sold them.

Anybody can imagine a long list of total daily sales figures for all sales of all types of shoe, from 1 January to 31 December. Let's call that one-dimensional for now. (You could argue it's two-dimensional already, as just giving a total number of pairs sold for the whole year would be one-dimensional, but this is my thought experiment, so don't interrupt).

We can also easily imagine a table, with the dates 1 January to 31 December down the side and 'type of shoe' across the top, with a number in each square. Let's call that two-dimensional.

It's not too difficult to imagine how we'd add a third dimension, for example how many pairs you sold on each date of each type in every two-hour period that the shop is open. Instead of a flat table with rows and columns, you'd have a cuboid, with dates 1 January to 31 December along the length; 'type of shoe' across the width; and 'time of day sold' down the side. This divides the cuboid into little cells, each with a number in it: I've done a rough example and filled in a few cells which show that you sold:

- 5 pairs of women's shoes on 4 January between 9 am and 11 am;
- 2 pairs of babies' shoes on 4 January between 1 pm and 3 pm; and
- 4 pairs of babies' shoes on 6 January between 9 am and 11 am.


The number '4', for example, is aligned with 6 January lengthways, with 9 - 11 am vertically and with 'baby' across; the number '4' is aligned in three dimensions.

Once you have pictured the cuboid, it is also easy to imagine that instead of the labels down the side being 'time of day' they would be 'shoe size', and then presenting the same raw data but with different numbers in all the cells, which is still three-dimensional.

But what happens if you try to show all four 'dimensions' (i.e. date; type of shoe; time of day; and shoe size) at the same time? We can imagine writing down these variables each time a pair of shoes is sold, so we know the data is* not complicated, but what does it look like (short of copping out and sub-dividing each day into hours lengthways)?

Well, all you have to do is sub-divide the three-dimensional cuboid space into four dimensions, so that each number can be clearly aligned with date (in one dimension, call it 'lengthways'); with 'type of shoe' (in another dimension, call it 'across'); with time of day (another dimension, call it 'down') and with shoe size (another dimension, call it ...)

* I refuse to treat 'data' as a plural noun, even though it would be the grammatically correct thing to do.

12 comments:

AntiCitizenOne said...

I do Relational Databases and you can get a rather weird feeling cramming >3 dimensional structures into your head.

It also knocks your ability to do English!

Nick Drew said...

Surely you know of Minard's famous graphical depiction of the data relating to Napoleon's retreat from Moscow ?

In a 2-D graphic of relatively simple design (certainly very easy to interpret) he captures 6 dimensions:

- latitude
- longitude
- time
- temperature
- number of men left in the army
- direction of march

(it can be argued that the 6th, direction, may be inferred from the 1st three and is therefore not truly a separate dimension)

Mark Wadsworth said...

AC1, that was what got me thinking.

ND, nobody has ever topped that one.

AntiCitizenOne said...

Of course I'd put the shoe buying events in 11 separate rows, and use a query to group them by days.

Mark Wadsworth said...

AC1, on reflection, the dimension of 'time of day' is a subset of 'date of year'.

But you can easily add as many fields as you like to the database (price, colour, lace up or slip on etc) and a computer will manipulate it in any number of dimensions, the question is, although we know those dimensions exist, WHAT DO THEY LOOK LIKE?

AntiCitizenOne said...

You can only look at 3d projections of the hyperspaces. It's pointless to try.

dearieme said...

"data" is plural - if in doubt, consult Cambridge Tripos papers.

dearieme said...

And "data" is pronounced dahta not dayta. If in doubt, consult the lyrics of Lorenz Hart.

AntiCitizenOne said...

data is a star trek robot. If in doubt vast areas of the interweb are dedicated to "him".

Dave H said...

I don't have a problem using multidimensional arrays in BASIC, but I must admit to being too thick to visualise them.

Anonymous said...

The way to visualise it is that when you add the fourth dimension, you now have a LINE OF CUBES. Thus the fourth dimension is which cube along that line you're looking in.

Then, when you need a fifth dimension, you have an area of cubes - each cube has two co-ordinates and itself contains three.

For six dimensions you now have a cube of cubes.

When it gets to seven, you have a line of cubes of cubes.

And so on.

No limits except after a while your brain may explode thinking about it.

Like Dave H, I had to start thinking like this when programming - though in my case, being an old git, it was Fortran IV.

Peter Risdon said...

Surprised you didn't mention Heinlein's And he built a crooked house.

Like other readers here I work with multi dimensional data structures, but I can't say I find it in any way useful to try to visualise them. For me, it's enough that the number of dimensions is simply the number of pieces of information needed to locate a single point.