User:Vanisaac/bin-imaginary base

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,  ,  , 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  and. 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  for odd coefficients of imaginary numbers.

Comparison with Quater-imaginary numbers
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 . = 1 in decimal).

Digit positions
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.

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

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,  ,   or   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  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, &pm; , &pm; , &pm; , and &pm;  values. Finally, convert the NN representation to SN.

Example conversion
Convert the number 42+11i to imaginary binary:

42+11i -> NN:  -> SN:

Negative Notation
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:

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:

Addition and Multiplication
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

Simple Multiplication Table in Imaginary Binary Base

Addition Table of SN + NN

Binary Encoding of Imaginary Binary Base Numbers
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:

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

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

Maxima and extrema
The number with the maximum absolute value expressible with an x-digit imaginary binary number are represented by numbers in the following format:  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  and. The other corner of this square area on the complex number plane is represented by the maximum  with x-1 digits.

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

Quadrant I with

Quadrant II with

Quadrant III with

Quadrant IV with.