ebook img

Imaginary Number Bases PDF

0.11 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Imaginary Number Bases

Imaginary Number Bases Philip Herd January 18, 2017 7 1 0 2 Abstract n a An expansionuponDonald Kunth’squarter-imaginary basesystem is introducedtohandle J any imaginary number base where its real part is zero and the absolute value of its imaginary 7 part is greater than one. A brief overview on number bases is given as well as conversion 1 to both positive and negative bases. Additionally gives examples for addition, subtraction, ] multiplication for imaginary bases and adds a division method for imaginary bases as well as O mentions possible uses. H . h t a m [ 1 v 6 0 5 4 0 . 1 0 7 1 : v i X r a 1 Introduction A number base (or radix) is a positional number system that uses a set of digits to represent numbers. This takes the form of (...d4d3d2d1d0.d−1d−2d−3...)b where the symbol between d1 and d−1 is the radix point, used to denote the whole and fractional parts of a number. This may also be either a comma or a raised dot depending on culture [5]. The most familiar base is base 10 (decimal) which uses ten digits, 0 through 9, to represent any value. The form mentioned above may be rewritten as XdiBi (1) where d are the digits and B is the base. This is the definition of a base. For values in a base i other than ten, the base will be subscribed to it. Bases will also be bolded in this text. Twelve in base 2 for example is 1100 . The first thirty-six digits that are used in this paper are in Table 1. 2 History Numbers represented in a positional system can be traced to an- Digit Value Digit Value tiquity. Ancient Babylonians used a base sixty numeral system. The current decimal system was first developed in India around 0 0 I 18 600 A.D. At the time it was only applied to integers. Extension to 1 1 J 19 the system to handle fractions wasn’t until the 15th century. See 2 2 K 20 Ref. [5], §4.1 for more details. A. J. Kempner [3] gave a method 3 3 L 21 to allow conversion to a base greater than 1 in 1936. A. R´enyi [9] 4 4 M 22 defined beta expansions in 1957, which is also a method to convert 5 5 N 23 to positive real bases. 6 6 O 24 Bases that are less than -1 were also considered. Negative bases 7 7 P 25 have the interesting property that all values can be represented 8 8 Q 26 without a sign [5]. V. Gru¨nwald [1] first discovered such bases in 9 9 R 27 1885 but was largely ignored. Kempner [3] suggested that such A 10 S 28 negative bases were possible. It was rediscovered again in 1957 [7] B 11 T 29 by Pawlak and Wakulicz. These discoveries only dealt with nega- C 12 U 30 tive basesthat were integers. Itwasn’t until 2009thatS. ItoandT. D 13 V 31 Sadahiro came up with negative beta expansions [2]. This method E 14 W 32 allows conversion to any real base less than -1. F 15 X 33 Bases that arecomplex have also been considered, but there are G 16 Y 34 few. WalterPenny discussed anumber system[8]in1965usingbase H 17 Z 35 i-1 which uses only the digits 0 and 1. Donald Knuth developed Table 1: First thirty-six digits the quarter-imaginary system in 1960 [4]. His work used 2i as the and their corresponding values base and it used the digits 0, 1, 2 and 3. Such complex bases can in base 10. represent every complex number without a sign [5]. 1 Conversions Positive The digit set for positive integer bases is defined as {0, 1, ..., B−1}. The base itself must be two or greater. To determine the d of a number N in base B where both N and B are positive integers i one takes the modulo of N from B and divide N by B until N is zero. The division is rounded down to the nearest integer. N mod B for each iteration are the d ’s. The d ’s are sorted from last found i i to first. If N is negative, negate N before the algorithm and negate the result after completing the algorithm. Figure 1 is Python code showing this method. For conversion to real bases greater than one a different method is needed. This method also allows conversion of real numbers to integer bases The digit set for real positive bases is defined as {0, 1, ..., ⌈B⌉−1}. It is defined for B > 1 and 0 6 N < 1. In the event that N is not between 0 and 1, N is divided by a suitable power of B so that it does and the algorithm is started at that power. The algorithm uses a transformation function defined as T (x) = Bx−⌊Bx⌋. This function B is called recursively such that T0(x) = x , T1(x) = T (x), T2(x) = T (T (x)) and so on. Therefore B B B B B B the digits of N in base B are found using i=p−1 j=∞ N = X diBi with di = (cid:4)TBj(x)(cid:5) where x =N /Bp such that x ∈ [0, 1) (2) i=−∞ j=0 where i decreases by 1 and j increases by 1 for each iteration. Should the d ’s become an infinite i trail of zeros, the algorithm can stop and the trailing zeros are truncated. This method is the beta expansions defined in ref. [9]. Negative Negative bases are also possible. The digit set for negative integer bases is {0, 1,... ,|B|−1}. To convert a number N to base B where B is an integer less than 1, N is repeatedly divided by B until N becomes 0 with the digit being the modulus of B to N. The division here must be floor division.1 In the event that N mod B is negative, 1 is added to N and B (being negative) is subtracted from the digit. The Python code shown in Figure 1 also contains this method. Conversion of real values to negative real or negative integer bases can be done using negative beta expansions [2]. The conversion works similar to the positive real base conversion. The digit set for real negative bases is defined as {0, 1, ..., ⌈|B|⌉−1}. It is defined for −B < −1 (where B is positive) and N must fall between −B/ and 1/ . These two values are defined as l and r . B+1 B+1 B B In the event that N does not fall within this range, N is divided by a suitable power of B (denoted as p) so that it will fit and the algorithm is started at that power. The transformation function is defined as T (x) = −Bx − ⌊−Bx−l ⌋. This operates similar to the transformation function for B b positive real bases; it is called recursively. Thus the digits are found using 1 Thesignofthemoduluswhenworkingwithnegativevaluesisthatofthedivisor(thebase). Notallprogramming languages follow this rule. See “modulo operation” on Wikipedia for a list of what programming languages respect this. A modulo operation that keeps the sign is equivalent to mod(a,b)=a−(b a ). (cid:4)b(cid:5) 2 i=p−1 j=∞ N = X diBi with di = (cid:4)−BTBj(x)−lB(cid:5) where x =N /(−B)p such that x ∈ [lB, rB) (3) i=−∞ j=0 Where i decreases by 1 and j increases by 1 for each iteration. In the event that one of the d ’s is equal to B, 1 is subtracted from the d and a 0 is inserted in after it. For example, if you i i were working with base -8 and when you converted a number you got 0.8888888888−8; you would subtract one from each 8 and insert a zero between them leaving you with this: 0.70707070707−8. Conversion example: Convert 3.5 to base -4. l = −0.8 b r =0.2 b p =3 3.5 x = = −0.0546875 (−4)3 d =⌊−4T0 (x)−l ⌋ = ⌊−4x−l ⌋ = 1 2 −4 b b d =⌊−4T1 (x)−l ⌋ = ⌊−4T(x)−l ⌋ = 3 1 −4 b b d =⌊−4T2 (x)−l ⌋ = ⌊−4T(T(x))−l ⌋ = 0 0 −4 b b d−1 =⌊−4T−34(x)−lb⌋ = ⌊−4T(T(T(x)))−lb⌋ = 2 Because T4 (x) = 0 all following digits will be zero, the process can stop and thus 3.5 in base −4 -4 is 130.2−4. Imaginary An imaginary base was first discovered by Donald Knuth in 1960[4]. Because even powers of purely imaginary numbers can be negative numbers, an imaginary number base can depend on negative bases. This method can be extended using negative beta expansions[2] such that any purely imaginary number C where |C| > 1 can be used as a base. To do so, some modifications must be made. The digit set for an imaginary base is not that of positive or negative bases but rather {0, 1, ..., ⌊|C2|⌋−1} with C being the base. The imaginary base C has an effective negative base, B, that is equal to −|C2|. Conversion of a complex number A = q + ri where q and r are e real numbers to an imaginary base C works as follows: 1. Find the effective negative base, B, for C. e 2. Convert q to base B and convert r/Im(C) to base B. e e 3. Adjust converted q and r’s whole and fractional parts to be of even and odd length by leading and trailing zeros respectively. 4. Interweave q with r such that q takes the even power positions and r takes the odd power positions. 3 Following these rules, base πi would have the effective negative base of −π2 and use ten dig- its. eiπ6 in base πi for instance would be 11.92771330974150459993534912112... Additionally, an interesting relationship between positive and negative imaginary bases can be seen. For instance, let E = 85 + 47i and F = 85 − 47i. In base 6i ( B = −36) E and F become 10Y8D.6 and e 6i 11YTD.U6i.In base -6i E and F become 11YTD.U−6i and 10Y8D.6−6i. The sign of the base simply flips the sign of the imaginary part of the converted number. Conversion example: Convert −5+7i to base 2i −5 in base -4 is 23−4. 7 divided by 2 is 3.5, which in base −4 is 130.2−4. Adding leading and trailing zeros gives 0023.0−4 for the real part and 0130.2−4 for the imaginary part. Interweaving these two such that the real part takes the even power positions and the imaginary part takes the odd power positions, theresult is00103203.20. Thus−5+7iinbase2i is103203.2 . Converting itbacktobase 2i 10 using the definition of a base to check: 1(2i)5+0(2i)4+3(2i)3+2(2i)2+0(2i)1+3(2i)0+2(2i)−1 = 1(32i)+0(16)+3(−8i)+2(−4)+0(2i)+3(1)+2(−1/ ) = 32i−24i−8+3–i = −5+7i. 2i Operations Comparisons While comparing complex values is not defined, one can compare the real and imaginary parts separately. In a negative base[1][10], one compares the digits directly if they are in an even power position and oppositely in an odd power position. That is, 12−10 < 13−10 as 2 and 3 are in an even position and 2 < 3 whereas 47−10 < 27−10 as 4 and 7 are in an odd position and 7 < 4 when compared oppositely. Extending this to imaginary bases, real values would be compared directly in the power positions of 0, 4, 8, ..., 4k (where k is an integer) and compared oppositely in the positions of 2, 6, 10, ..., 4k +2. For imaginary values, direct comparison would be in the 1, 5, 9, ..., 4k +1 positions and oppositely in the 3, 7, 11, ..., 4k +3 positions. Comparison example: compare the real and imaginary parts of 11873.3 and 10880.3 . 3i 3i The real parts are 10803 and 10800 . Since the values differ in the zero position one can 3i 3i directly compare and thus 10803 is larger. The imaginary parts are 1070.3 and 0080.3 . Here, 3i 3i 3i the values differ in the third position and so an opposite comparison states that 80.3 is larger. 3i Unities Unless otherwise noted, the following is for imaginary bases ni where n is an integer and |n| > 1. 1 in any base is always 1. −1 in any such base is 10[n2 −1]. For example in base 3i: n2 = 9, −1 in this base would be 108 . i in any such bases where n > 0 is 10.[n2 −|n|]. i in base 2i would 3i be 10.2 , in base 4i it would be 10.C . In any such bases where n < 0, i instead becomes 0.[|n|]. 2i 4i For instance, i in base 9i would be 0.9 . For −i, the rules for +i above are swapped: −i follows 9i the positive integer imaginary base rule of +i for negative imaginary bases and negative integer imaginary base rule of +i for positive imaginary bases. Arithmetic For addition, subtraction and multiplication they are carried out in the same manner as normal arithmetic except for a change with the carry and borrow digit rules. A carry digit removes 1 from two columns over and a borrow digit adds 1 to two columns over[4]. Each column should not exceed 4 the effective base. This applies to the same operations in a negative base, except they move one column over instead[1, 10]. In the event that a carry digit cannot remove 1 from the column, a borrow digit is added to two columns over and the carry digit then removes 1 from the base. This can be seen in the first example below. Addition examples (all in base 3i, B = −9): e i ii iii iv 41 132 0.08 123.485 + 61 +11873 + 0.01 +300.034 108012 15 108.00 422.320 Subtraction examples (all in base 3i): i ii iii iv 871 204.000 25763.0 468.782 −233 − 1.104 −126742.3 −551.123 747 203.005 8031.6 10817.768 Multiplication examples (first three are in base 3i, last one is in base 4i) i ii iii iv 10432.567 18.68 × 87.200 5 5.0 × 26.00 20853035 × 2 × 0.3 10E4D4 147001364 10801 1080.6 + 2FC +157432732 11FF39.4 523204.0875 For division, one first must multiply both the divisor and the dividend by the divisor’s complex conjugate. Afterwards, the division of real and imaginary parts of the dividend can be done directly in their effective base. The real and imaginary parts of the quotient are then added back together while keeping the correct positions. This follows complex division for normal arithmetic. If the divisor is purely real then the multiplication by the complex conjugate can be skipped. If the divisor is purely imaginary the multiplication step can be skipped but the division of the dividend’s real part will result in the quotient’s imaginary part and the dividend’s imaginary part will result in the quotient’s real part with the radix shifted one column to the left. As the effective base is a negative base, the rules for doing a division in such a base −B(where B is positive and real) are as follows[1, 10]: 1. The first partial dividend should be greater than the absolute value of the divisor and less than the absolute value of the divisor multiplied by B −1. This is the same requirement for the first partial dividend as division in a positive base. 5 2. If the divisor and first partial dividend are opposite in sign then the first partial quotient will be two digits long, otherwise it will be one. Once this first partial quotient is found, division may continue on as regular division. That is, each following step will have one digit. 3. Each partial remainder found must be opposite in sign of the divisor and its absolute value be smaller than the absolute value of the divisor. The following are two examples of of division in base -10: i ii 1512.1247 28 14117 (cid:1) 140 11 2261 28 9 197349 (cid:1) 37 198 36 193 10 198 28 154 20 154 36 09 40 9 52 80 96 4 From this, division of 18.68 by 10E6 in base 4i is as follows: Complex conjugate of 10E6 is 10E6×10F = 26. 18.68×26 = 11FF39.4 10E6×26 = 10A04 Dividend’s real part (odd positions dropped) = 1F9 Dividend’s imaginary part (even positions dropped) = 1F3.4 Real part Imag part 1.C 1.D 1A4 1F9 1A4 1F3.4 (cid:1) (cid:1) 1A4 1A4 550 6F4 550 6F4 1.C in the even positions = 1.0C 1.D in the odd positions = 10.D 1.0C+10.D = 11.DC This can also be done without separating the real and imaginary parts as above and instead done entirely in line: 6 11.DC 10A04 11FF39.4 (cid:1) 10A04 16FF9 10A04 65F5 4 60F0 4 50 5 50 5 Another example of division in base 4i: 11EE15FEC.168 divided by E94. ∗ E94 = 1E74 11EE15FEC.168×1E74 = 2143E044F7E.C E94×1E74 = 104030E00 32A.F12 104030E00 2143E044F7E.C (cid:1) 30C070A00 18380A4F7 208050C00 8C8CA8F7E 807050C00 C1C4837E C C0A00020 0 124835E C0 104030E 00 208050 C00 208050 C00 An alternate method for division (which produces the inverse of the divisor) is given by Nadler [6]. Uses An imaginary numeral system may be useful in computing and manipulating complex numbers on computers, as previous work has stated [8, 4]. An alternate use for imaginary bases (and by extension all other bases) is that it can bethought of asa formof encryption. Onecan represent any text as a number in a base with a sufficient digit set. “HELPIAMASTRINGOFWORDS” can be seen as a number in base 33 or higher, base -33 or lower, or bases ±5.75i and larger in magnitude. This would then be converted to a different base and the converted number would be the encrypted message. In order to be able to encrypt or decrypt a message using bases, one would need to know the base the message can be read in, the base the message was converted to and the order of the digit set used. 7 Conclusion Given above are methods to convert a number into a positive, negative and imaginary base. Addi- tionally, the four basic arithmetic operations are explained for imaginary bases. Uses for number bases are mentioned. The reader may wish to try such calculations in imaginary bases in addition to the examples given. References [1] V. Gru¨nwald, “Intorno all’aritmetica dei sistemi numerici a base negativa con particolare riguardo al sistema numerico a base negativo-decimale per lo studio delle sue analogie coll’aritmetica ordinaria (decimale)”, Giornale di matematiche di Battaglini, 1885, vol. 23, pp. 203-221 [2] S. Ito, T. Sadahiro, “Beta-expansions with negative bases”, Integers, 2009, vol. 9, pp. 239-259 [3] A. J. Kempner, “Anormal Systems of Numeration”, AMM, 1936, vol. 43, pp. 610-617 [4] D. Knuth, “An Imaginary Number System”, Communications of the ACM, 1960, vol. 3, pp. 245-247 [5] D.Knuth, “PositionalNumberSystems”The Art of ComputerProgramming,2nded.(Addison- Wesley, Menlo Park, CA, 1981), pp. 178-197 [6] M. Nadler, “Division and Square Root in the Quarter-Imaginary Number System”, Commu- nications of the ACM, 1961, vol. 4, pp.192-193 [7] Z. Pawlak, A. Wakulicz, “Use of expansions with a negative basis in the arithmometer of a digital computer”, Bull. Acad. Pol. Sci., Cl., III, 1957, vol. 5, 233 [8] W. Penny, “A “Binary” System for Complex Numbers” JACM, 1965, vol. 12, pp. 247-248 [9] A. R´enyi, “Representations for real numbers and their ergodic properties”, Acta Mathematica Academic Sci. Hungar., 1957, vol. 8, pp. 433-493 [10] F. Sammarruca, English translation of V. Gru¨nwald’s paper, Private Communication, 2015 8 def rebase(num, base): "converts an integer from base ten to given integer base" digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" values, sign = [], "" if abs(base) < 2 or abs(base) > len(digits): # base check raise ValueError("invalid base") if num < 0 and base > 0: num *= -1; sign = "-" # handle negatives while num: num, d = divmod(num, base) if d < 0: num += 1; d -= base # handle negative base conversion values.append(d) values.reverse() converted = sign + "".join(digits[i] for i in values) return converted Figure 1: Python code to convert integers from base ten to either positive or negative integer bases 9

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.