Working with Number Bases
We now have a generalization for expressing numbers of any base r in terms of a power series. Using this generalization, we can convert from any base to decimal (or any other if you can readily add and take exponents in that base).
Power Series Expansions
We are accustomed to using a decimal system for most of our mathematical computations. This is a base ten system, in which each digit of a number represents a power of 10. For example, the number 987.65, can be expressed as:
[9·10^2] + [8·10^1] + [7·10^0] + [6·10^-1] + [5·10^-2]
This format can be rewritten more generally by assigning the digits 9, 8, 7, 6, 5 to the expressions D(2), D(1), D(0), D(-1), D(-2), respectively. (The numbers in parentheses are the same as the exponents of the powers of ten they correspond to.) We can also express the base, in this case, 10, as r. These substitutions give us the following expression:
[D(2)·r^2] + [D(1)·r^1] + [D(0)·r^0] + [D(-1)·r^-1] + [D(-2)·r^-2]
For example, we can find the decimal value of 212.01(3) as follows:
[2·3^2] + [1·3^1] + [2·3^0] + [0·3^-1] + [1·3^-2]
= 2·9 + 1·3 + 2·1 + 0·1/3 + 1·1/9
= 18 + 3 + 2 + 1/9 = 23.1111...
Binary, Octal, and Hexadecimal Numbers
The binary number system is a base 2 number system, using only the digits 0 and 1. It is commonly used when dealing with computers because it is well suited to represent logical expressions, which have only 2 values, TRUE(1) and FALSE(0). Single binary digits are often referred to as bits.
Octal Numbers are base 8 numbers, using only the digits 0 through 7. Hexadecimal numbers(often referred to as hex) are base 16 numbers, using the digits 0 through 9, and the letters A through F (A representing 10(10), B representing 11(10), and so on). Since 8 and 16 are both powers of 2, each of their digits can be represented as a group of bits, the number of bits being the same as the power of 2 that the base is. In other words, since 16 = 2^4, a base 16 digit can be represented as 4 bits, and since 8 = 2^3, a base 8 digit can be represented as 3 bits, as in the following examples:
237.44(8) = 010|011|111|.|100|100(2)Notice that each group of bits on the right corresponds to a digit in the higher based number on the left. It is also easy to convert the other way, from binary to hex or octal. You simply start at the decimal point and count out groups of threes or fours, depending on the base to which you are converting, and add leading and following zeros to fill the outer groups. This ease of conversion makes octal and hex good shorthand for binary numbers.
A443.4CB(16) = 1010|0100|0100|0011|.|0100|1100|1011(2)
7372.01(8) = 111|011|111|010|.|000|001(2)
1AA.03(16) = 0001|1010|1010|.|0000|0011(2)
Converting from Decimal to Other Bases
We have seen how to convert to decimal from other bases using a power series. You can use the same principle to convert from decimal to other bases.
In this case, you make a power series in the base you want to change to, with coefficients of 1. Then find the first number larger than your decimal number. Divide the decimal number by the next smallest number in the power series, and take an integer result. Then repeat the process with the remainder. The number in the new base is the results of the divides, lined up in order of exponent from left to right, making sure to remember to put zeros in places where the divide result was zero.
For example, let us find the value of 174(10) in base 3:
First we take a power series of 3:3^0=1 3^1=3 3^2=9 3^3=27 3^4=81 3^5=243 Since 81 is the next smallest number, we start by dividing 175 by 81, and continue through the power series as follows:Thus, the result is 20111(3) 175 / 81 = 2 Remainder 13 13 / 27 = 0 Remainder 13 13 / 9 = 1 Remainder 4 4 / 3 = 1 Remainder 1 1 / 1 = 1 Remainder 0
This method can be simplified by MODing the dicimal number by the new base, and repeating the process with the integer result of dividing the decimal number by the new base until the division result is 0. The result is then the results of the MODs taken from bottom to top.
For example, let us repeat the example from above:Thus, the result is 20111(3) 175 MOD 3 = 1 175 / 3 = 58 58 MOD 3 = 1 58 / 3 = 19 19 MOD 3 = 1 19 / 3 = 6 6 MOD 3 = 0 6 / 3 = 2 2 MOD 3 = 2 2 / 3 = 0
Fractions in Different Bases
Base conversions are handled similarly for fractional parts of numbers. You can take a power series for the base you are converting to and subtract, or use a method similar to the one we just looked at, multiplying by the new base instead of taking MODs, and taking off the integer parts of the results from top to bottom to obtain the number in the new base.
Let's use both methods to convert from .59342(10) into binary:
Power Series method:
First, we'll take a power series of 8, with increasing negative exponents:
We will stop at 6 decimal places. Unlike base conversions between integers, fractional parts of numbers are not limited to a set number of digits, and in some cases they can even go on infinitely. For example, the number 1/3, expressed as .1 in base three, is infinitely long in base 10. Thus it is often necessary to decide on a set precision to expand the number to. 2^-1=0.5 2^-2=0.25 2^-3=0.125 2^-4=0.0625 2^-5=0.03125 2^-6=0.015625
Next we will subtract:Thus our result is 0.10011(2) 0.59376 = 1·0.5 + 0.09376 0.09342 = 0·0.25 + 0.09376 0.09342 = 0·0.125 + 0.09376 0.09342 = 1·0.0625 + 0.03126 0.03126 = 1·0.03125 + 0.00001 0.00001 = 0·0.016525 + 0.00001
Multiplication Method:
Again, we get the result 0.10011(2) 0.59376·2 = 1 + 0.18752 0.18752·2 = 0 + 0.37504 0.37504·2 = 0 + 0.75008 0.75008·2 = 1 + 0.50016 0.50016·2 = 1 + 0.00032 0.00032·2 = 0 + 0.00064
by: Nurul Adlina Syazwani binti Mohamad Arif
No comments:
Post a Comment