Abstract form

Higher spatial dimensions

Posted in astronomy by Homam Hosseini on December 15, 2009

A few days ago I had an interesting discussions about the existence of other dimensions. In my experience most people who have heard about Big Bang, relativity or even inflationary theory are unfamiliar with have a vague understating of this concept. Although higher spatial dimensions are extremely easy to understand and even have applications in everyday circumstances.

Most of us are familiar with the idea of flatlanders (thanks to Carl Sagan), 2-dimensional flat creatures that live on a plane, or a surface. A flatlander can never see a 3rd dimension but he can deal with it mathematically. A flatlander can certainly understand points, lines, circles and all other 2D geometrical objects. A flatlander needs 2 piece of information to identify any point in his universe: X and Y. He should have no problem in imagining line-lander creatures who need one piece of information to identify the positions in their universe: X. He can think that his flatland is made of infinite number of line-lands. To make a flatland you have to take a line-land and drag it in a direction orthogonal to it.

Flatlander knows that any position in line-land can be described by:

Position_{Line} = (X)

And any position in flatland can be described by:

Position_{Flat} =  (X , Y)

Or

Position_{Flat} = Position_{Line} , Y

Y is a dimension that is unknown to line-landers and is the direction that we dragged the line-land to create a flatland.

We as 3-dimensional creatures can think that our 3D world is made of a flatland, dragged in a direction orthogonal to it. Any position in our world can be described by:

Position_{Volume} = (X, Y, Z)

Or

Position_{Volume} = Position_{Flat}, Z

Z is the new direction that is orthogonal to flatland.

You already got the picture, a 4-dimensional creature can drag our volume-land in a direction orthogonal to it to create his 4D world and so on.

Position_{4D} = Position_{Volume}, W (W is the new dimension).

In other words:
A line-lander has no idea of a flatland. The position is only X for him. He describes a 0-land by X.
A flatlander describes a line-land by Y = (X), a set of Xs.
A volume-lander describes a flatland by Z = (X, Y), a set of (X, Y)s
A 4D-lander describes a volume-land by W = (X, Y, Z), a set of (X, Y, Z)s.

From elementary mathematics you must remember that a set of objects could be described by a function. For example if F is a function defined on real numbers and for each real number that it receives it returns another real number then:
y = F(x)
Is the description of a line-land from a flatlander’s point of view.
Other kinds of line-lands include:
y = x
y = 4 x + 5.12
y = x^2
y = \sin(x)
y = 2(\sin(x) + \cos(x))
And so on.

The line-lander only knows about X. If somebody tells him that his line-land is a part of a flat-land he doesn’t immediately find out what F function describes his line-land the flatland. But F is easily known to the flatlanders who are studying the line-land. Generally F describes the shape of the universe in a higher spatial dimension.

Let’s talk about an interesting example. Assume that the line-land world as it is seen by our flatlanders is a circle. It means that F = \pm \sqrt{r^2-x^2-y^2} . The poor line-lander has no idea about the 2-dimensional shape of his world but he can find it out.

The line-lander finds out that his world is indeed bounded if he starts walking toward a direction and reaches the starting point.

A sphere is a 3-dimensional circle, F for a sphere is:
F = \pm \sqrt{r^2-x^2-y^2-z^2}

Let’s rewrite these two equations in a more usual form:

1D Circle: x^2+y^2 - a^2 = 0
2D Sphere: x^2 + y^2 + z^2 - a^2 = 0

Look at the pattern:

0D A Pair of Points x^2   - a^2 = 0 \omega_1 := \left (x^2 - a^2 \right )
1D Circle (x^2 - a^2) + y^2 = 0 \omega_1 + y^2 = 0, \: \: \omega_2 :=  \left [ \omega_1 + y^2 \right ]
2D Sphere \left [(x^2 - a^2) + y^2 \right ] + z^2= 0 \omega_2 + z^2 = 0, \: \: \omega_3 := \left \{ \left [ \left ( x^2-a^2 \right ) + y^2 \right ] + z^2 \right \}
3D 3-Sphere \left \{ \left [(x^2 - a^2) + y^2 \right ] + z^2 \right \} + w^2 = 0 \omega_3 + w^2 = 0
ND N-Sphere \sum {X_{n^2}} - a^2, \: \: n = 0 \: to \: N \omega_{N-1} + X_N^2 = 0

The surface of a sphere could be described by many circles. The smallest circle at the north pole is a point, the radius of the circles grows as we reach the equator and then again shrinks back to 0 at south pole. This is best described in this form of spherical coordinates:

x_1 =a\cos(\phi_1) is a circle. A sphere is a collection of circles stacked on each other. The circles at north and south pole have 0 radius and the radius of the circle at equator is maximum (a). We can think that the radius of these circles change by: r = a\cos(\phi_2). This \phi_2 is orthogonal to \phi_1 (and is in the new dimension).

So x_2 =a\cos(\phi_2)\sin(\phi_1) describes a sphere.

In the same sense you can think that a circle is made of many pairs of points. At the top of the circle the distance between the pairs is 0, it reaches a maximum in equator and again 0 in the bottom.

Now we can extend this model to higher dimension spheres. Take a 3D sphere with radius 0, increase the radius to a maximum and then shrink it back to 0; you have a 3-sphere.

x_3 = a\cos(\phi_3)sin(\phi_2)\sin(\phi_1) is a 3-sphere (a 4 dimensional sphere)

This way you can make other higher dimensional shapes. Note that here we only talked about spatial dimensions.
For example a stack of lines in Y-direction makes a square, a stack of flat squares in Z direction makes a cube and a stack of cubes in W direction makes a tesseract.

Take a look at the projection of a tesseract (4D cube) in 3D space here.

Tagged with: , ,

Hollywood Principle

Posted in Coding, Development, Internet, JavaScript by Homam Hosseini on December 7, 2009

Today I was working on refactoring some names in Hyzobox In/Out API. It is my personal favorite piece of code in the whole platform. In summary it allows the publisher of the game to customize the game in runtime dynamically by injecting codes and executing some functions in the context of the game (In) and to get notified about the events that are occurring inside the game (Out).

Inversion of Control is very natural in JavaScript and it has been used extensively in In/Out API. It’s quite different from popular prototype pattern but most everyday JavaScript programmers use IoC even though they don’t usually notice it.

Here is a sample in our API:

We register an event listener in Hyzobox, waiting for landing view of the game to be loaded:

var hb = Hyzobox.createInstance();
var landingview_loaded = function(hbEvent) {
   // do something with hbEvent
}
hb.addEventListener('landingview_loaded', landingview_loaded);

It’s is clear that we don’t have control over when landingview_loaded event will be fired and its handler will be called.

hbEvent argument that is of type Hyzobox.Event has a data attribute that is of type Object. In this example the data is a LandingView instance. We can interact with this object in the event handler:

var landingview_loaded = function(hbEvent) {
   var view = hbEvent.data;
   view.inject('a-container-id', 'some text');
};

In this example we are injecting ‘some text’ to an element identified by ‘a-container-id’ inside landing view.

addEventListener() is part of Out and inject() is part of In API. If we want to listen to the events that are occurring inside a particular view, we should register their halnders after the view has been loaded:

var landingview_loaded = function(hbEvent) {
   var view = hbEvent.data;
   view.attachEventListener('playNow', function playNowHandler(playNowHbEvent) {
       // do something with playNowHbEvent
   });
};

And so on, we can have many nested Ins and Outs.

It’s easy to see that in these examples the control has been transferred to the event handlers. The caller raise the events but it’s the responsibility of the handlers to control the functionalities.

I don’t want to go into the the details now, because the work hasn’t yet been finished on these APIs. Once released, we will post them in Hyzobox documentations and Hyzonia tech blog in the following weeks.

Tagged with: , , ,