Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When I represent a number in the decimal system, I have an intuitive knowledge of what it amounts to. For example take the number '10': I understand that it means 10 apples or 10 people... i.e I can count in the real world.

But as soon as the number is converted to any other system, this understanding no longer applies. For example 10 when converted to binary will be 1010...now what does this represent? Is there a way to understand this number 1010 in terms of counting objects in the real world?

share|improve this question
    
For me, 10 apples means "one zero" apples. What do you mean by one zero apples? –  Francisco Presencia Oct 22 '13 at 11:03
add comment

3 Answers

up vote 12 down vote accepted

"Io sono italiano" is the italian sentence for "I am italian". Barring issues with translation, the two sequence of letters mean to (a reader who is able to speak both) the same concept.

So a number expressed in the decimal system may, under some condition, represent a counting device (you can count with integer, but then think that zero is a strange number, negative numbers are even stranger, and rational and irrational and imaginary numbers also are interesting).

But the decimal system is just a notation, which happens to have gained some predominance (well, in the computing world the case could be made for binary, octal and hexadecimal). It is by no means special: a given number can be written in whatever notation you decide to use.

So 1010 (in binary notation) is precisely the same as 0*2^0 + 1*2^1 + 0*2^2 + 1*2^3 = 10 in decimal notation. You can say that humans usually have 10 fingers on their two hands (decimal notation) or 1010 finger on their 10 hands (binary notation).

I will add a couple of comments:

  • in any base (in any notation) the number written as 10 is special
  • there are a lot (to use an understatement) of numbers which are properly expressed implicitly: think about e and pi which are surely very famous numbers whose representation we prefer to keep "in letters" rather than using a sequence of digits (which should be infinite to be precise).
share|improve this answer
2  
It all comes down to practice. You can read and think fluently in any language or radix as long as you practice it. People who know morse code don't hear .-- --- .-. -.. ..., they hear "words". –  Hand-E-Food Sep 9 '12 at 5:55
1  
Morse code is a nice example of a specific notation (albeit not positional :-): you go with the flow of it rather than consciously thinking "ok, now the sequence for S was...?". For this reason it could happen that one is better able to "write it" than to "read it" or vice versa. –  Francesco Sep 9 '12 at 5:59
4  
Fun fact: You can count to 1023 with your fingers. –  phant0m Sep 9 '12 at 11:28
add comment

A binary number denotes a sum of powers of two. 10102 means (from right to left) no one, a two, no four, an eight.


I'll try to give a more expansive explanation of the concept of bases here.

I would argue that a number is an abstract concept. When you read 10, it is not the real thing, it is merely one possible representation of an idea/concept that you cannot truly grasp.

10 (that is, 1 followed by a 0), is an encoding for this idea of "ten". Although we have may have developed some sort of intuition for this way of encoding numbers, there is a more fundamental system at work here.

143 for instance is 100 + 40 + 3, or: 3 ones, 4 tens and 1 hundred (ten tens). We can decompose any such number by their digits. The position of a digit determines its significance, i.e. what power of ten it counts:

decimal decomposition

As you can see, the digits denote the coefficients for a sum of powers of ten. We call this number (ten) the base.

Ten (as a concept) is not a special number. It just seems natural because we are so used to it.

We can freely choose virtually any basis we like. The meaning of each digit always depends on the base and is obtained as follows:

encoding in arbitrary base

Thus, 143 (the encoding) can have a different meaning, depending on which base is implied (usually ten of course) but the base could just as well be 11:

http://i.imgur.com/jrPrJ.png

With binary numbers, it works the exact same way, but the base is two of course.

binary representation of ten


For any encoding in a certain base, you need base-many distinct symbols to encode numbers. That is, for base ten, you need ten distinct symbols, for a base-two system, you need two distinct symbols, or for hexadecimal, you need sixteen distinct symbols. Also, you need to have the idea of a "successor", i.e. in the decimal system, the symbol "2" is the successor of the symbol "1".

In a system that uses the the special symbols 0 and 1 (with their common meaning), 10 is always the encoding for its base.
"common meaning": 0*a = 0, 1*a = a

This system can be used to denote any objects that are enumerable.

In real world terms - visually

Try to imagine a series of objects starting at some point, continuing indefinitely.

For the purposes of this document, I'll use dots:

Zero . . . . . . . . .

Every dot represents a number. naturally, each dot is the successor of the dot to its left.

One way to refer to a dot would be to assign a unique symbol to each dot. As you probably can imagine, without any system, this is going to be extremely cumbersome. Just to be able to count to one thousand, you would have to remember one thousand arbitrary symbols (the Chinese for example prove it's possible, but that's beside the point).

Let's just go with the assumption that it's cumbersome, and provide some shortcut: I'll just replace every fourth dot with a pipe:

Zero . . . | . . . | . . . | .

Now, we have simplified the problem a bit, assuming we can reliably name which pipe we mean, we can name dots relatively to a pipe. For instance, I can say: The second point after pipe X. Or the second point after the third pipe to denote the number fourteen.

However, as numbers get bigger (or speaking visually: we zoom out, we are left with a series of pipes), it's extremely cumbersome to simply count the pipes and then refer to a dot relatively of one such pipe. We apply the same trick. We can replace every fourth pipe with an ampersand:

Zero . . . | . . . | . . . | . . . & . . . | . . . | . . . | . . . & . . .

Now, it becomes easier to specify a certain pipe, we simply say which ampersand we mean. Going from that, we relatively specify the pipe, and going from that, we relatively specify the dot.

This is exactly what the base-notation does. It places these markers on every n-th object, different markers on every n-th marker, etc Thus, there are never n or more of the same markers in sequence.

In this case, we have encode numbers with the base four: 1234 refers to the first ampersand, the second pipe after that, and the third dot after that: The number twenty-seven.

Applying the aforementioned rule, we never need more than four distinct symbols to denote an arbitrary number in base four.

Proof: Let's assume we need more than four distinct symbols. This would imply, that I need to count four or more markers of the same kind from a given position. However, that is never necessary, since I replaced every fourth of these very markers with a different kind, I must be able to skip ahead. Thus, the premise is incorrect: Four distinct symbols are always enough.

share|improve this answer
    
Good explaination of the concept. Too often we (as in the set of programmers) make big assumptions, because we (as individual programmers) know (and understand) what is meant to be said, and therefore leave it unsaid –  Andrew Sep 9 '12 at 10:46
    
@Andrew Thanks. I have added a second part trying to illustrate the concept of bases visually. –  phant0m Sep 9 '12 at 10:59
    
Even better... because this just about illustrates how the Roman's (What have they done for us?) came up with their numbering... One is a I... five Is became an V, two Vs an X Five Xs became an L, two Ls a C etc So in effect, they had a binary, pentary (?) system –  Andrew Sep 9 '12 at 11:07
    
@Andrew A good observation, they even put these "markers" as I called them (I have no idea whether there is any "official" terminology on this matter) explicitly into their numbers, whereas we have the implicitly by position. –  phant0m Sep 9 '12 at 11:26
add comment

Students of The Hitch Hiker's Guide to the Galaxy will recall that the Ultimate Question (Answer: 42) was "What do you get when you multiply 6 by 9"

So, whilst the rebuilt Earth uses Base 10 (decimal) the original Earth used base 13.

This seemingly off-topic prologue is there to illustrate that our concept of numbers is because we use Base 10 (decimal) as a matter of routine. And whilst decimalisation reinforces the 10-ness, this doesn't have to be the case.

And since this is programmers.SE, then binary (true/false) and hexadecimal (byte packing) should be equally widely understood... by that I mean, to me, A(hex) is (nearly) as understandable a concept as 10(dec)

Or more esoterically, in days gone by, before grams and kilograms, we used oz/lb/st and people conceptually "got it" - in fact some of these other measures were more intuitive.

share|improve this answer
    
+1 for the Douglas Adams reference. –  akton Sep 9 '12 at 13:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.