How do you do non-whole numbers in bases other than 10?

I could probably use a refresher in multiplication/division* as well, especially since I think fractions may play a big role here. (The internet has been woefully lacking in this knowledge).

How can I represent things in the equivilent to “decimals” in other bases? I’m guessing .5 would be .1 in binary, .4 in octal, and .8 in hexadecimal (the ones I’m mainly interested in), but the more complex representations confuse me. I probably would have a better time if I represented them as fractions (but I can’t do long division in non-decimal either) but that doesn’t help with irrational numbers (i.e., what’s Pi in binary, other than the ratio of the circumference to the diameter of course?) maybe some jury rigged scientific notation could help, I don’t know. What about square root, can you do long square root and exponents in the bases, or rather, how can you?

On a similar note:
I’d figure with the correct drive and lack of life you could feasibly do complex number calculations (meaning both things involving “i” and things needlessly complicated) in (say) base 13 if you felt like it, but has anyone bothered to do things like this in strange bases? You can explain how if you feel it’s the only way to justify you knowing this, but a simple rundown of who/when/why will do just fine. I’m curious as to how to do it but I figure knowing how will be like watching the video in the ring and kill me in some amount of time if I don’t pass the knowledge on.

Note: I think I have multiplication, at least in base 2, I’m more confused about things like 77 in base 8, at least without cheating by sending it through base 10 and then converting.

Blahblahblah mandatory link (before anyone else does it):

You can find out how it is done in binary here among zillions of other places. Search for binary fractions, numerical analysis, or computer arithmetic. Any CS major learns this - at least we did when I was in school.

You have the basic idea. To read a fraction in any base, say 0.f1,f2,f3, (where the commas are to separate the fis, because I don’t feel like pasting in something with subscripts) by
0 + f1 * b^-1, + f2*b^-2, etc., where b is the base.

That’s fixed point. You also can, and usually do, handle this by making the mantissa be > 1, and multiplying the whole thing by an exponent - so my example would be expressed as f1f2f3*b^-3.

You clearly can’t express all fractions exactly in this way, but we can’t in decimal either.

Hope that helps. I never did much like Computer Arithmetic.

Now, as how to do arithmetic, since addition and multiplication are well defined, everything else is done either in software or in hardware, basically the way you’d do it in decimal. Most of computer arithmetic looks for ways of doing operations faster and more precisely. You just have to learn your octal or hex times tables.

As for multiplying in base 8, remember how you learned to do it in base 10 - memorization. But I’ve never really had to do that in 40 years.

Here’s binary pi to the first 32768 digits.

Oh, and take care when using binary to represent irrationals. :slight_smile:

Link

To the best of my knowledge, it has not yet been proven that every finite bit string appears in the binary expansion of pi. People often assume pi, and all other irrational numbers, to be what is technically known as a “normal number” (one whose limiting frequency of containing any particular block of digits is the same as would be expected from a uniformly random distribution), but this has definitely not yet been proven for pi (or e or sqrt(2) or any other familiar number), not even for a single base. Certainly, there are irrational numbers which fail to contain every finite bitstring (for example, the number given in binary by 0.1010010001000010000010000001…, which never contains the bitstring “11”)

As Voyager said, in base b the first place beyond the decimal represents b[sup]-1[/sup]; the second represents b[sup]-2[/sup]; and so forth. As an example, in base 3, we have 0.5[sub]10[/sub] = 0.111111…[sub]3[/sub], since 1/3 + 1/9 + 1/27 + … = 1/2.

To expand on this, you’d just memorize the base-7 multiplication table:



   1  2  3  4  5  6
--------------------
1| 1  2  3  4  5  6
2| 2  4  6 11 13 15
3| 3  6 12 15 21 24
4| 4 11 15 22 26 33
5| 5 13 21 26 34 42
6| 6 15 24 33 42 51


Beyond this, if you wanted to multply larger numbers together, you’d use the same algorithm you do in base 10 — only with more carrying:



  42
  25
----
 303
114
----
1443


Remember that for doing decimal computations done by hand, we’ve memorized things like the decimal multiplication table to help us along. If you were going to make a habit of doing arithmetic in octal by hand, you’d presumably want to memorize the octal multiplication table, along with every possible sum of two octal digits.

The particular case of 7*7 would be covered by exactly that — memorization or table look-up. For multi-digit multiplication (or anything else), you’d apply the same algorithm you learned in school for decimals, but of course you’d do all the primitive arithmetic in octal instead.

(On preview, MikeS said much the same thing.)

Even if Pi is a normal number, doesn’t that only mean it almost certainly has every bitstring?

ETA: After re-reading the beginning of the article, I think maybe not. Maybe a normal number really does have to have every bitstring in it somewhere.

-FrL-

Yes, a normal number has to have every particular bitstring in it somewhere, for if it lacked bitstring S (of length n), then the limiting frequency within it of S would be 0, as opposed to the 1/2^n expected from a uniformly random distribution.

I should be clear that it’s possible to contain every finite bitstring without being normal (for example, construct a normal number number in base 3, and then turn all the instances of the digit 2 into the digit 1), but that (to the best of my knowledge) π has not been proved to contain every bitstring by any means (it certainly hasn’t been proved to contain every digit-string in base-10), and the main reason people believe π contains every bitstring is simply because, a fortiori, they believe it to be normal.

I think one can prove that almost all numbers are normal, correct? That is to say, that the set of non-normal numbers is of measure zero? If so, that would be a pretty good reason to suspect that pi (or any other number not known to be non-normal) is normal.

Yes, “almost all” numbers are normal in precisely the sense you mention. (Going back to Frylock’s mention of “almost certainly” (i.e., with probability 1, though not necessarily guaranteed), it’s not hard to show that a number drawn at uniform random from a finite real interval (e.g., [0, 1]) almost certainly will be normal, which suffices to establish that “almost all” real numbers are normal.)

But, for all that, very few mathematical constants have been proved to be normal (those which have been are generally “contrived” in some way, their definitions being very much in the flavor of constructing them as particular digit-sequences, rather than specifying them via arithmetic properties, so to speak). I’m not sure how valid it is to move from “Almost all reals are normal” to “Any real not known to be non-normal is very likely normal”; formalizing the use of the language of probability involved here is not straightforward, but it seems we have to acknowledge this: π was not selected at random out of the reals, it was brought to our attention because of certain arithmetic properties, and it may well be the case that such properties are not independent of normality.

For example, it has been conjectured on seemingly reasonable grounds that every irrational algebraic number is non-normal. So, despite the fact that sqrt(2) is not known to be non-normal, it does not seem as though we could consider ourselves to have pretty good reason to suspect that sqrt(2) is normal (though, of course, many people also conjecture that it is normal).

[The “also” in that last parenthetical means “There are also (in addition to, but separate from, those who make the first conjecture) many people who conjecture that it is normal”, not “There are many people who also (in addition to making the first conjecture) conjecture that it is normal”.]

Oh, certainly. We don’t by any stretch know that pi is normal, and we can’t even say something like “we have strong reason to suspect…”. But the fact that most numbers are normal is, at least, a pretty good reason to suspect, as I said. Of course, that’s a weak enough standard of certainty that one can simultaneously suspect mutually-contradictory possibilities.

Non-normal numbers are infinite, since all rationals are non-normal. Yet since irrationals have a higher cardinality, the probability of striking a rational number by a random poke at the number line is zero.

None of this says anything about pi, specifically, though.

Ready for another go-round on infinite math? :smiley:

Since not all normal numbers are rational, it’s not clear what your point is.

-FrL-

It’s not clear to me what Exapno Mapcase is driving at either, but he did explicitly note that no normal numbers are rational. I think perhaps he misunderstood Chronos’s reference to the non-normal numbers having “measure zero”, and thought this somehow conflicted with the fact that there are infinitely many rationals.

On the off chance that it would be at all comprehensible to me, I’d be interested in finding out what those (seemingly) reasonable grounds were.

-FrL-

BTW I’m still reading your PM(s).

Right you are. Sorry I missed that.

-FrL-

Speaking of another go-round on infinite math…

To show that the probability of obtaining a rational number (from the unit interval with a uniform random distribution, let’s say) is zero, which is the same as showing the rational numbers have measure zero, it is not enough to simply note that the rationals have smaller cardinality than the irrationals. This would be enough were one to assume Martin’s Axiom (which is implied by the continuum hypothesis), but without such non-standard assumptions, it is consistent for the unit interval to be splittable into two sets, one of lower cardinality than the other, without the smaller set having probability 0. In demonstrating that the rationals have measure zero, one actually appeals specifically to the fact that they are countable, which does suffice to establish the claim, on the grounds that measure is countably additive and singletons have measure zero; at higher cardinalities, however, this argument would fail, as measure is not required to be additive over higher-cardinalities (for example, the unit interval as a whole has measure 1, despite it being the union of an uncountable number of singletons of measure 0).

Whoops, I had gotten reversed the conjecture I was thinking of. The conjecture was that every irrational algebraic number was normal; quite some egg on my face. There goes my example…

Still, no irrational algebraic number has ever been demonstrated to be normal in so much as a single base, which perhaps can blunt my embarrassment somewhat…