# Simplest self-contained numeral system for complex numbers?

• I

## Summary:

Like balanced ternary for complex numbers.
Anyone know what the simplest possible self-contained numeral system for complex numbers would be, analogous to signed ternary for integers? My guess would be quarter-imaginary base (https://en.wikipedia.org/wiki/Quater-imaginary_base.)

mfb
Mentor
Define "simple". You can use a+ib where a and b follow your favorite simple representation of real numbers. I would consider that simpler than the quarter-imaginary base. You can convert between these two relatively easily, as the quarter-imaginary base has purely imaginary and purely real digits that you can separate.

• pbuk and sysprog
Here's how it's commonly done in PL/1 (from https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ceea300/ceea30016.htm):

 COMPLEX8 Short floating-point complex hex number: an 8-byte complex number, whose real and imaginary parts are each 4-byte single-precision floating-point numbers COMPLEX FLOAT DECIMAL (6) COMPLEX16 Long floating-point complex hex number: a 16-byte complex number, whose real and imaginary parts are each 8-byte double-precision floating-point numbers COMPLEX FLOAT DECIMAL (16) COMPLEX32 Extended floating-point hex number: a 32-byte complex number, whose real and imaginary parts are each 16-byte extended-precision floating-point numbers COMPLEX FLOAT DECIMAL (33)

• Delta2
pbuk
Gold Member
Anyone know what the simplest possible self-contained numeral system for complex numbers would be, analogous to signed ternary for integers? My guess would be quarter-imaginary base (https://en.wikipedia.org/wiki/Quater-imaginary_base.)
I assume by signed ternary you are referring to what is more commonly called balanced ternary?
Define "simple".
Indeed. I think it is hard to come up with a definition in which balanced ternary is judged simpler than, say, 2's complement binary.

Quater-imaginary is an interesting curiosity, but again it is difficult to see it as 'simple', and it lacks the desirable feature of compactness that other representation systems (including balanced ternary) have. By compactness for Gaussian integers I mean that the set of all values which can be expressed by a string of ## n ## symbols of a system with ## m ## symbols should lie in a square with sides ## m^{n/2} ## on the Gaussian plane.

In my view, the simplest such system can be achieved by interleaved two's complement binary digits: ## ...b_2a_2b_1a_1b_0a_0 ## where ## z = a +ib ##. In this system we have (using the notation 0bxx to represent 2's complement binary):
Code:
0000 => 0 + 0i = 0
0001 => 1 + 0i = 1
0010 => 0 + 1i = i
0011 => 1 + 1i = 1 + i
0100 => 0b10 + 0i = -2
0101 => 0b11 + 0i = -1
0111 => 0b11 + 1i = -1 + i
...
and so all numbers represented by the 16 possible strings lie in the rectangle with corners at (-2, -2) and (1, 1).
You can convert between these two relatively easily.
## 7_{10} = ?_{2i} ##? (show your workings) Last edited:
• sysprog
mfb
Mentor
## 7_{10} = ?_{2i} ##? (show your workings) The imaginary part is 0 and there is no fractional part, so we already know the result will be ?0?0?. From here on everything is working with real numbers only.
We just need to express 7 in base -4, which is awkward but possible: 16 = 100-4, 8 = 120-4, 7 = 133-4, which means our final result is 103032i. Most of the work went into base 10 -> base -4 conversion, not into anything that would be related to imaginary numbers.
If you know real and imaginary part separately you can keep them separate, and only merge them for the final result. That's similar to the interleaved binary system you showed. A bit more complicated because the imaginary part has an offset (2i and 1/2i digits, no 1i digit).

• sysprog and pbuk
pbuk
Gold Member
I think we have different concepts of 'relatively easy' @mfb • sysprog
mfb
Mentor
It's much easier than base ##1+i## or even more obscure angles like ##1+2i##.

• sysprog
jbriggs444
Homework Helper
2019 Award
Define "simple". You can use a+ib where a and b follow your favorite simple representation of real numbers. I would consider that simpler than the quarter-imaginary base. You can convert between these two relatively easily, as the quarter-imaginary base has purely imaginary and purely real digits that you can separate.
If the symmetry of balanced ternary is attractive then one could extend it to the complex numbers by using base 3 with nine complex digits: (-1-i), (-1), (-1+i), (-i), (0), (+i), (1-i), (1), (1+i). This is a bit unsatisfactory since it is obviously just a cheesy way of taking the balanced ternary expansions a and b of (a+bi) and interleaving their digits.

If the economy of digits of base -2 is attractive then one could use base ##i \sqrt 2## with two digits: 0 and 1.

• pbuk
pbuk
Great idea - and to make it really simple you could implement the arithmetic routines in a symbolically economical language like brainf**k • 