# Complex-base system explained

In arithmetic, a complex-base system is a positional numeral system whose radix is an imaginary (proposed by Donald Knuth in 1955[1] [2]) or complex number (proposed by S. Khmelnik in 1964[3] and Walter F. Penney in 1965[4] [5] [6]).

## In general

Let

D

be an integral domain

\subset\C

, and

||

the (Archimedean) absolute value on it.

A number

X\inD

in a positional number system is represented as an expansion

X=\pm

 \sum \nu

x\nu\rho\nu,

where
 \rho\inD is the radix (or base) with \rho > 1, \nu\in\Z is the exponent (position or place), x\nu are digits from the finite set of digits Z\subsetD , usually with x_\nu < \rho .
The cardinality

R:=|Z|

is called the level of decomposition.

A positional number system or coding system is a pair

\left\langle\rho,Z\right\rangle

\rho

and set of digits

Z

, and we write the standard set of digits with

R

digits as

ZR:=\{0,1,2,...c,{R-1}\}.

Desirable are coding systems with the features:

• Every number in

D

, e. g. the integers

\Z

, the Gaussian integers

\Z[i]

or the integers

\Z[\tfrac{-1+i\sqrt7}2]

, is uniquely representable as a finite code, possibly with a sign ±.

K:=\operatorname{Quot}(D)

, which possibly is completed for the metric given by

||

yielding

K:=\R

or

K:=\C

, is representable as an infinite series

X

which converges under

||

for

\nu\to-infty

, and the measure of the set of numbers with more than one representation is 0. The latter requires that the set

Z

be minimal, i.e.

R=|\rho|

for real numbers and

R=|\rho|2

for complex numbers.

## In the real numbers

In this notation our standard decimal coding scheme is denoted by

\left\langle10,Z10\right\rangle,

the standard binary system is

\left\langle2,Z2\right\rangle,

the negabinary system is

\left\langle-2,Z2\right\rangle,

and the balanced ternary system[2] is

\left\langle3,\{-1,0,1\}\right\rangle.

All these coding systems have the mentioned features for

\Z

and

\R

, and the last two do not require a sign.

## In the complex numbers

Well-known positional number systems for the complex numbers include the following (

i

being the imaginary unit):

\left\langle\sqrt{R},ZR\right\rangle

, e.g.

\left\langle\pmi\sqrt{2},Z2\right\rangle

[1] and

\left\langle\pm2i,Z4\right\rangle

,[2] the quater-imaginary base, proposed by Donald Knuth in 1955.

\left\langle\sqrt{2}e\pm2i}=\pmi\sqrt{2},Z2\right\rangle

and

\left\langle\sqrt{2}e\pm4i}=-1\pmi,Z2\right\rangle

[3] [5] (see also the section Base −1 ± i below).

\left\langle\sqrt{R}ei\varphi,ZR\right\rangle

, where

\varphi=\pm\arccos{(-\beta/(2\sqrt{R}))}

,

\beta<min(R,2\sqrt{R})

and
 \beta
is a positive integer that can take multiple values at a given

R

.[7] For

\beta=1

and

R=2

this is the system

\left\langle\tfrac{-1+i\sqrt7}2,Z2\right\rangle.

\left\langle2e\tfrac{\pi3

 \tfrac{2\pi i},A 4:=\left\{0,1,e

3i},e-\tfrac{23i}\right\}\right\rangle

.[8]
 2\right\rangle \left\langle-R,A R
, where the set
 2 A R
consists of complex numbers

r\nu=\alpha

 2i \nu
, and numbers
 \alpha \nu

\inZR

, e.g.

\left\langle-2,\{0,1,i,1+i\}\right\rangle.

[8]

\left\langle\rho=\rho2,Z2\right\rangle

, where

\rho2=\begin{cases} (-2)\tfrac{\nu2}&if\nueven,\\ (-2)\tfrac{\nu-12}i&if\nuodd. \end{cases}

[9]

## Binary systems

Binary coding systems of complex numbers, i.e. systems with the digits

Z2=\{0,1\}

, are of practical interest.[9] Listed below are some coding systems

\langle\rho,Z2\rangle

(all are special cases of the systems above) and resp. codes for the (decimal) numbers .The standard binary (which requires a sign, first line) and the "negabinary" systems (second line) are also listed for comparison. They do not have a genuine expansion for .
Some bases and some representations[10]
Radix–1 ←2 ←–2 ←Twins and triplets
2 –1 10 –10 1 ← 0.1 = 1.0
–2 11 110 10 0.01 = 1.10

i\sqrt{2}

101 10100 100 10.101010100...[11]
 1 + 3
 1 3

i\sqrt{2}

0.0011 = 11.1100
 -1+i\sqrt{7
}
111 1010 110 11.110001100...
 3+i\sqrt{7
} ←
1.011 = 11.101 = 11100.110

\rho2

101 10100 100 10 &thinsp;+&thinsp; ← 0.0011 = 11.1100
–1+ 11101 1100 11100 11 &thinsp;+&thinsp; ← 0.010 = 11.001 = 1110.100
2 103 2 102 10.2 &thinsp;+&thinsp; ← 0.0033 = 1.3003 = 10.0330 = 11.3300

As in all positional number systems with an Archimedean absolute value, there are some numbers with multiple representations. Examples of such numbers are shown in the right column of the table. All of them are repeating fractions with the repetend marked by a horizontal line above it.

If the set of digits is minimal, the set of such numbers has a measure of 0. This is the case with all the mentioned coding systems.

The almost binary quater-imaginary system is listed in the bottom line for comparison purposes. There, real and imaginary part interleave each other.

## Base

Of particular interest are the quater-imaginary base (base) and the base systems discussed below, both of which can be used to finitely represent the Gaussian integers without sign.

Base, using digits and, was proposed by S. Khmelnik in 1964[3] and Walter F. Penney in 1965.[4] [6]

### Connection to the twindragon

The rounding region of an integer – i.e., a set

S

of complex (non-integer) numbers that share the integer part of their representation in this system – has in the complex plane a fractal shape: the twindragon (see figure). This set

S

is, by definition, all points that can be written as

style\sumk\geqxk(i-1)-k

with

xk\inZ2

.

S

can be decomposed into 16 pieces congruent to

\tfrac14S

. Notice that if

S

is rotated counterclockwise by 135°, we obtain two adjacent sets congruent to

\tfrac{1}{\sqrt{2}}S

, because

(i-1)S=S\cup(S+1)

. The rectangle

R\subsetS

in the center intersects the coordinate axes counterclockwise at the following points:

\tfrac2{15}\gets0.\overline{00001100}

,

\tfrac1{15}i\gets0.\overline{00000011}

, and

-\tfrac8{15}\gets0.\overline{11000000}

, and

-\tfrac4{15}i\gets0.\overline{00110000}

. Thus,

S

contains all complex numbers with absolute value ≤&thinsp;.[12]

As a consequence, there is an injection of the complex rectangle

[-\tfrac8{15},\tfrac2{15}] x [-\tfrac4{15},\tfrac1{15}]i

into the interval

[0,1)

of real numbers by mapping

style\sumk\geqxk(i-1)-k\mapsto\sumk\geqxkb-k

with

b>2

.[13]

Furthermore, there are the two mappings

 \N \begin{array}{lll} Z 2

&\to&S\\ \left(xk\right)k\in\N&\mapsto&\sumk\geqxk(i-1)-k\end{array}

and
 \N \begin{array}{lll} Z 2

&\to&[0,1)\\ \left(xk\right)k\in\N&\mapsto&\sumk\geqxk2-k\end{array}

both surjective, which give rise to a surjective (thus space-filling) mapping

[0,1)    \to    S

which, however, is not continuous and thus not a space-filling curve. But a very close relative, the Davis-Knuth dragon, is continuous and a space-filling curve.

## Notes and References

1. Knuth . D.E. . An Imaginary Number System . Communications of the ACM . 1960 . 3 . 4 . 245–247 . 10.1145/367177.367233.
2. Book: Knuth, Donald . Donald Knuth

. Donald Knuth . The art of computer programming . Addison-Wesley . Boston . 1998 . 2 . 3rd . 205 . 0-201-89684-2 . Positional Number Systems . 48246681.

3. Khmelnik . S.I. . Specialized digital computer for operations with complex numbers. Questions of Radio Electronics (in Russian). XII . 2 . 1964.
4. W. Penney, A "binary" system for complex numbers, JACM 12 (1965) 247-248.
5. Jamil . T. . 2002 . The complex binary number system . IEEE Potentials . 20 . 39–41 . 10.1109/45.983342 . 5.
6. Duda . Jarek . 2008-02-24 . Complex base numeral systems . 0712.1309 . math.DS .
7. Khmelnik . S.I. . Positional coding of complex numbers. Questions of Radio Electronics (in Russian). XII . 9 . 1966.
8. Book: Khmelnik, S.I. . Coding of Complex Numbers and Vectors (in Russian). Mathematics in Computer . Israel . 978-0-557-74692-7 . 2004 .
9. Book: Khmelnik, S.I. . Method and system for processing complex numbers . Patent USA, US2003154226 (A1) . 2001 .
10. http://www.math.uwaterloo.ca/~wgilbert/Research/ArithCxBases.pdf William J. Gilbert, "Arithmetic in Complex Bases" Mathematics Magazine Vol. 57, No. 2, March 1984
11. infinite non-repeating sequence
12. Knuth 1998 p.206
13. Base

b=2

cannot be taken because both,

style2-1=0.1bin=0.5dec

and

style\sumk\geq2-k=0.0\overline{1}bin=0.1bin=0.5dec

. However,

style(i-1)-1=-0.1bin-0.1bini=-0.5dec-0.5deci

is unequal to

style\sumk\geq(i-1)-k=0.1dec+0.3deci

.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://everything.explained.today/Complex-base_system/", "fetch_time": 1679566868000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2023-14/segments/1679296945144.17/warc/CC-MAIN-20230323100829-20230323130829-00352.warc.gz", "warc_record_offset": 302247735, "warc_record_length": 8914, "token_count": 2866, "char_count": 8422, "score": 3.75, "int_score": 4, "crawl": "CC-MAIN-2023-14", "snapshot_type": "latest", "language": "en", "language_score": 0.8684110045433044, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00005-of-00064.parquet"}