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

Bit, the 21 head creature

In computing, (0 or 1) is called a bit. We can consider bits as the smallest units of matter within a computer. Similar to the Greek idea of atoms, the bit is indivisible. It is something that can be represented physically as an open or closed electrical circuit. In this case, relating it to Boolean variables, when open it has the value False and when closed it has the value True.

It is easier for the computer to represent two symbols than ten symbols. Two symbols can be represented by an open circuit, in which the energy is interrupted or the circuit is closed, in which the energy passes. In computing, we treat this situation as false by 0 and true by 1. It is not possible to assume both states simultaneously. Thus, the bit is either 0 or 1.

Notice in the drawing of the Universal Turing Machine in the first post of this special ago, in particular, the ribbon of zeros and ones. What does that sequence of zeros and ones represent? This is the heart of the matter. You are reading this text right now, you probably notice each symbol (letter), notice the union or grouping of letters in words, separate each word, interpret each word and go right to the end of the line, but in fact, one text is a convention. The arrangement of words, the types of words, everything is a convention so that you can “give your brain a chance” to assign meaning. A text string like “adsdasds ererere gggffdgfdgd errtrtrtr dgfdgdfgfd gfdgfhgfhfghgf cccxcvxvxccv”, although it does follow some rules like using alphabet symbols and white space as a separator, it doesn’t mean anything. There is no meaning to us as readers.

Similarly, the language the computer receives is similar to the bit strings below:

01101100 01100101 01100001 01110010 01101110

01110100 01100101 01100001 01100011 01101000

01100101 01100100 01110101 01100011 01100001 01110100 01100101

There must be a convention (a rule) for how this should be interpreted. What will be discussed in the next section.

Byte, the 28 head creature

We have heard the speech about the 2¹ head creature (the bit) on several occasions, but we don’t really see it when we use computers. Although there is all this charm about the blessed 0’s and 1’s of the computer, they are not visible to most of us (it may even be visible to some computer freaks). On the other hand, there is a slightly more complex bug with which it is already possible to work directly in its format on the machine. The 28 head creature, known in computing as byte.

The sequence of 0’s and 1’s shown at the end of the last section, meant nothing to you, you don’t notice a rule of formation or order, they are absolutely just numbers. However for the computer, such a sequence has “meaning”, it is enough to have a convention or rule about writing the code in the above sequence. We could start by grouping and separating bits into groups of 8 bits to form bytes.

01101100 01100101 01100001 01110010 01101110

01110100 01100101 01100001 01100011 01101000

01100101 01100100 01110101 01100011 01100001 01110100 01100101

Each byte can be read by the computer with the aid of the ASCII code (don’t worry, we’ll talk about this a little later in the text), as a specific character. The decoded message for a human being would be:

learn

teach

educate

Analogously to the bit as an electrical switch, the byte can be perceived as 8 electrical switches connected in parallel. However, while the bit could only represent two options (0 or 1), the byte can represent up to 256 options.

Example circuit for one byte.

In the figure above, although we have different colors for the lamps, what matters to us is that each of the 8 can be on or off (in the case of the figure above, all of them are off because their switches are open). But with that, there are 256 ways to represent these 8 lamps as lit or unlit. We can say that the light out is 0 and the light is 1. So from left to right we have:

00000000
10000000

11111111

no lamp is on

only the first is lit

all lamps are on

Remembering a little combinatorial analysis:

1. For a phase with 2 options, we have 2 ways to occupy it, that is, 21.

2. For two phases with 2 options, we have 2 ways to occupy the first, and for each choice taken, we have two more ways to occupy the second phase. Thus, we have 2.(2¹) possibilities, that is, 2².

3. Similarly, for three phases with 2 options, we have 2 ways to occupy the first, and for each choice taken, we have 2² ways to occupy the other two phases. Thus, we have 2.(2²) possibilities, that is, 2³.

4. For a number n of phases with 2 options, we have 2 ways to occupy the first phase, and for each choice taken, we have 2n-1 ways to occupy the other n-1 phases. Thus, we have 2.(2(n-1)) possibilities, that is, 2n.

In the case of bytes, we have 8 possible phases to be occupied with 2 options each, which gives 2⁸ possibilities, that is, 256. A practical example of the use of these numbers is the color system used by the computer. Many systems use the RGB format, referring to Red, Green and Blue. For each variable R, G, B there is space for one byte. Each byte represents an intensity of R, G or B. The extreme colors (black and white respectively) are represented as {0,0,0} and {255,255,255}.

Deixe um comentário

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