Quater-imaginary base
From Wikipedia, the free encyclopedia
Numeral systems by culture | |
---|---|
Hindu-Arabic numerals | |
Indian Eastern Arabic Khmer |
Indian family Brahmi Thai |
East Asian numerals | |
Chinese Counting rods |
Japanese Korean |
Alphabetic numerals | |
Abjad Armenian Cyrillic Ge'ez |
Hebrew Greek (Ionian) Āryabhaṭa |
Other systems | |
Attic Babylonian Egyptian Etruscan |
Mayan Roman Urnfield |
List of numeral system topics | |
Positional systems by base | |
Decimal (10) | |
2, 4, 8, 16, 32, 64 | |
1, 3, 9, 12, 20, 24, 30, 36, 60, more… | |
The quater-imaginary numeral system was first proposed by Donald Knuth in 1955, in a submission to a high-school science talent search. It is a non-standard positional numeral system which uses the imaginary number 2i as base. By analogy with the quaternary numeral system, it is able to represent every complex number using only the digits 0, 1, 2, and 3, without a sign.
Contents |
[edit] From quater-imaginary to decimal
To convert a digit string from the quater imaginary system to the decimal system, the standard formula for non-standard positional systems can be used. This says that a digit string d3d2d1d0 in the quater imaginary system can be converted to a decimal number using the formula:
- .
In this formula b = 2i for the quater-imaginary system.
[edit] Example
To convert the string 11012i to a decimal number, fill in the formula above:
The formula to calculate the decimal number from the quater-imaginary number can be extended when larger strings are used. So to find the decimal counterpart of 10300032i use the formula extended to 7 digits.
So for 10300032i and with b = 2i this gives:
[edit] Powers of 2i
When trying to find representations of the numbers from the quater-imaginary system to the decimal system, or vice-versa, the following table is useful:
n | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(2i)n | 1/256 | 1/128i | −1/64 | −1/32i | 1/16 | 1/8i | −1/4 | −1/2i | 1 | 2i | −4 | −8i | 16 | 32i | −64 | −128i | 256 |
[edit] From decimal to quater-imaginary
It is also possible to convert a decimal number to a number in the quater-imaginary system. There are three different forms of decimal numbers that can be represented: real numbers, purely imaginary numbers and numbers of the form a+bi.
[edit] Example: Real number
As an example of a real number we can try to find the quater-imaginary counterpart of the decimal number 7 (or 710 since the base of the decimal system is 10). Since it is hard to predict exactly how long the digit string will be for a given decimal number, it is safe to assume a fairly large string. In this case, a string of six digits can be chosen. When an initial guess at the size of the string eventually turns out to be insufficient, a larger string can be used. To find the representation, first write out the general formula, and group terms:
Since 7 is a real number, it is allowed to conclude that d1, d3 and d5 should be zero. Now the value of the coefficients d0, d2 and d4, must be found. Because d0 - 4 d2 + 16 d4 = 7 and because - by the nature of the quater-imaginary system - the coefficients can only be 0, 1, 2 or 3 the value of the coefficients can be found. A possible configuration could be: d0 = 3, d2 = 3 and d4 = 1. This configuration gives the resulting digit string for 710.
[edit] Example: Imaginary number
Finding a quater-imaginary representation of a purely complex number is analogous to the method described above for a real number. For example, to find the representation of 6i, it is possible to use the general formula. Then all coefficients of the real part have to be zero and the complex part should make 6. However, for 6i it is easily seen by looking at the formula that if d1 = 3 and all other coefficients are zero, we get the desired string for 6i. That is:
[edit] Example: Complex number
To find a digit string representing a complex number of the form a+bi again it is possible to use the general formula, group terms and choose coefficients. To find the quater-imaginary counterpart of 7 + 6i use:
Then, as before, if d4 = 1, d2 = 3 and d0 = 3 we get the real part, and if d5 = 0, d3 = 0 and d1 = 3 the imaginary part can be found. Hence the resulting digit string for the complex number is:
[edit] Radix point "."
A radix point in the decimal system is the usual . (dot) which marks the separation between the integral part and the fractional part of the number. In the quater-imaginary system a radix point can also be used. For a digit string ...d5d4d3d2d1d0.d − 1d − 2d − 3... the radix point marks the separation between positive and negative powers of b. Using the radix point the general formula becomes:
or
[edit] Example
If the quater-imaginary representation of the complex unit i has to be found, the formula without radix point will not suffice. Therefore the above formula should be used. Hence:
For certain coefficients dk. Then because the real part has to be zero: d4 = d2 = d0 = d-2 = 0. For the imaginary part, if d5 = d3 = d -3 = 0 and when d1=1 and d-1=2 the digit string can be found. Using the above coefficients in the digit string the result is:
- .
[edit] Addition and subtraction
It is possible to add and subtract numbers in the quater-imaginary system, in doing this, there are 2 basic rules that have to be kept in mind:
- Whenever a number exceeds 3, subtract 4 and "carry" -1 two places to the left.
- Whenever a number is negative, add 4 and "carry" +1 two places to the left.
Or for short: "If you add four, carry +1. If you subtract four, carry -1". When adding or subtracting keep in mind that one has to start at the most right digit in the string. Below are two examples of these rules.
[edit] Example: Addition
Below are two examples of adding in the quater-imaginary system:
1 - 2i 1031 3 - 4i 1023 1 - 2i 1031 1 - 8i 1001 ------- + <=> ----- + ------- + <=> ----- + 2 - 4i 1022 4 - 12i 12320
In the left example we first add the two ones on the right, this gives 2. Then add the two threes, this would be 6, however since 6 is not allowed, subtract 4 and carry -1 two places to the left. This gives a two on the second place from right and a one at the leftmost digit.
Similarly in the second example (on the right), we have to add a 3 and a 1 at the most right digit, this would be a four, which is not allowed. Hence, subtract four and carry a "-1" two places to the left. Since the third digit from right is zero, this would give -1. So add 4 and carry "+1" two places to the left. These operations give the resulting digit string, as shown above.
[edit] Example: Subtraction
Subtraction is analogous to addition in that it uses the same two rules described above. Below is an example:
- 2 - 8i 1102 1 - 6i 1011 ------- - <=> ----- - - 3 - 2i 1131
In this example we have to subtract the strings 11022i and 10112i. The most right digit is 2-1=1, the second digit from the right would become -1, so add 4 to get 3 and then carry +1 two places to the left. The third digit from the right is 1-0=1. Then the most left digit is 1-1+1=1 because we had to carry a +1. This gives 11312i as above.
[edit] Multiplication
For multiplication in the quater-imaginary system, the two rules stated above are used as well. When multiplying numbers, multiply the first string by each digit in the second string consecutively and add the resulting strings (this is multiplication by partial products). With every multiplication, a digit in the second string is multiplied with the first string. The multiplication starts with the most right digit in the second string and then moves leftward by one digit, multiplying each digit with the first string. Then the resulting partial products are added where each is shifted to the left by one digit. An example:
11201 20121 x -------- 11201 <--- 1 x 11201 12002 <--- 2 x 11201 11201 <--- 1 x 11201 00000 <--- 0 x 11201 12002 + <--- 2 x 11201 ------------ 120231321
This corresponds to a multiplication of (9 - 8i )(29 + 4i ) = 293 - 196i.
[edit] Tabulated conversions
Below is a table of some decimal and complex numbers and their quater imaginary counterparts.
|
|
|
|
[edit] Examples
Below are some other examples of conversions from decimal numbers to quater-imaginary numbers.
[edit] See also
[edit] References
- D. Knuth. The Art of Computer Programming. Volume 2, 3rd Edition. Addison-Wesley. pp. 205, "Positional Number Systems"