0000000010…

How to achieve persistence of a 2D coordinate system representing connexions? This post explains it in a bottom-up approach.

Let the binary string 0000000010… be an object description, a description of a coordinate system with two dimensions. Obviously there is some information ‚in‘ the binary string. At position 9 we perceive a difference between this position and the positions before (and after): the binary digit 1 instead of all the other 0’s.

If we hand over this (marked by the binary digit 1 at position #9) to an inverse pairing function called split, we get two coordinates: split 9 = (0, 3).

Before proceeding, please find the Haskell code for the pairing function and its inverse:

{{{

  -- fusion

f :: (Fractional a) => a -> a -> a

f x y = (1/2) * (x + y) * (x + y + 1) + y

  -- split

s :: (RealFrac a, Floating a) => a -> (a, a)

s z = (x, y) where

    j = getJ z

    y = z - (auxF j)

    x = j - y

 -- auxiliary functions

auxF :: (Fractional a) => a -> a

auxF j = (1/2) * j * ( j + 1 )

getJ :: (Num a1, RealFrac a, Floating a) => a -> a1

getJ z = w where

    q = (-1/2) + sqrt(1/4 + 2 * z)

    w = fromInteger (truncate q )


  -- End of Haskell script

}}}

Let’s visualize the configuration which we’ve got so far at position #9:

configurationpileobjectx0y3.png

y = 3 ‚is‘ the z of another such configuration and x = 0 looks like a dead end, cause split 0 = (0, 0) yields no difference anymore.

configurationpileobjectx0y3z.png

Moving from the configuration at position #9 to another such configuration (along the orange arrow), the z of the second configuration is now 3 as well: z = 3. The value 3 ‚is‘ the same as the connexion (x, y) — beneath the dotted line — i.e. the relation between x and y (at another position than #9).

Any such configuration consists of 4 elements: [x, y, f x y, z] with the pairing function f x y, called fusion, to give us the position which we mark by means of the binary digit 1 in the persistent binary string above.

Once more the configuration [x, y, z] represents a value f x y which is all of the values x, y, and z at once.

(Cf. Monads as containers for the list monad and such nondeterministic computations)

Okay?! But… where does the z come from? To be continued.

Advertisements

Ein Gedanke zu „0000000010…“

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s