### Archive

Archive for January, 2010

## Timesharing at 1964

I recently found a youtube video (thanks stateless!) with professor Fernando Corbato. It is about timesharing, something revolutionary at 1964. MIT professor Corbato is the founder of Multics which later lead to the creation of UNIX. He has also received the Turing award for his work on resource sharing. The video lasts 27 minutes but it’s worth seeing, trust me! And you also get to see a REAL geek!

Categories: Operating Systems Tags:

## Using non-standard bases

January 4th, 2010 1 comment

There are a number of different bases, or radices. Most of us use the decimal positional numeral system, i.e. base 10 for our everyday jobs. When it comes to computers most people use the binary, the hexadecimal or even the octal numeral system. However, there are a number of different “unusual” bases.

For example, there are negative bases. An example is the negadecimal positional numeral system, that is using the base -10. Converting a number from base -10 to base 10 is as simple as:

$d_1d_2d_3d_4\ _{(-10)} = d_1(-10)^3 + d_2(-10)^2 +d_3(-10)^1 + d_4(-10)^0$

But why use such a base? It’s very simple, you can represent any number you want, positive or negative, without using a sign. For example:

$-1_{(10)} = 1(-10)^1 + 9(-10)^0 = 19_{(-10)}$

The conversion from decimal to negadecimal is pretty simple. You continuously divide by -10 and keep the remainder as you would do with any other positional numeral system. For example:

$-256 = 26 * (-10) + 4$

$26 = -2 * (-10) + 6$

$-2 = 1 * (-10) + 8$

$1 = 0 * (-10) + 1$

So $-256_{10} = 1864_{-10}$. Converting a positive number is done the same way too.

$256 = -25 * (-10) + 6$

$-25 = 3 * (-10) + 5$

$3 = 0 * (-10) + 3$

So $256_{(10)} = 356_{(-10)}$. As you can see, there is no need for a sign symbol. And when using the negabinary numeral system there is no problem with signed and unsigned integers since there is no need for a sign bit!

But a negative base isn’t the only non-standard base. You can use complex numbers as bases too. This way there is no need to use a real and an imaginary part to represent a complex number. An example of such a base is $-1 + i$ where of course $i^2 = -1$. A number can then have the form

$d_1d_2d_3d_4 = d_1(-1 + i)^3 + d_2(-1 + i)^2 + d_3(-1 + i)^1 + d_4(-1 + i)^0, d_i \in {0,1}$

Using this base you can represent any complex you want without using the $i$ symbol.

Converting from this base to decimal is pretty simple, however the reverse is a little bit difficult. What you do for the convertion is divide continuously with $-1 + i$ as usual. The remainder will always be $0$ or $1$. So, if the quotient is $q = q_1 + q_2i$ then:

$a + bi = (q_1 + q_2i)(-1 + i) + r$

$a + bi = -q_1 + q_1i - q_2i - q_2 + r$

$a + bi = (-q_1 - q_2 + r) + (q_1 - q_2)i$

$-q_1 - q_2 + r = a$

$q_1 - q_2 = b$

$q_1 = \frac{b - a + r}{2}$

$q_2 = \frac{-b - a + r}{2}$

That means that if $a$ and $b$ are both odd or even, then $r = 0$, otherwise $r = 1$. Then we continue the division of the quotient as usual.

Now let’s calculate the value of 2.

2 has both the real and imaginary part even, so $r = 0$.

$\frac{2}{-1 + i} = \frac{2(-1 - i)}{(-1 + i)(-1 - i)} = -1 - i$

The real and imaginary part are both odd, so $r = 0$ again.

$\frac{-1 - i}{-1 + i} = \frac{(-1 - i)(-1 - i)}{(-1 + i)(-1 - i)} = i$

Since the real part is even and the imaginary is odd, $r = 1$. So, we can divide by the number minus 1 and the remainder will be 0.

$\frac{i - 1}{-1 + i} = 1$

Now, the real part is odd and the imaginary is even. So again $r = 1$. We divide by $1 - 1$ so,

$\frac{1 - 1}{-1 + i} = 0$

We now stop since $q = 0$. So we have $2_{(10)} = 1100_{(-1 + i)}$. Pretty cool!

Categories: Mathematics Tags: