User:Vanisaac/bin-imaginary base

From Wikipedia, the free encyclopedia

The imaginary binary numeral system is a non-standard positional numeral system which uses the imaginary number 2i as its base. It is able to uniquely represent every complex number using only the digits 0, 1, i, and ɨ for the complex unit 1+i. Imaginary Binary base does not use a negative sign, although basic mathematical operations and conversions from other bases may be easier to calculate using negative digits (referred to as "Negative Notation") and the other unit intersections of the complex plane at 1-i and i-1. Because Imaginary Binary numbers can take imaginary and complex values in the units place, it represents all complex numbers with whole-number coefficients without crossing the radix point. This is in contrast to the Donald Knuth invented 2i-base number system quater-imaginary numbers, which requires .2 for odd coefficients of imaginary numbers.

Comparison with Quater-imaginary numbers[edit]

The quater-imaginary number system was proposed by Donald Knuth in 1960 also with a 2i base, but using the digits 0, 1, 2 & 3. This system violates the common property of bases, where the necessary digits are smaller than the absolute value of the base. This property results in the radix point not clearly separating fractional from whole values in a number. Imaginary Binary avoids this problem by fully incorporating the complex identity into the set of valid digits, preventing all but infinitely repeating post-radix numbers from equalling a unit value (such as .9 = 1 in decimal).

Digit positions[edit]

With a base of 2i, imaginary binary number positions increase in a counter-clockwise spiral on the complex plane. The first position, as with all bases, has a value of 1, followed by 2i, then -4 and further multiples of 2i.

Position Value Position Value
12 4096 Radix point
11 -2048i -1 -1/2i
10 -1024 -2 -1/4
9 512i -3 1/8i
8 256 -4 1/16
7 -128i -5 -1/32i
6 -64 -6 -1/64
5 32i -7 1/128i
4 16 -8 1/256
3 -8i -9 -1/512i
2 -4 -10 -1/1024
1 2i -11 1/2048i
0 1 -12 1/4096

Since all position values are found along the complex axes, whole numbers and purely imaginary numbers will not be represented with the digit ɨ. Complex numbers off the real or imaginary axis may be represented with ɨ or not, depending on the nature of the complex number - complex numbers with both an odd whole and imaginary part (such as 5+3i) will always have an ɨ in the ones digit in imaginary binary, for example.

Conversion of numbers[edit]

Using the complex plane to map the complex number 5+3i in imaginary binary.

When converting numbers, it is easiest to use Negative Notation (NN) and then convert to Standard Notation (SN) from there. The use of h for 1-i (an easy shape-based substitute) and -h for i-1 enables simple conversion of complex numbers. Converting a purely real or imaginary number will only require using 0, 1, -1, i and -i.

To convert a complex number, first split into real and imaginary parts. Find the largest base position with an absolute value smaller than the absolute value of the real part. Insert 1, -1, i or -i as necessary to match the sign and imaginary component of your number when multiplying by the place value. Subtract that value from your number and repeat finding the largest base position less than your number, entering 0 for any digit positions skipped. Fill in zeroes to the first digit once you have cancelled all of the original number. Do the same procedure for the imaginary part of your number, again matching sign and imaginary component. With a complex number, add the values of the real and imaginary parts, using 0, ±1, ±i, ±ɨ, and ±h values. Finally, convert the NN representation to SN.

Example conversion[edit]

Convert the number 42+11i to imaginary binary:

Place Value 32i 16 -8i -4 2i 1
Integer Digits -i 0 i 0 -i 0
Remainder 42 10 10 2 2 0 0
Imaginary Digits 0 0 -1 0 1 i
Remainder 11i 11i 11i 3i 3i i 0
Sum Digits -i 0 -h 0 h i

42+11i -> NN: -i 0 -h 0 h i -> SN: i 1 i ɨ 1 1 ɨ i

Negative Notation[edit]

Negative notation allows you to easily convert numbers by focusing only on the absolute value of the target number. It also makes long multiplication easier by inserting negative digits, which will often cancel when adding up the partial products. NN can be converted to SN using the following values:

Negative Notation -> Standard Notation conversions
NN representation -1 -i h -h
SN representation i1 i1i iɨɨ i1ɨ

When converting an NN number, it is oftentimes useful to only convert the lowest value non-Standard number first. As the SN replacements add on to successive digits, they can cancel out successive NN digits, making conversion to SN much faster.

Example:

NN: 1 -i -i -ɨ
1 -i -i  0
+    i  ɨ  ɨ
SN: 1  0  1  ɨ

Addition and Multiplication[edit]

Unlike most positional notation systems, in imaginary binary the process of addition is significantly more complex than multiplication, involving carrying as many as three digits to higher place values when adding two single digits together. On the other hand, multiplication only involves carrying a single digit to the next-higher place value.

Simple Addition Table in Imaginary Binary Base

+ 0 1 i ɨ
0 0 1 i ɨ
1 1 i1i0 ɨ i1ii
i i ɨ 10 11
ɨ ɨ i1ii 11 i1ɨ0

Simple Multiplication Table in Imaginary Binary Base

× 0 1 i ɨ
0 0 0 0 0
1 0 1 i ɨ
i 0 i i1
ɨ 0 ɨ 10

Addition Table of SN + NN

+ -1 -i h -h
0 -1 -i h -h
1 0 h -i iɨɨi i
i -h 0 i1 1 ɨ1
ɨ i 1 0 i1i0 10

Binary Encoding of Imaginary Binary Base Numbers[edit]

Since imaginary binary numbers use 4 different digit values, it is perfectly suited for representation on computers using a simple binary encoding, with every imaginary binary digit encoded in two bits. By using the less-significant bit of the binary encoding for the real unit, and the most-significant bit for the imaginary unit, we get the following encoding: 0 = 00, 1 = 01, i = 10, ɨ = 11

Because the high bit of the binary encoding holds the imaginary value, that bit can be calculated as a ½ bit of the next imaginary binary digit, allowing for highly efficient computer conversion between imaginary binary and standard complex number notation:

Binary encoding of 1101iɨ
Imaginary Binary number 1 1 0 1 i ɨ
Binary encoding 1 0 1 0 0 0 1 1 0 1 1
Imaginary place values 32i×½ = 16i -8i×½ = -4i 2i×½ = i
Real place values 16×½ = 8 -4×½ = -2 1
Bit value 10 = 2 10 = 2 00 = 0 11 = 3 01 = 1 1 = 1
Value 2×16i 2×8 0×-4i 3×-2 1×i 1×1
Giving an end value of 1101iɨ = 11+33i, and an encoding of 101'0001'1011bin or 51Bhex
Values of Hexadecimal encoded bin-imaginary numbers
Hex number 0 1 2 3 4 5 6 7 8 9 A B C D E F
Real value 0 1 0 1 0 1 0 1 -2 -1 -1 -2 -2 -1 -1 -2
Imaginary value 0 0 i i 2i 2i 3i 3i 0 0 i i 2i 2i 3i 3i
complex value 0 1 i 1+i 2i 1+2i 3i 1+3i -2 -1 -1+i -2+i -2+2i -1+2i -1+3i -2+3i
Hex number 00 10 20 30 40 50 60 70 80 90 A0 B0 C0 D0 E0 F0
Real value 0 -4 0 -4 0 -4 0 -4 8 4 4 8 8 4 4 8
Imaginary value 0 0 -4i -4i -8i -8i -12i -12i 0 0 -4i -4i -8i -8i -12i -12i
complex value 0 -4 -4i -4-4i -8i -4-8i -12i -4-12i 8 4 4-4i 8-4i 8-8i 4-8i 4-12i 8-12i

Further digits beyond the first two in hex representations of binary-imaginary numbers have values that are 16nx value of the 1 and 2 digit representations shown for each pair of additional digits. So 300hex = 16+16i and B000hex = 128-64i, while 10000hex = 256.

Maxima and extrema[edit]

The number with the maximum absolute value expressible with an x-digit imaginary binary number are represented by numbers in the following format: ɨi01ɨi01 to x digits. Other maxima (found 2x-1 units orthogonal to the maximum in both directions past the imaginary and real axes) are represented by i01ɨi01ɨ and 1ɨi01ɨi0. The other corner of this square area on the complex number plane is represented by the maximum 1ɨi01ɨi0 with x-1 digits.

Table of maximum values
Digits Max value Quadrant Other extrema
1 1+i I 1, i, 0
2 -2+3i II -2+i, 1+3i
3 -6-4i III -2-4i, -6+3i
4 9-12i IV -6-12i, 9-4i
5 25+19i I 9+19i, 25-12i
6 -38+51i II 25+51i, -38-12i
7 -102-76i III -102+51i, 25-76i
8 153-204i IV -102-204i, 153+51i
9 409+307i I -102+307i, 409-204i
10 -614+819i II 409+819i, -614-204i

The maximum value of x number of digits can be given by a general formula for each quadrant:

Quadrant I with 2x-1 + real max(x-1) + 2xi + imaginary max(x-1) - i

Quadrant II with real max(x-1) - 2x + 1 + 2x-1i + imaginary max(x-1)

Quadrant III with real max(x-1) - 2x-1 + imaginary max(x-1) - 2xi + i

Quadrant IV with 2x + real max(x-1) - 1 + imaginary max(x-1)) - 2x-1i.