Re: Change of base
- From: "bertieboo" <bob@xxxxxxxxxxxxx>
- Date: 14 Jul 2006 15:47:46 -0700
bertieboo wrote:
Robert Israel wrote:
In article <1152748256.731645.58760@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
bertieboo <bob@xxxxxxxxxxxxx> wrote:
Change of base
This note deals with changes of base from any base to any other base
(positive numbers)
(Note: Numbers in a base other than ten required to be converted can
easily be dealt with by first converting them to base ten).
Note: Bases are represented by a suffix to a number in brackets, except
that base ten numbers are shown with no brackets or suffix. The base
itself is always depicted in base 10 (ten). The base, b, of any number
system is always written 10, ie (10)b = b
Rational bases, a general method
Consider conversion to a rational base.
A general method which may be applied to all cases is as follows:
Consider a number, n which is to be converted to base b.
First find the highest required power p of the base, thus:
bp < n whence p = [logn/logb] and [ ] is the integer part.
The required number is then a1bp + a2bp-1 + ...+ apb + ap+1 . + ap+2 +
ap+3 ...
Where a1 = [n/bp] and d1 = the decimal part of n/bp, !
a2 = [d1b] and d2 = the decimal part of d1b radix point
a3 = [d2b] and d3 = the decimal part of d2b
: etc.
Note: The radix point lies between ap+1 and ap+2.
I think what you mean is this. You have (presumably) b > 1 and
n > 0, and want to write n = sum_{j=1}^infty a_j b^{P+1-j} where
a_j are integers, 0 <= a_j < b. If P = floor(log(n)/log(b)), so
b^(P+1) > n >= b^P, take r_1 = n/b^P, and then for each j,
a_j = floor(r_j) and r_{j+1} = b (r_j - a_j).
Example 4: Convert 3178.22 to base 5.2.
Here, p = [log3178.22 ÷ log5.2] = 4
a1 = [3178.22÷5.24] = 4 and d1 = 0.346809...
a2 = [0.346809x5.2] = 1 and d2 = 0.803408...
a3 = [0.803408x5.2] = 4 and d3 = 0.177722...
a4 = [0.177722x5.2] = 0 and d4 = 0.924154...
a5 = [0.924154x5.2] = 4 and d5 = 0.805600...
a6 = [0.805600x5.2] = 4 and d6 = 0.189120...
a7 = [0.189120x5.2] = 0 and d7 = 0.983424...
a8 = [0.983424x5.2] = 5 etc
Note: Radix point is between a5 and a6
Therefore 3178.22 = (41404.405...)5.2
Generally, rationals converted to a rational base do not seem to
repeat.
Indeed: if p is a prime such that the p-adic order of b is -k < 0
(i.e. if b is expressed as a fraction in lowest terms, the denominator
of b is divisible by p^k but not p^(k+1)), and some r_n has p-adic
order -m < 0, then the p-adic order of r_j for j >= n is -m-(j-n)k.
So the sequence {r_j} never repeats, and since the sequence of digits
(a_j, a_{j+1}, ...) determines r_j, that sequence can't be
eventually periodic.
Eg 1/5 = (0.10102101504...)5.2
1/2 = (0.2303112044311...)5.2
p = 5 in these cases, with b = 26/5 having 5-adic order -1,
r_1 = 26/25 and 13/5 respectively having 5-adic orders -2 and -1.
Robert Israel israel@xxxxxxxxxxx
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada
.
- References:
- Change of base
- From: bertieboo
- Re: Change of base
- From: Robert Israel
- Re: Change of base
- From: bertieboo
- Change of base
- Prev by Date: Re: Change of base
- Next by Date: Re: Change of base
- Previous by thread: Re: Change of base
- Next by thread: Re: Change of base
- Index(es):
Relevant Pages
|
|