Creatures of X^n heads (part 2/5)

The eye of the dragon

The concepts seen above may seem complex, as well as the reason why the computer operates with binary numbers instead of the decimal system. However, we must remember that the computer is a machine, it does not operate like humans, from the actions of the imaginary. Its operations are physical, it needs to somehow assign in its open or closed circuits (0’s or 1’s) those corresponding to the values and carry out a movement of these circuits electronically so that it reaches the corresponding value.

We can associate the operational functioning of the computer in a similar way to a Roman abacus. In the abacus, we assign decimal values to the rows of accounts (thousandth, hundredth, tenth, unit, ten, hundred, thousand, tens of thousands …). Then within the corresponding decimal rows we can perform mathematical operations, such as 35 + 357.

1. First we set the abacus to one of the values ​​(35 or 357), in this case, we chose to set it to 35, so we moved 3 beads to the tens row and 5 beads to the units row.

2. Then we add 7 accounts in the unit row, but as it has only 5 more accounts to be moved, we moved the 5 (with 2 still missing), with the 10 accounts moved, this represents that the total value gained another ten, thus we moved the 10 beads back to their original position, moved one row in the tens row, and moved the remaining two beads in the row of units to add the 7.

3. Solved the operation with the units, now we try to operate with the tens. Of its ten accounts in the row, 4 are already displaced (3 originally and 1 resulting from the 10 generated in operation 5 + 7 in the unit row). Then, we shifted 5 more accounts from the tens row, leaving it with 9 shifted accounts. As this row does not yet have 10 displaced accounts, we have nothing to do and we move on to the next row.

4. In this case, the hundreds row has no displaced account (since 35 is less than 100), so we moved the 3 accounts equivalent to the hundred number 357, causing the hundreds row now to have 3 displaced accounts. As the row still has less than 10 displaced accounts, we need do nothing.

5. With no further operations to be performed, we read the result from the largest decimal place to the smallest, that is, 300 + 90 + 2 = 392.

Realize that this whole process was a mechanical action and that the abacus was developed specifically to operate correctly in our decimal system. To better understand the mechanical operation of the abacus, we will perform this same operation (35 + 357) on a “special abacus” with N rows, each with only two accounts. First, we need to understand how the rows of this abacus work. If we move the two accounts in one row, similar to the Roman abacus, we must move one account in the next row, roll back all accounts in the current row and continue the operation. Thus tracing the corresponding ones to our decimal system each isolated row can be valid respectively:

1st row → 0 or 1.

2nd row → 0 or 2.

3rd row → 0 or 4.

4th row → 0 or 8.

5th row → 0 or 16.

6th row → 0 or 32.

7th row → 0 or 64.

8th row → 0 or 128.

9th row → 0 or 256.

Thus, to describe the number 35 in this special abacus, we need to: move an account in the 6th row (so the abacus will register the number 32); move an account in the 2nd row (so the abacus will register the number 32 + 2); move an account in the 1st row (so the abacus will register the number 32 + 2 + 1).

Similar to the Roman abacus, we now add it to the 357, which in this special abacus would be written as 256 + 64 + 32 + 4 + 1 (9th row with 1 bead, 7th row with 1 bead, 6th row with 1 bead, 3rd row with 1 bead, 1st row with 1 bead). So, we can start the operation:

1. The first row has 2 accounts, so we go back and move an account in the second row.

2. The second row has 2 beads, so we roll it back and move an account to the third row.

3. The third row has 2 accounts, so we move it back and move one account to the fourth row.

4. The fourth row has only one account, so we do nothing and move forward.

5. The fifth row has no misplaced accounts, so we do nothing and move forward.

6. The sixth row has 2 beads, so we roll it back and move an account to the seventh row.

7. The seventh row has 2 beads, so we roll it back and move an account to the eighth row.

8. The eighth row has only one account, so we do nothing and move forward.

9. The ninth row has only one account, so we do nothing.

10. As there are no more accounts after this row, we close the transaction and read the result: 256 + 128 + 0 + 0 + 0 + 8 + 0 + 0 + 0 = 392.

Note that despite the apparent complexity, the way these accounts were operated involved only physical representations and mechanical processes. The computer operates in a similar way, but instead of using fingers to move the bills, it uses electricity to open (0) and close circuits (1).

But even though the computer in these operations is much faster than humans, it is limited to this numerical representation. Having extreme difficulty in carrying out more abstract operations that we are used to. One of these difficulties involves the conversion of bases, and for this reason it is preferable that it operates within the binary base.

It may not seem like it, but computers are complex calculators with certain problems when making some calculations. They are excellent with calculations in base 2, but some numbers that for us are simple, for the computer can be very difficult to represent in base 2, for example 0,2.

The computer simply cannot treat it as an exact number and this has a peculiar consequence when we ask you to calculate the result below.

1 – 0,2 – 0,2 – 0,2 – 0,2 – 0,2

A child who has learned to do math with commas, or who interprets this operation as if it were 1 dollar minus 20 cents minus 20 cents minus 20 cents minus 20 cents minus 20 cents, would know that the final answer is 0. E 0 multiplied by should be 0. But when I perform this same operation in software R, a renowned statistical software (other math software would also present this same result), I find that the answer is 5,551115.

Example of this operation in the R software

But why is this? Did we find a fail in the Matrix? And if this error is known, why doesn’t anyone fix it? The answer is a little more complicated than just fixing the code. The computer as a whole works with the information in the form of 0’s and 1’s, and its operations are performed in this way (as shown previously with the special abacus example). Unfortunately, in our numerical systems we perform operations of difficult physical and mechanical representation with an open and closed circuit system and much more complex than those that a computer uses.

The computer, although it seems limited, has the advantage of being extremely fast and storing a lot of information. Thus, an operation that we cannot even imagine as processes of “calculations” (for example, playing a video, playing a game, playing a song), the computer is able to perform with such ease compared to performing some operations considered to us “relatively simple ”, how to operate Irrational numbers (for example, square roots of prime numbers).

Even the simple representation of the number 0,2 (in the decimal system), is an expression of infinite terms when we use the binary system, and computers do not get along with abstract concepts like expressions of infinite terms. Even with the idea of irrational numbers, computers make a salad to work with them. Thus, the number 0,2 appears to the computer as a number of infinite terms in base 2, and when operating it, it opts for rounding. It tries to minimize the error as much as possible to arrive at the exact answer, so much so that the answer found is very close to 0, something in the range of 0,000000000000000005. But although it is close to 0, it is still not 0. And therefore, when we multiply by something very large, it gives a number very different from 0.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *