Prior Page     Next Page     This Chapter    Next Chapter






Representing Other Things Inside a Computer

To represent anything inside a computer requires examining it and deciding how to change it into numbers. Then a numeric code must be selected that maps onto the integers as much relationship between the original entities as you can manage. For example if the things you are representing have an natural order then you should probably pick numbers as codes that represents that order. The more of the `natural' relationships that you can map into the code for something, the easier it will be to deal with those relationships in a computer program.

Let us tray a reasonably complex example. Let's say we want to handle pictures inside a machine. One way to do that is to break the picture up into small parts, the number of parts we will call the resolution of the picture. The greater the resolution the more numbers represent the picture. Now we just have to characterize a small part of the picture, let`s call one piece of the picture a pixel. For example a picture could be broken into 100 × 100 pieces arranged in an array.  Each picture element (or pixel) describes its little part of the picture.  At a resolution of 100 × 100 pixels there are a total of 10,000 pixels in the picture. This provides a relatively crude representation of the picture as shown below.


In this picture you should be able to indentify the individual pixels. A better representation would come from 1000 × 1000 resolution digitization. At 1,000 × 1,000 resolution most reasonable size pictures look clear. But one must handle a million pixels in the computer to deal with a single square picture at 1,000 × 1,000 resolution.

On the next page is the whole picture that the 100 × 100 pixel picture above was drawn from. It only has a resolution of 261 × 463 pixels, a but you will find it looks much better, because the 261 pixel width is spread across 2½ inches, giving only about a hundredth of an inch per pixel.  This is about it's orignial size.


This picture, and it's smaller extract, is from a digitized image of the nine of swords from a Tarot card deck. Swords is one of the suits in the Tarot cards; the others are cups, pentacles, and wands. Each suit contains 14 cards: an ace, 2 to 10, page, knight, queen, and king. There is also a 22 card trump suit, which has specialized cards like: the fool, the emperor, death, love, the world, the hanged man, and so on. Thus a Tarot deck has 78 cards. The card shown is from a popular Tarot deck designed by Pamela Coleman Smith. The Tarot cards are generally used to read fortunes.

What characterizes a pixel?  If the picture is black and white like the one above then a single bit will do to characterize each pixel; 0 it is black 1 it is white. If it has intermediate gray values then one could characterize it as a single small integer between say 0 and 15, zero for black and 15 for white, this would require 4 bits for each pixel. Or we could use gray values from 0 to 255, this would give a better representation and require 8 bits for each pixel. How does one pick?  If you can see the breaks between the sixteen different gray values then the picture could exhibit the same deficiency. In that case you want more gray values so that there are no visible breaks. Two-hundred-fifty-six gray values are more than enough, at least for my eyes. Then a picture has to be `digitized', turned into digits, by measuring the gray value for each pixel. The result is an array of small integers representing gray values with the position in the array corresponding to the pixel position in the picture.

For color pictures one must do the same thing, except now the color of the pixel needs to be recorded. Again one can approximate the color by choosing one of 256 colors to represent the color in the pixel, or one could pick a color from some larger set. For color images 256 colors is considered a bit crude, 16,000,000 colors is more than most people can distinguish.  How many bits does it take to represent 16,000,000 colors?  

Digital audio is another example of the same process. Audio is miniture waves traveling through air to our ears. These series of air pressure differences we call sound. If the pressure differences are measured accurately many times a second and represented as numbers then one can record the sound of anything digitally as a series of integers.   The more bits used in the integer and the more rapidly the samples are taken the more accurate is the representation of the sound. A standard audio CD represents music as 8-bit integer pressure differences taken every 41,000 times a second.

Note these problems that we have been dealing with in pictures and sound are characteristic of everything a computer wants to process. Anything one wants to represent from the outside world and process inside a computer requires some numeric coding. The coding can be arbitrary or it can maintain an ordering that exists outside the machine. For example the characters in the character codes are given numbers that represent the usual ordering that one uses with those characters in the real world. This means that comparisons in the machine work the same way comparisons work in the real world. The gray values in pictures are a similar ordering. But sometimes the code values chosen are arbitrary:



What you want to do with the information determines how the code, or digitization, is constructed.

Note that in the end everything that is processed by the computer is represented as numbers; that does not restrict computers to only deal with numbers; what the program does in the machine preserves the meaning of the numeric codes and allows symbol manipulation to happen. If something can be counted then, as we have seen, we can code it. If it is coded as a number, or as bits, then a computer can deal with it in reasonable ways.

This is the universal property of coding information; putting things in one-to-one correspondence with the integers creates a code. One can call a BIT the fundamental information carrier, because it represents the smallest representable choice, on or off, true or false, heads or tails. Bits can easily be made to represent the integers -- so with bits it is easy to create and manipulate codes inside a machine.










Prior Page     Next Page     This Chapter    Next Chapter


Copyright ©1996 Robert Uzgalis. All Rights Reserved.
contact: buz@cs.aukuni.ac.nz