## Thursday, October 7, 2010

### fractal classification continued

In my last post I was investigating the classes of 3d fractal based on symmetric 3x3x3 cube fractals. After looking at the 81 results, it looks like they can be reduced down to 5 class names (cluster, tree, sponge, shell, foam) and 5 class sizes (thin, composite, normal, extended and fat): The fractals are made of three elements, solid, space and border points. The thin fractals are border points surrounded by space, the fat fractals are border points surrounded by solid.
I realised that the first 3 rows classify the 2d fractals, and 1d fractals are just the clusters, so the table above should generalise most basic fractals. It reminds me of a periodic table actually.

It amazes me how well this table can be used to describe natural scenes:

the set of names above gives a much better description of the scene than for instance trying to describe it out of spheres, polygons etc.

An interesting thing about fractal shapes is that they really define a behaviour as well as a visual shape. For example, it is inevitable that if you put a cluster into a box and try and see if it has a pressure by squeezing the box, then it will have a pressure, just like a gas. Equally a composite tree will brissle in the wind if there is any wind (force) at all, it will behave like a tree, with the large bows moving slowly and the ends shimmering rapidly. A composite sponge will be squeezable and will return to its original shape... why? because any motion given to the sponge's spokes through squeezing it will distribute into seething vibrations (a temperature) of the shape, and through self collision these vibrations will give the fractal an elasticity.
Composite shells are not elastic, since the branching planes prop their neighbours up, so just like their counterpart in nature they are stiff objects, which can encase and protect trees (the shape of most animals) which are flexible.
Thin foam has known and measurable surface area for each bubble and a known and measurable volume of the space in each bubble, as such you cannot change these without it becoming a different value fractal. Therefore surface area and internal volume must be preserved, just like a normal bubble. This means that (assuming the bubbles are not perfect spheres) then due to temperature effects the foam will appear elastic (like a sponge) but preserve volume (unlike a sponge).
The classification table also has an implied 'empty space' fractal right at the top, and 'full solid' right at the bottom. Between these extremes is a curious fractal that doesn't fit into the table, it occurs where all blocks recurse, none are empty, none are solid (#40 on the 3x3x3m cube). The fractal isn't thin and it isn't fat. It contains no solid, therefore it should act like space and objects can pass through it, but it also contains no space, it has a measurable volume of 27m^3 so this volume cannot change without it being a different fractal. Hence it is volume preserving but not stiff. Its inverse is itself, so is half way between solid and space. It seems to me that this fractal should be called 'liquid', as its behaviour seems to match this description quite precisely.

So what I find amazing about these classes of fractals is that, far from being abstract, they really represent the nature of real world objects. A cluster (which is itself a model of gas) has a pressure, sponges are spongey, trees brissle, shells are hard, foam acts like foam. I am not making any concessions here, like pretending solid parts are a bit soft, these 100% precise and accurate mathematical fractals really are spongey, foamy etc, this comes straight from the mathematical definition of each object.

Lastly, under the 'class' category we can give an 'order' to each fractal where the order of a fractal is how many branches it employs each recursion. For example, a binary tree has order 2 and a trinary tree order 3. So higher order fractals are more dense I suppose you could say.
The interesting thing about this is the low orders... a tree order 1 has only one branch each recursion, so can give a spiral or cone. A sponge order 1 has only 1 loop attached to the primary loop each recursion and order 1 foam has only 1 bubble attached to the parent bubble each recursion. These are all valid fractals (even if they don't always give a fractional dimension). They follow all the same rules.
What about an order 0 tree? well this has no branches, it is just a trunk... a euclidean line/cyclinder/blob. An order 0 cluster? the main blob has no children, so is just a blob. For the thin fractals, the order 0 versions of a cluster, tree, sponge, shell, foam are topologically: point, line, circle, plane, sphere.
What this means is that we can classify euclidean shapes with this same system that is used with fractals, they are all one big group. Euclideans are order 0, spirals etc are order 1, fractals are order 2 and above.

I'll finish this post with a fun collage I made of natural fractals, it is a bit of puzzle to discover why each one fits into the box that it is in:

## Monday, October 4, 2010

### 3d fractal types

Even though fractals have been around for half a century, they haven't been really accepted yet as fundamental objects, even though they are generally a better description of natural objects than the euclidean geometry from the ancient greek times.
So, while there is an enormous body of work that categorises shapes such as polyhedrons, it seems fractals haven't really been categorised at all, especially 3d fractals, at least I can't see evidence of this in the public domain.

So today I decided to start categorising. The easiest way to start is to take a 3x3x3 cube (i.e. made of 27 unit cubes) and enumerate the different fractals that you can make with it. For example, if you remove the middle cube and all the face cubes, recursively, then you get the menger sponge.
We simplify the task by reducing the cubes to remove to just the symmetric categories of the middle cube (m), the face cubes (f), the edge cubes (e) and the corner cubes (c), this also has the generalising property that these four categories represent the volume, surface, borders and corners of any polyhedron that might be used in a recursive fractal.

For each category of cube, I choose whether it is outsidethe set (0), recursion applied (1) or inside the set (2). Hence each fractal that I enumerate can be given a trinary code cefm = 1201 (from 0000 to 2222).

Lastly, I want to categorise the *type* of fractals that you can get out of this, not the specific shape. Something more like topology than geometry, but recursive topology.

So here are the results

Most of the names of the types I made up, and I still don't know how to categorise most of these fractals. I think it demonstrates how small our vocabulary is when it comes to even simple fractals like this. Compare it to the euclidean truncated-stellated-hemi-hexahedrons, inflated ellipsoids and non-rational-B-spline-patches etc, where the vocabulary is rich.

I also think there are some fractals in this set that I have never seen before. The branching surfaces are probably the ideal conductors of heat, but I have never seen the shape before. The variation of this #12 which is ridden with holes, and #15 are novel, well to me at least.

People are slowly realising that not only are fractals good approximations of nature but they are also optimal configurations, e.g. a tree shape is the most efficient way to transport water, a fractal coastline is the most optimal way to dissipate the destructive energy of the waves etc. Categorising and creating a vocabulary for 3d fractals seems really useful in this regard.

## Monday, September 6, 2010

### ultra operators

Following on from a previous post (http://tglad.blogspot.com/2010/07/that-crazy-formula.html) it is an interesting exersize to push the number of operators back another notch. Here's a somewhat speculative idea.
Take the ultra-operators of the previous post and increase their position by one, so operator 1 is equality, 2 is addition, 3 multiplication etc. Then make the 0th operator the comma operator.
The previous post talked about having a number-of-values (rather than a set of), this concept is defined by the use of ',' to allow more than one. So the value of a,b is simply the two values a and b, i.e. well it is just a,b i.e. it doesn't really operate on the two value other than to allow them to exist side by side.

This could extend the previous crazy formula to:
e (4) i (3) pi (2) 1 (1) 0 (0) .
i.e. e^i*pi + 1 = 0,.
where . is the empty element, or void, or the contents of the empty set.

It leads to a new creation story for numbers (going from right to left in above equation)...

In the beginning there was nothing (void)
For there ever to be more than this, the concept of a plurality (',' operator) is added
The first value can now exist alongside void, and since there is no arithmetic yet it is and can only be nothing/zero
Being a proper value it equates to something, hence the '=' operator can exist
The existence of equality allows for inequality (something that doesn't equal 0), we name that something 1, the unit.
What is to 1 as 1 is to 0? this recursive question leads us to define the set of integers and consequently the addition operator. (and inversely the subtraction operator as seen by seeing the above equation as -1 + 1 = 0)
Repeated addition on the integers leads to a definition for the '*' operator (and inversely divide) which leads to the quotient numbers.
This somehow leads to a new type of number not represented so far, pi the architypal transcendental.
Repeated multiplication leads to exponentiation operator
This (and its inverse, logarithm) require the new number e
Exponentiation leads to the question x^2 = -1 what is x? which leads to the development of the imaginary number i.

Writing this made me think, most operators come in pairs, so what are the inverses of ultra operators 0 and 1?
I would guess that the inverse of equals is 'doesn't-equal' (!=), but what does it evaluate to? Well wrap the values inside sets and '=' becomes the intersection operator I think.. so '!=' would probably be the equivalent of union minus intersection, or a xor b.
Harder it the ',' operator, what is its inverse? (call it ';') what is a;b?
My guess at the correct answer is that it is its own inverse (or equally it has no inverse). What do you think?

## Thursday, September 2, 2010

### a 3d mandelbrot

This is an idea for a mandelbrot set taken to the next dimension.
The boundary of the mandelbrot set can be thought of as a set of bifurcation points, each bifurcation point represents a stable orbit, the stable orbit takes up a small space so variations of it allow an expanded attraction basin, these are seen as the disks that sit off the main cardoid. The stable orbits can be equally considered to be polygons.
From the first disk clockwise towards the real axis the largest disks come off at the main bifurcation points that represent orbits that are: a line, a triangle, a quadrilateral, a pentagon, hexagon etc. They aren't regular polygons. Other smaller disks appear at stars and more complex polygons.

A 3d equivalent of the boundary would be a set of points that represent the stable polyhedrons that exist. Thus you may expect the bulbs to appear at a plane, tetrahedron, cube, octahedron etc.
In order for an iteration to trace out a plane it needs to operate with a full orientation and the iteration needs to branch, in fact produce two children each iteration to represent the 2 dimensions of the surface of a polyhedron. Inside would be if all branches stay bounded.
An equivalent of the mandelbrot would also have universal properties, one necessary condition seems to be the doubling of the angle.

What would such a set look like? well you would expect offshoot bulbs at distorted versions of all the regular polyhedrons and stellated polyhedrons. It seems like the number of bulbs will be far fewer as stable polyhedrons are rarer than polygons. It also seems like the large bulbs will be finite in size, so the surface will be quite different to the mandelbrot set.

Here is an attempt at the formula, which at least gives an indication of how such a mandelbrot might be constructed:

Julia set:
The julia branching iteration requires a rotation for each branch, which is 2 quaternions, so the map is 8D.
branch1: q1 = q1*q1 + c; q2 = q2*q1 + c;
branch2: q1 = q1*q2 + c; q2 = q2*q2 + c;

The idea is that each iteration the orientation (representing an polyhedron face) is rotated in two different directions, deformed versions of all platonic solids should be possible from this if c=0. If not then this formula is wrong.

Mandelbrot set:
the 4d set of points c for which the corresponding julia set is connected

A problem with this is that the set is intractable, the computation doubles each iteration.

Another construction may be mathematically simpler and in this way may be more likely to be the correct extension...
Instead of quaternion pairs you operate on octonions O, so the julia set needs to produce two versions of O^2 (for branch1 and branch2), the first uses just the octonion multiply. The second is the octonion multiply but with the first 4 and last 4 components swapped. This recognises the fact that the octonion is two quaternions that have equal precedence.

### Measuring those awkward things

Imagine what the world would be like if only knew about whole numbers... no fractions or decimals. It would be very hard to live the life we do now without using continuous 'real' numbers, I think you would agree. Imagine the difference it makes to every part of study and work to be able to use these in-between, fractional numbers.
Now imagine yourself in the future looking back at today, a time when we only ever measure things using a whole number of dimensions. We can only ever measure the length of a river by pretending it is measured in metres^1, we can only count the branches on a tree by choosing a minimum size to be considered a branch.
In the real world most things do not have an integer number of dimensions, and pretending they do leads to problems in measuring them, an example of this is if you look up the length of Britain's coastline, you should find the quoted figures vary hugely.
Most things in the real world such as clouds, trees, land, water surface have a fractional number of dimensions.
OK, it seems reasonable to argue that nothing in reality is a fractal because nothing keeps its detail to infinite depth (to its atomic structure and beyond). However, the same argument can be used for whole numbers of dimensions, nothing in nature is made of absolutely straight lines or perfectly smooth curves either. The fact is that in both cases we approximate the real world within the range that is important to our measurements.
How do fractal measurements work? well the theory seems to already be known, but not apparently well used. You can use the Hausdorff measure to find the 'size' of a fractal structure, so if a coastline has fractal dimension 1.2, then you can measure its size in metres^1.2, e.g. Britain may be 200,000m^1.2.

So what would the world be like if we all started using fractional dimensions? Here are some areas with made up examples:
Geography:
measure the area of mountainside in metres^2.3
count the boulders on a scree slope in metres^0.5
measure the size of a river system in metres^1.4
Meterology:
measure the cloud cover in humidity^1.3
measure the wind levels in (metres per second)^1.2
Town planning:
measure the number of roads in metres^1.4
Astronomy:
count the moon's craters in metres^0.5
count the number of asteroids in the asteroid belt in kg^0.6
Biology:
measure lung size in metres^2.5
measure the number of neurons in the brain or the size of the cortex (both fractal)
count the number of animals on the planet in kg^0.8
measure the size of a forest by more than just the number of trees, include all smaller vegetation.
Chemistry:
measure the speed of a chemical reaction in seconds^0.5
Maths:
compare the size of various algebraic fractals
Economics:
stockmarkets fluctuate in a fractal distribution, measuring the size of different distributions is helpful
company pay follows a power law, so is fractal, so can be measured.

In fact, the point of this long post is really to say that pretty much everything follows a power law of some kind, so the only sensible way to measure it is a with a fractal measure. Something that as a whole we really don't do at the moment.

Next post I will go through the maths of measuring things with power laws.

## Tuesday, July 27, 2010

### A reduced programming language

Not to bang on about the '=' operator, but this alternate definition described in previous posts seems like an interesting way to produce a reduced programming language... I'm not sure how useful it would be but it is a kind of interesting thought experiment.

If you have the equation 4 = x*x then its value is 4, but its value can only exist in a universe where x is 2 or x is -2. If we previously had the expression x = all reals; (by this I mean it is the contents of the set of reals, it isn't a set itself), then the later expression 4=x*x can only exist in the subuniverse of the first expression where x = 2,-2. It is not that the first expression x = all reals is now wrong exactly, but that for most elements e.g. x = 0, their existance has become infinitely unlikely.

Anyway what does it all mean, well it means that with a programming language that follows this '=' operator design we could write:
x = reals;
x = 3; <-- this expression evaluates to 3, and can only exist as a statement if x then becomes 3
but unlike most languages you could equally write
3 = x; <-- x becomes 3
and as eluded to in previous posts, you can use = in equations like so:
y = 2 * (x = 3); <-- x becomes 3, y becomes 6

'=' becomes like a filter on the previous expressions, for example:
x = reals;
x^2 = 4 <-- x becomes 2, -2
but if we write
x = reals;
x = -2;
x^2 = 4 <-- x will be -2, since it is a subnumber of values of its previous self

What if you write:
x = reals;
x = 4; <-- x becomes 4
x = 5;
In this case there is no subuniverse that can exist where 4=5, so the value of x=5 is void and x becomes void.

You can of course write very complicated equations and get answers, e.g.
(x^2.3 + x^-1.7)^(x+1) = 13;
The design will filter x appropriatly. However it is very hard for a programming language to solve arbitrary equations like this in general. Such a programming language would probably reference a large database of formula patterns on the net to provide a solution. This has the advantage that the user doesn't need to manually write its own solvers separately for every equation they have, and these complicated solvers can use stable, well trodden algorithms.
But also users should have syntax so they can write your own solver, for example:
(x^2 = 2*x)
<
// optional user defined solve function, can call a common routine:
>

What if we want to perform some arithmetic on a 'number of' values? We can use the syntax:
(number of values)
{
}
which the block will be executed for each individual value, e.g:
(1, 2, 4)
{
print("value = ", value);
}
In fact, we can use 3 different notations for 3 different effects:
- a 'number of' something has no particular order, but can have more than 1 of the same value. 1,2,2,3 == 3,2,1,2. It optionally uses () to resolve ambiguity, so matches the use of () in functions and matches that (1,2),3 == 1,2,3 == 1,(2,3)
- a list of something has a specific order and can repeat values. It can use [] like arrays.
- a set of something has no specific order and number of repeated values is ignored. 1,2,2,3 == 3,2,1. It can use {}.

The result is that a list is executed in order, but a 'number of' and a set can be executed on separate threads.
(1,2,3)
{
}
{1,2,2,3}
{
// executed on separate threads, only 3 executions
}

OK, so far so good. The thing I find interesting about such a language, is it has surprisingly few keywords...
- we can do an if statement like so:
(x=3)
{
print("x is ", x);
}
- we can do a while statement like so:
x = integers;
x >= 0;
[x < maxCount ]
{
...
}
- and hopefully you can see that a for statement and a do{}while can be written similarly.
- There is no ==, you just use the one = operator.
- Threading is done through the use of sets/'number of's rather than the serial lists.
- 'and' also can be used, you can write (x^2=4 and x<0) this evaluates to 'true' and x will be -2.

I'm not sure how it is supposed to cope with infinite expressions though:
x = reals
x >= 0;
(x<1)
{
y = y^0.9;
}
Perhaps an internal search algorithm can pick values and try to converge towards a solution... not very easy though... but an interesting and in some ways powerful language none-the-less.

## Wednesday, July 21, 2010

### What = really means, and a variation of sets

I have often wondered how = fits in as an operator in a strict mathematical setting. It doesn't seem right that is is simple a boolean function, why should the value trueness or falsehood matter to equations.
In a previous post http://tglad.blogspot.com/2010/07/that-crazy-formula.html, I followed a train of thought that lead to equality being seen as the 0th operator of modified hyper-operators (where 1st operator is +, 2nd is *, 3rd is power etc), I called this slight modification ultra-operators.
With this definition, equals only returns a value when the two values are equal, a bit like this in pseudo C++:
operator =(a, b)
{
if (a==b)
return a; // or b
}

This leads to a problem of definition, what is the value of 1=0? no value is returned, but we cannot therefore say the value is the empty set.. because who says it should be returning a set. If it returns the empty set, then we could equally say that 1=1 returns the set {1}. However, it is wrong to think of 1 and {1} as being the same thing, since by induction it should be the same as {{1}}, and {} would be the same as {{}} and none of these are true of sets.

The more correct answer has to be that = returns a number of results, that number may be 0, e.g. 1=0 returns 0 results, or it may be 1, e.g. 3=3 returns 1 result. Or it may return 2 results e.g. x^2=2+x.

But no-one has put these numbers into a set. In fact it is probably useful to give a name to this concept, so instead of a set of values, we have a 'number' of values. So whereas a set of the first 3 integers is {1,2,3}, a number of integers is 1,2,3. And the equivalent to the empty set is just 'empty' or void.
So void does not contain itself, and a single value like 3 is also the same as a 'number' of values 3 (the number happens to be 1). Also the number of values containing 1,2 and the third element being the number of values 3,4 is the same as the number of values 1,2,3,4. i.e. there is no containment going on.

So what to make of a common formula such as

x^2 = 2+x where x is a member of integers <-- which is a set

The problem with this common definition of the formula is that it doesn't say which member, it just says 'a' member.
The set version would be
{ for all x member of integers: x^2 = 2+x }
but this is more long winded, and gives a set of answers, which isn't part of the scope of basic arithmetic and doesn't match the value of other operators which just give values.

Instead, what the above (normal) formula is actually shorthand for is:
the 'number' of values
x^2 = 2+x for each x in the set of integers
which is short hand for:
0^2 = 2+0, 1^2 = 2+1, 2^2 = 2+2, 3^2 = 2+3, ....
a 'set' of values without the brackets, i.e. a 'number' of values.
since there are only two above that actually evaluate to anything, this can be shortened to:
-1^2 = 2+-1, 2^2 = 2+2
which evaluates to:
1, 4
i.e. the formula itself has a value.
Therefore you can do arithmetic on it:
3*(x^2 = 2+x)
which gives 3, 12.

Equality operator isn't a boolean function, it is simply a way of writing a value (or a number of values), writing 1, 4 is exactly the same as writing x^2=2+x, just as 2/4 is the same as 1/2.
So writing an equation with no answers is the same as writing nothing... writing 1,2,1=0,4 is the same as the numbers 1,2,4.

Interestingly some programming languages have picked up on this before mathematics has I think. Several languages will simply ignore expressions that don't add up, and the language C already give '=' a value, for example:
a = b = c; works because b=c has the value b (though admittedly this is also assigning c to b).

So in summary, if we all add 'number of' to the already existing 'set of' and 'list of' then we get a formal way to deal with multiple results. And since 'number of' has no container, the equivalent of the empty set {} or the empty list () is just 'empty' or void.

The same sort of thing should also work for inequalities, e.g. x<10 x member of reals is a 'number of' values, where the number happens to be infinite. Thus it has a (or many) value(s) and can be used in equations, e.g. 3 * (x<10) = x<30.

This will probably feed in to the soft numbers post coming in a few weeks.

### That crazy formula

I rarely consider mathematical formulas on their own to be beautiful things, but there is something quite special about one formula in particular, here it is:
e^i*pi + 1 = 0
The formula is saying 'if you rotate 1 by 180 degrees then you get -1'.
It is a very satisfying formula, it contains a plus, a multiply and a power, and it contains possibly the four most useful numbers in mathematics, 0, 1, pi and e.

Another reason why it is a special formula came to me yesterday when I was investigating how the units of measurements combine in formulas.
If we square a velocity (in metres per second) we get a value in square metres per second squared. So if you write the units as a vector [metres, seconds] then a velocity is [1, -1] and a velocity squared has units [1, -1]^2 = [2, -2].
What if you multiply two measurements together? What units do you get if you multiply a velocity by an acceleration? You get [1, -1]*[1, -2] = [2, -3].
Can you see the pattern? Well here it is... if you take a measurement to the power x then you multiply the units by x. If you multiply two measurements then you add the units together. It seems that the units operate one 'level' down from the operation on the measurements themselves.
To clarify this idea of a 'level' we need to look at hyper operators. Here they are:
a (1) b means a + b
a (2) b means a * b
a (3) b means a ^ b
So what seems to be the case is that the units of measurements A (n) B are a (n-1) b (where lower case means units of).

So what happens if you add two measurements together? what happens to the units? Well what are the units of a velocity plus a time? or a position plus a velocity? A tough question... you could say that the resulting measurement is unitless, but that is actually wrong, a gradient (e.g. height/width) is unitless. The sum of two measurements seems to be 'less than' unitless, unlike a unitless measurement which has a vector [0,0,..,0], the sum isn't even that, it isn't even the empty set because it isn't a set, it is just empty, void.
However, you can still sum measurements if they have the same units... an acceleration plus an acceleration still has units [1, -2].

This is interesting because it means that we have defined a (0) operator, not only that but it is different from the normal 0 hyper operator (which is succession), we have:
a (0) b = void if a different to b
a (0) b = a if a same as b (or it can equal b, same thing)
I like this new version of the 0 hyper operator (maybe we should call them ultra operators from now on), because a (0) b is a binary operator and is symmetrical.
The best part about this operator is that it has an obvious meaning that we use in every equation ever written, it is the equals operator! It is actually an important change to how '=' is interpreted. Rather than thinking of a=b being a boolean expression, it is numerical expression that either returns the equal value, or simply doesn't return. A bit like this:
operator = (a, b)
{
if (a==b)
return a;
}

Anyway, where was I? Oh yes, this brings me around to the other reason why the formula at the top of the page is special. If we write it using ultra operators it looks like this:
e (3) i (2) pi (1) 1 (0) 0

It is quite a simple formula wouldn't you agree?

It makes me wonder whether there is some more that can be learnt from it.