I get that on a CD or DVD, the absence of a pit means a 1 ( or 0, whichever ) and a pit means 0 ( or 1, whichever ). I get that punchcards have holes, which create a negative and offset the presence of smooth paper in an area that COULD have a hold. Smooth can equal 1, absent 0. Fine.
What I have never undertood is how one can write a “line of code” with lots of zero’s and one’s in it that somehow equals a command that says " when I move this tracball in a random fashion I will cause a previously created static icon to float around on the screen area in a fashion that mimics perfectly the movements of the dots on the tracball".
To me, that is a very complex instruction set. ( forget the set that must exist that creates the optical reader in the tracball nest, AND the set that must exist that creates a static icon of a crooked arrow. )
How can a language work that is based solely on a 1 and a 0 ? I’ve been reading up on a fellow whose math laid some of the foundation for early computers and he used ( literally ) a roll of paper that looked like toilet paper. A long spool with squares demarked, and each square had a zero or one, or set thereof.
And?? We use 26 letters in our modern Roman alphabet. Other languages use more or less letters, but the pattern is ( I think its safe to say ) similar all over the planet. We create a set of icons that, when combined, allow us to assign an idea to a set of icons.
I struggle to understand how one can do that with only two icons, instead of a few dozen. Or, even 15 or 18.
The Chinese have thousands of unique symbols while English only has 26 yet both can be used to convey essentially the same information. This is done in english by grouping a set of letters to form a “word” which roughly corresponds to a single symbol in Chinese. Similarly, you can create a “word” of binary which corresponds to a single letter in English. For example, in the ASCII encoding, the “word” 01100001 corresponds to the symbol ‘a’.
This may freak you out even more Cartooniverse, but you can even go one step further than binary: unary, or “base one”.
In this system, you use a sequence of symbols to represent numbers. No positional values, no equivalent of “10s”, “100s” or “1000s”. Think tally marks.
So,
/ is 1 in decimal
// is 2
///// is 5
////////// is 10
etc.
It doesn’t matter how many symbols you have in your alphabet. As Turing (the fellow you mentioned) proved, roughly speaking anything you can do with one computer you can do with any computer, however simple the machine.
It’s a bit like the party game where you’re only allowed to ask “yes/no” questions. Even with just “binary” answers, you can eventually figure out what you need to know.
As to your other point, how all these 1s and 0s translate into high level behavior on your 'puter: the CPU in your computer, the Intel or AMD whatever, knows to recognize pre-agreed sequences of 1s and 0s to do certain things. e.g. if it sees 1001, it might know that that means to send a signal down a certain wire; that wire just happens to be connected to your screen (via your video card) and in response, the screen draws a pixel at a certain position. I’m sure you can see that by building up enough of these, billions and billions, I could cause the computer to, say, render Quake 4 on my screen.
At the end of the day, everything comes down to these pre-agreed series of bits (“op codes”) that the processor understands. Of course, hardly anyone writes in numbers: as humans, we’ve created higher level languages, so the programmer would be more likely to write something like:
if trackball is spun left
then move cursor on screen, based on speed of trackball
This will end up getting translated into a particular sequence of 1s and 0s.
I’ve made some gross oversimplifications here, but I hope it gives you the idea.
This is quite simple. If we have 26 characters that we wish to encode in binary, then we need ceiling(log to the base two 26) bits in binary to encode every element of our character set with a unique binary representation. For example, for the character set {‘a’, ‘b’, ‘c’, ‘d’}, we have ceiling(log 4) = 2 bits. We can therefore assign a unique two bit binary string to each element, e.g. ‘a’ = 00, ‘b’ = 01, ‘c’ = 10, ‘d’ = 11.
The same will be true for any set, even huge ones like Unicode.
Shalmanese has already explained how ones and zeroes can be grouped together to form letters, etc. Even though a single binary digit has only two possibilities, 1 or 0, a pair of them has four possibilities: 00, 01, 10, or 11; a group of three digits has eight possibilities (000, 001, 010, 011, 100, 101, 110, 111); and in general, n binary digits grouped together can have 2[sup]n[/sup] possible states.
Perhaps similarly, complex computer commands can be made up of very simple, basic instructions grouped together, of the form “if this bit is set to 1 and this bit is set to 1, set this other bit to 0.”
Or, consider this. To make the example simpler, suppose you have a black-and-white computer screen. That screen can show a complex image, or a page of text, just by turning some pixels on and some off (or setting some to black and some to white). Then you could let 1 stand for a black pixel and 0 for a white one, read off the 1’s and 0’s going across each row, and viola! a string of ones and zeroes!
Assign each letter of the alphabet a number from 1 to 26. Now, in a text, replace each letter with its associated number.
With a little work, you can easily learn to “read” this number text just as you would normal English text. The number text contains all and exactly the information contained in the English text when read this way. But the numbered text uses only 10 symbols, not 26.
Now convert the numbered text to binary. Still exactly the same info. It can still be read off just as the base-10 numbered text could. Yet this new binary text uses only two symbols, not 10, and certainly not 26.
Does that answer the question you ask at the end of your post?
I forgot to address the first part of your post, namely how one can write a binary string that makes a computer exhibit complex behaviour.
The answer is, well, mainly you don’t (at least not any more). Processors understand some very simple instruction that may be encoded as a binary string. These instructions may be combined together to create, although still relatively simple instructions, more complicated ones. These instructions can then be translated by a program into the instructions that the processor understands. Of course, it’s perfectly possible to do the same thing again, building more complicated constructs and instructions on top of these building blocks.
Eventually, you end up with modern high level programming languages that are able to express operations in one line that may take pages and pages of the corresponding binary instructions to represent.
So, a programmer writes a program in his high level language, and this gets reduced (compiled) to a simpler form, that may get reduced again and again until we end up with something that the processor can understand.
i.e.
5 + 2; -> mov 5 a; mov 2 b; add a b c; mov c a; > and so on.
To build on what Shalmanese said, your “word” of binary (say, a 32-bit word) can also represent an instruction that tells a computer to perform some basic operation. For example, “add what’s in register a to what’s in register b and put the result in register a,” or “store what’s in register a at the specified address in the computer’s memory.” How the computer’s hardware executes those instructions, I’ll leave it to a computer engineer to answer. There can be many of these instructions in a computer’s instruction set.
High-level languages (such as Ada, FORTRAN or C++) are what almost all programmers use to write programs. Each language has it’s own set of keywords that allow the programmer to make things happen. Some of the basics are decision statements (if-then-else) loops (do while) and assignment (x = 3.997). A programmer writes programs using these “english-y” languages, and then runs the program through a tool called a compiler, which translates the high-level program into a set of computer instructions (binary “words”).
This is an extremely simplified and incomplete explanation, but it’s a start. Hopefully someone smarter and more articulate than me will come along to elaborate!
Related (albeit obliquely) the OP’s question “how can a 1 and a 0 = a command, or idea?” is the concept that when using position value, a single bit can represent a theoretically unlimited amount of information.
Consider a tiny mark on a rod. If the mark is exactly 3/10s of the total length of the rod from one end (and so 7/10s from the other), the mark could be said to represent “.3”. If the mark was a little bit further along and we could measure its proportional position with sufficient precision, it could represent “.347” or even “.3475982203” etc. We could do this with any base we cared to use, thus representing any numeric string we want.
So, with an agreed upon encoding and ignoring subatomic space-time uncertainty principle limitations (!), we could pack the library of congress into a single mark on a rod.
As other people have suggested, the basic answer is that (a) it takes an AWFUL lot of 1s and 0s, and that (b) finding clever way to encode more and more ‘abstract’ and complicated information and processes into digital terms is something that a lot of clever people have worked for a long time. Basically, you need to break down the abstractions more and more until they become concrete details that can be mapped into finite result spaces.
A few examples of machine language instructions might make clear how programs can be written in terms of 0’s and 1’s… at least, it was helpful for me. All of these examples are not based on any specific real machine language instruction set.
01101011001000001001011001010110 might encode the instruction ‘load from memory address 38486 into register 25’, where the instruction can be broken up into parts as follows:
011010 = op 26, ‘load from memory immediate’
11001 = register 25
00000 = register 0 (not used)
1001011001010110 = 38486
There are similar op codes for saving from processor registers into RAM, performing mathematical and logical operations on register values, branching and jumping to different locations in the program. IIRC, these basic operations are all that is really necessary to build very complicated software, along with the notion that the various peripherals (keyboard, mouse, screen) will also be reading information from RAM memory or putting new data in there.
I’ll agree that this shows that an arbitrary amount of information can be encoded by a single rational number, or something that can be mapped to it, such as a mark on a stick in a non-heisenberg universe with infinite precision available to note the mark and measure it correctly.
That’s a very different notion from “a single bit” though. A single bit cannot encode a rational number. In fact, you’ve just proved that no finite number of bits can. A bit can encode 1 or 0, or one of two other alternatives.
And I don’t see what ‘position value’ has to do with it.
The way you put it, the mark on the rod would represent one piece of information. (for instance .3 or .347598). Once you decided which information it represents, you can’t add information without obliterating the previous information. So, if you mark both .3 and .347598 the meaning of the rod is lost. To represent two numbers .3 for example, you’d have to add another mark which indicated “2 times” the next (or previous) mark. And that additional mark would make it impossible to add another value.
In other words: the way you described it, the rod contains “potentially” infinite meaning (any library you care to mention) but once you collapse the wave function, it will contain only one explicit meaning.
Yeah, but how much space would the encoding scheme occupy? It’s not really that space-efficient to say that this mark stores the entire LoC according to the scheme of ‘1’=[insert LoC].
Actually, CD encoding is much more fiendishly complex than that, but to go into it here would be cruel.
Let’s take your example. If you open up a mechanical, wired mouse, it has three wheels, two oriented orthogonally to each other, and a diagonal spring-loaded one that keeps the trakball pressed up against the other two. as the ball spins, the two orthogonally-oriented wheels spin proportionally to the component vectors of the motion of the ball. The speed of their rotation is measured (I’m not sure, but I suspect the number of rotations is measured against some internal clock), and the information is sent to the computer, which translates it, moment by moment, into a set of screen coordinates.
This set of coordinates is interpreted as the location on screen at which the upper left hand corner of an array of pixels (each of whose color and brightness has been carefully set so that together they represent a crooked arrow) should be drawn. This information is plugged into a much larger set of data that describes how every pixel on the screen should look, based on what windows and toolbars are open, where the mouse is, and what should be visible “behind” them. This data is sent to the monitor, and the pixels appear on screen, at whatever speed the screen refresh rate is, with the mouse in a new position each time. It’s essentially an interactive animated cartoon.
Now, at its base level, the computer can only carry out very simple functions, such as “transfer this informaton from here to there”, or “combine these two pieces of information according to this rule”. etc., so the algorithms of which of these commands have to be done in what order in order to get the result you want have to be worked out well in advance. Some of them are so routine, that we can assign them code words, and simply use the code words to make a whole raft of these sequences perform, once the code words have been translated into the correct sequence of computer commands.
Well, with just “a” 1 and “a” 0 you can’t do too much. The reason ones and zeros are used is because the hardware of a computer is really just a set of electronically controlled switches (I’ll call them bits) that are constantly turning one another on and off in various combinations. You build your computer system so that each combination place your machinery in some state, whether it’s calculating, placing a pixel on screen or printing part of a document.
So a 1 or 0 represents a certain state of a particular bit. So I could assign that bit to represent one of two options. Put two bits together, and the various combination of on and off for both give me four things I can represent. Each bit I add doubles my options. For instance, I could make them represent the digits 0 through 3, either according to binary notation from mathematics, or some other scheme. So I can represent any number I want to if I have enough bits to create enough combinations to assign all the values to.
I mentioned already that the computer can carry out a set of basic instructions. Each of these is numbered, so I can set things up so that if a certain combination of bit values is presented to the chip, it will carry out a particular command. If I want the instructions to be performed on numerical data, I can use the bits to store that as well.
Text? Remember the old “A=1, B=2” cipher? Extend that to include both capital and lower case letters, digits, punctuation, symbols, tabs, spaces, and commands like “new line”, and you have the ASCII set, which needs 7 bits to represent all that. Extend the number of bits to 16 and you can do Unicode, which has a number for almost every written character ever concieved by man.
Sounds like a Turing or a Post machine.
Turing showed that you could perform any calculation using such a device, which only has the ability to move the paper tape back and forth, and make or read/remove a mark on the paper.
Later it was proven mathematically that a multi-track Turing machine (which is essentially what a computer is a physical model of) performed no better than a Turing Machine.
A computer is, in fact, a Universal Turing Machine. That is, one whose input is a description of a particular variety of Turing Machine along with input typical of that machine. Its output is the expected responsive behavior of that machine.
A pocket calculator is a Turing machine. I can create a description of a calculator, load it into a UTM (computer), provide input of the sort I would give a calculator, and its response is that of a calculator. That’s why your OS’s calculator works like a calculator.
One example, using five bits:
00001 = A
00010 = B
00011 = C
00100 = D
00101 = E
00110 = F
00111 = G
01000 = H
01001 = I
01010 = J
01011 = K
01100 = L
01101 = M
01110 = N
01111 = O
10000 = P
10001 = Q
10010 = R
10011 = S
10100 = T
10101 = U
10110 = V
10111 = W
11000 = X
11001 = Y
11010 = Z
And I still have six combinations of one’s and zeros I could assign to other things, like basic punctuation:
Okay, I think the idea is that you set up a fairly simple way to express multiple pieces of information as digital sequences. For instance, as many integers from 0 to 999,999 as required.
For instance - 54, 8342, 2, 536, 8, and 154834 would be
0.00054008342000002000536000008154834
When measuring the notch, you could easily tell how many numbers are on it and when the 0s start. For multiple values that could be arbitrarily large, you’d have problems, but then, those are hard to represent in computer memory too. There are ways of encoding digital strings to get around that problem.
dwalin: does my example answer you’re question? The mark doesn’t represent 1 (and thus is not a single bit.) It represents a huge decimal number like the one I posted above, or significantly longer.
No it can’t. In this sort of pursuit, the length of an encoding of information is the length of the string representing the information plus the length of the decoder that interprets it. In order to get the entire LoC out of a mark on a rod, you’re going to need a decoder longer than 0 bits.
Yeah, it isn’t the “bit” that encodes all that information, but the position of the “bit.”
The general idea is valid, though (theoretically, but certainly not practically): you can represent a whole bookful or computerful or libraryful of information as an arbitrarily long string of digits (using some sort of character-to-number code, like ASCII). This string of digits would then correspond to a unique real number between 0 and 1 (just stick a decimal point in front of it), which would correspond to a unique position on the rod.
Even more, I would say that a ‘bit’ cannot have a position in that sense. A ‘tiny little mark’ or ‘notch’ can have a position in this way, but a bit can’t, and we shouldn’t start playing fast and loose with the definition of ‘a bit’ or this entire conversation might well spontaneously implode. (If it hasn’t done so already. )
He didn’t. He showed that any algorithm that was computable was computable by a Turing machine, but the definition of computable is only an appeal to intuition. This is different to saying that any calculation can be calculated by a Turing machine, as there exists functions that are uncomputable, for instance the Busy Beaver function grows faster than any computable function.
Well, yes, but so-called “base one” is really just a different sort of base 2, since you still need at least two symbols. You’ve got your tally marks, and you’ve got whatever separates sets of tally marks from each other. With only the tally marks, you could only ever relay one number, and the person receiving your message wouldn’t even know when you’d finished sending it.