Put slightly more mathematically, the following version tells exactly the same story.
Groups of 10000
Groups of 1000
Groups of 100
Groups of 10
Ones
104
103
102
101
1s
The fact that our way of doing arithmeticuses ten digits (0 to 9); andeach column counts groups ten times bigger than those counted in the column to its right;leads to it being called a base 10 arithmetic, or a decimal system, from the Latin decima meaning ‘a tenth’.Using base 10, we can count to, and write down, any number we want.Exercise 3Computer scientists sometimes use an octal (base 8) system? What digits would we need for that and what would the columns represent?To start with, we need only the first eight digits, 0 to 7, so we can discard 8 and 9.The first column will count units as before. Each new column will count groups eight times the size of the groups counted by the column immediately to its right. So the table would look like this:
Groups of 4096
Groups of 512
Groups of 64
Groups of 8
Ones
84
83
82
81
1s
3.8 How computers work with numbersToday's mass media wrap computers in a damaging myth. The message of TV thrillers seems to be that computers are inscrutable, subtle devices, far beyond the ordinary person's comprehension. Only spectacularly gifted, young, ‘cool’ people seem to be capable of working with them successfully. For such individuals, a few clicks on the keyboard work miracles. The myth suggests that when we less gifted mortals use a computer and something goes wrong, it's our fault. We're simply too stupid for the machine. Figure 8 probably sums up many people's view of working with computers.Of course, there is a tiny core of truth to this myth. The computer that sits on your desk is the result of 60 years of innovation and research. Its hardware – the electronic circuits that make it work – is a masterpiece of engineering skill. But in other ways, the media fiction turns the facts upside down. Far from being immensely complex machines, in many ways computers are very simple. Some of the problems in working with them come from poorly designed software. However, most difficulties arise not from our stupidity when faced with the computer's intricacy. They come from the difficulty of lowering our subtle human intelligences to the very basic level of the machine.I've already stated that the computer's world is one of numbers. There are no sights and smells, no love and hate, no complex relationships, hopes and fears. Just numbers. But what kind of numbers? I have just looked at how we handle numbers. However, as you may already know, computers use a different system.The inner world of the computer is impoverished in many ways, and when it comes to numbers this is spectacularly true. In contrast to our system of ten digits, a computer uses only two digits, 0 and 1. These correspond to tiny differences in voltage in the computer's electronic memory. Now let's use the ideas from the decimal and octal systems to consider how an arithmetic based on only two digits might work.With only two digits to play with, simple counting doesn't get us very far. We can count from zero to one and then we've run out of digits. Clearly, we have to follow the strategy of the decimal system and create a new column. But we can't have a column to count groups of ten, as we do in base 10 arithmetic. We can only have the digits to count as far as one, so we will have to make our new column count groups of two. Therefore, in this new system the number1represents one, and the number10is not ten but two: one group of two plus zero. So the number11represents three in this new system: one group of two plus one. Now we've run out of columns and digits again, and we will have to make another column. Since we have got as far as three, the next column will have to count groups of four. So the number100represents four, one group of four, plus no groups of two plus zero.Exercise 4What is the decimal number represented by the following numbers in the new system?1011115 ( one group of four, plus no groups of two plus one).7 ( one group of four, plus one group of two plus one).Exercise 5What decimal numbers will be represented by columns 4, 5 and 6 in the new system?Column 4 represents a group of eight.Column 5 represents a group of sixteen.Column 6 represents a group of thirty-two.Again you should be able to see a pattern. Each column counts groups that are two times bigger than groups counted in the column immediately to its right, as shown below.
Groups of 32
Groups of 16
Groups of 8
Groups of 4
Groups of 2
Ones
2×2×2×2×2×1 (25)
2×2×2×2×1 (24)
2×2×2×1 (23)
2×2×1 (22)
2×1 (21)
1s
Exercise 6What is the decimal equivalent of the following numbers in the new system?1010011101000110001011041209278Given that our own system of arithmetic based on the digits 0 to 9 is called a base 10 system, it follows that the system I've just been discussing is a base 2 system, usually called the binary system, from the Latin binarius meaning ‘two by two’.Obviously, it takes much more space to represent a number in a binary, rather than a decimal, system. This doesn't matter to a computer, though, since space is unimportant in its digital world. And cleverly designed software means that nowadays even computer scientists rarely have to work directly with binary numbers.3.9 A few more termsJust to round off this description of the interior of the digital world, let me introduce and define a few more terms that you will come across again in this course and in any future studies of computers. Specifically, you may have heard the terms bits, bytes and words used in connection with computers. Now that we have taken a look at the binary system that underlies computer arithmetic, you will find there is no mystery in any of these three terms.The word Bit is short for binary digit and refers to a 1 or a 0 stored in the computer. Since all computers have some limit to the size of their memory there are only so many bits that a particular computer can store.A byte is a group of a certain number of bits, usually eight. Now, if we take the eight bits together, and represent a byte pictorially, it will look like this:
bit 8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
Recall that each bit, or binary digit, can be either 1 or 0. This means we can think of the byte as representing a binary number. Therefore the largest number we can store in the eight bits of a byte is:
bit 8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
1
1
1
1
1
1
1
1
And the smallest number is:
bit 8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
0
0
0
0
0
0
0
0
Exercise 7What do the binary numbers 0000000 and 11111111 represent in decimal?00000000 = decimal 011111111 = decimal 255 (one group of 128, plus one group of sixty-four, plus one group of thirty-two, plus one group of sixteen, plus one group of eight, plus one group of four, plus one group of two plus one)A word is generally a group of four bytes. It is the largest data object a particular computer can process in a single operation.In the scheme we have discussed, a word is 32 bits (4×8), so the largest binary number that a computer using a four-byte word can process in a single operation would be11111111111111111111111111111111which is decimal 4,294,967,295. (In fact computers can handle much larger numbers than this, but need extra software support to do so.You will probably have noticed that the size of your computer's memory and hard drive is measured in bytes. But memories are so large now that it is impractical to count single bytes. A few years ago, memory size was usually rated in kilobytes (KBs), that is, thousands of bytes. Now it is measured in megabytes (MBs) – millions of bytes, or even gigabytes (GBs) – thousands of millions of bytes). The computer on which I am writing this course has a memory of 512MB, or 512 million bytes. Drive sizes are even larger, so a typical hard drive will now hold 80–100GB, 80–100 thousand million bytes.But beware. There is confusion here. When computer scientists talk about a kilobyte, or a kilo- anything, they don't strictly mean one thousand. A computer kilo- is actually 1024 and a computer mega- is 1,048,576.SAQ 5Why do you think computer scientists use these strange values, rather than a simple 1,000 and 1,000,000?Because they think in binary terms. The binary number 10000000000 (210or decimal 1024) is close to a thousand and binary 100000000000000000000 (220or decimal 1,048,576) is close to a million.There is little consistency about this, though. Nowadays computer manufacturers may just as often use the world ‘kilo’ to mean a thousand of something as to mean 1024 of something. However, when you are offered a job in the computer industry at 40K, do remember to insist that your salary should be £40,960!3.10 A final word – analogue and digital worldsSo there we have it. On the one hand is our world, an analogue world – a world of light and sound, of taste and touch. On the other side of the boundary is the computer's digital world – a bleak world of binary numbers.Before I leave the topic, though, I should point out that some of the points I've made may be controversial.For a start, it's not entirely clear whether the world we inhabit is fundamentally analogue. Quantum theory tells us, for instance, that quantities like light are made up of tiny packets (quanta) of energy. This means that the intensity of a source of light may not vary continuously, but will go up or down in discrete (quantum) steps. Some theories suggest that forces like gravity, and even space itself, may be made up of tiny quanta.Nor is it certain whether the human brain is an analogue or a digital device. Certainly, the brain is quite different in structure and function from a digital machine. Lazy comparisons between the human mind and a computer are completely misleading. However, there is still argument about whether, at some level, the brain functions like a digital device.These are all esoteric debates, though, and beyond the scope of this course. Let's now return to our main theme and cross the boundary.3.11 SummaryIn this section I examined the terms analogue, discrete and digital and illustrated their correct use through examples and brief definitions.I raised the familiar idea of the five human senses which enable us to perceive our analogue world.Finally I focused on the digital world of counting and representing numbers, and in particular the binary system used in the inner world of the computer.4 Crossing the boundary4.1 Mere numbers?If I could write the beauty of your eyesAnd in fresh numbers number all your gracesThe age to come would say, This poet lies’.(Shakespeare, Sonnet 17)As you learned in the region inside the boundary, the computer world, is completely digital – a world of numbers. So taking features of our analogue experience across the boundary into a computer must mean somehow reducing or transforming these features into numbers. In this section I aim to show: how, despite the fears of the poet Blake (see Figure 9), various types of analogue item can all be reduced to numbers and stored inside the boundary in a computer's memory.You now know that computers handle numbers in binary form, but to write them in binary here would be agonisingly tedious, and would not add to our understanding. So, from now on, whenever I refer to a specific number in a computer's memory, I shall use its decimal equivalent.4.2 TextAs I said in the human perceptual system is very strongly based on vision and hearing. When we think, we usually do so in terms of pictures and, perhaps to a lesser extent, spoken words and sounds. However, the simplest place to start thinking about how we can reduce human experience to numbers is with a very advanced human concept: written text.4.2.1 Reducing and processing textYou are familiar with the idea of a word processor. Although I grew up long before the era of word processing, it's now difficult for me to imagine how I ever lived without one. Word processors enable us to enter text into the computer, edit and fiddle about with it, store it and then print it out when we are satisfied with the result. That's exactly what's happening as I write this course. But, if the text spends time inside the computer before being returned to print, that must mean it exists there in the form of numbers. It's inside the boundary. How can text be made into numbers?Let's use the following famous line from Shakespeare as an example:Rough winds do shake the darling buds of May(Sonnet 18)This presents no problem to the human eye. We read it straight off. Actually the process by which we read, recognise, understand, combine and understand textual symbols is complex and not fully understood – but that's another course.Exercise 8How do you think this line could be transformed into numbers?You may have been thinking along the following lines. Pick one number to represent each letter – 1 for ‘a’, 2 for ‘b’, …, – and then simply substitute the number for that letter in the line.I did say earlier that the computer world is a simple world, and transforming text into numbers is as straightforward as that. First, we assign a unique number to each letter in the alphabet. Each letter in the text now becomes a number inside the computer. I'm going to make the following choices:
letter
a
b
c
d
e
f
g
h
i
j
k
l
m
number
97
98
99
100
101
102
103
104
105
106
107
108
109
letter
n
o
P
q
r
s
t
u
V
w
X
y
z
number
110
111
112
113
114
115
116
117
118
119
120
121
122
These choices probably seem fairly arbitrary, but let's stick with them for the moment. Now if I simply substitute each letter with the number I've chosen for it, our line for will look like this inside the computer (the breaks to a new row have no significance):
114
111
117
103
104
119
105
110
100
115
100
111
115
104
97
107
101
116
104
101
100
97
114
108
105
110
103
98
117
100
115
111
102
109
97
121
It looks as if the problem of converting text into numbers has been solved.SAQ 6Before going on, do you think the above table is a complete representation of the line of poetry?Not quite, unfortunately. If I instruct the computer to translate what I've given it back into text, I'll seeroughwindsdoshakethedarlingbudsofmayI forgot that there are spaces between the words, probably because I didn't even notice them. Moreover, the first letter of the line should be a capital and so should the first letter of the proper name ‘May’.But a computer doesn't know anything about words or the spaces between them, still less about the months of the year. We need more numbers to solve this problem. Let's allocate a new number, 32, to represent a space. However, the problem of capital letters is more serious. There is no easy way of instructing the machine that V and ‘R’ are different forms of the same letter. Nor could we possibly tell it anything about the first letters of poetic lines. Our only option is to allocate a whole set of new numbers to the upper-case (capital) versions of every letter. Let's set aside 82 to represent a capital ‘R’ and 77 for a capital W. Now, if I use this enhanced way of representing characters as numbers and peer into the memory of the computer, our line of poetry becomes:
82
111
117
103
104
32
119
105
110
100
115
32
100
111
32
115
104
97
107
101
32
116
104
101
32
100
97
114
108
105
110
103
32
98
117
100
32
115
111
32
77
97
121
This is now a better representation of the text. The example illustrates that unique numbers are needed, not simply for all the upper- and lower-case letters and for spaces, but also for characters that we might not think of straight away. These include mathematical symbols (e.g. > (greater than), < (less than) and ≠ (not equal to)) and accented letters found in foreign words (e.g. é, è, c and ö). This is why computer scientists usually refer to characters, rather than letters, when discussing text. All in all, then, a great many numbers will have to be assigned to representing text.4.2.2 StandardsRepresentations must be agreed if they are to be shared. If different computers used different numbers to encode the same character, people would not be able to read each other's documents. There have to be standards. There are countless computer standards, covering every aspect of information technology, from music and picture encoding to programming language design. And, as you would expect, there are standards which apply to character encoding. You may have wondered why I chose such apparently random numbers to stand for the characters I needed. I didn't. I simply chose numbers that have already been agreed in the Unicode standard for character representation. Unicode is a development of an earlier standard, ASCII (American Standard Code for Information Interchange) which was approved in 1967.ASCII set aside 128 numbers, from 0 to 127, for upper and lower-case alphabetic characters, punctuation marks and some ‘invisible’ characters, such as a carriage return (start a new line) and a tab.Unicode, work on which began in 1987, preserves the ASCII numbers, but hugely expands the set of numbers available to 65,536. These are intended to be used roughly as follows:8192 numbers for representing characters in the world's main languages, including Hebrew and Sanskrit;4096 for punctuation marks, graphics and special symbols;5632 for developers to define their own symbols;27,000 or so for Han Chinese characters;the remainder for characters yet to be invented.SAQ 7Why do you think ASCII supported exactly 128 numbers and Unicode exactly 65,536?As you might have guessed, the answer lies in the binary. The binary numbers 0000000 to 1111111 (0–127) can be stored in 7 bits. The numbers 0–65,535 can be stored in 16 bits (two bytes).4.2.3 Text capture devicesPractically, how can we take text across the boundary?SAQ 8What are the main devices for transforming text into digital form inside the computer?The most obvious device we have at hand is our friend (or enemy) the keyboard. Other devices include scanners (which produce an image of a page) and optical character recognisers (OCRs). OCRs are now often built into scanners.4.2.4 KeyboardsEvery computer comes with a keyboard. They are still the main way of taking text across the boundary into the computer. The one I'm using to type this course has 109 keys. Under each key is a pressure sensor that detects when the key has been pressed and sends an electronic signal into the computer. There, a small program called the BIOS (Basic Input/Output System) translates the signal into the appropriate numeric code. Other software stores that code in a suitable place in the memory.Exercise 9List some of the drawbacks of keyboards.Few people actually like using keyboards.There has been concern recently about the damage they can cause to long-term users in the form of repetitive strain injury (RSI).It takes special training to get the best out of them.A keyboard is a pretty inefficient way of getting text into a computer. It is limited by the speed of its operator, and humans are slow and clunky compared with electronic machines. Computers have a phenomenal capacity to store information. A typical hard disk could store hundreds of full-length novels and encyclopaedias. But who is going to type all these in? And how long would it take?4.2.5 Scanners and OCRsA better solution is to get some electronic help. A page of text is placed in a scanner, which produces an image of the page using techniques that I will discuss shortly. The image is passed to a computer program called an optical character recogniser (OCR), which detects each letter on the page in turn and transforms it into its digital code. This recognition is an immensely difficult task, requiring very sophisticated software, so OCRs are generally only partially effective.SAQ 9Why do you think recognising characters is such a difficult task for a machine?Because the same character can be presented in many different forms.We need to remember that computers are very simple-minded devices. We have no difficulty in recognising thatare all the same character. But a computer will interpret two images with even the smallest difference between them as completely separate things. Clever software has to be devised to tackle this problem.4.3 Graphics and video: imagesVision is far and away humankind's most dominant sense. Every sighted person lives their entire waking (and dreaming) life at the centre of a visual field, a sphere of light, shade, colour, form and movement. Painters down the ages have tried to capture the essence of our visual life, as in the beautiful painting in Figure 10.The theme of this painting seems not so much the young woman toying with her musical instrument as the light itself, slanting down across the room, illuminating her face, and casting deep shadows in the folds of her dress. How could we take that across the boundary? How could such a scene possibly be transformed into mere numbers?One clue might come from looking at how other painters have tackled the problem of portraying light and colour. The scene in Figure 11 looks quite different from Vermeer's gentle radiance. It has a grainy appearance, as if the light fell in patches of raw colour. Signac, and other artists of the pointillist school to which he belonged, chose to paint in this way because they had particular theories about the nature of light.The point is that Vermeer's vision of light is essentially smooth and analogue; Signac's is blotchy, disconnected, and discrete. So, perhaps if we want to reduce a picture to numbers, we must divide it up in some way, as Signac has done.4.4 Introducing pixelsLet's try a simple example. I'm going to take an image, divide it into discrete parts and then transform the result into numbers. I shall use the simple picture of a church shown in Figure 12(a). The process will be exactly the same, whatever image we use.Signac laid down his paint with an artist's hand and eye. I will have to work more systematically. The first thing to do is place a border around the picture, as in Figure 12(b), to indicate the area I'm interested in. Anything outside the border will not be part of the capture.Next I'll divide the picture up by laying down a grid of equal-sized squares over it, as in Figure 13. I'll enlarge the original slightly so you can see clearly what is going on.I can now examine each square of Figure 13. If it contains just the background colour (light grey, in this case) I'll just fill the square with white. If it contains any other image colour (mauve), then I'll colour it black. Looking at the grid, you can see that some squares contain both background and image colour. In such cases I will colour a square black if roughly a third or more of it is image colour, white otherwise. There is no need at this stage to try to be too precise. The resulting image, shown in Figure 14, is rather crude, but at least recognisable.You might like to start thinking about how we might improve the image, but we are not quite ready for this yet. We still haven't reached our goal of transforming the picture into numbers. Let's take the final step. For each square on the image, I will assign the number 0 to it if it is coloured white and 1 if it is coloured black. I call this mapping the square's colour to a number. This gives the following pattern:You might be tempted to look on this as one horrendously long binary number, but it's more accurate to see it as a set of 31×22 separate numbers. Since each number is only either 0 or 1, and computers use bits to store 0s and Is, this sort of encoding is usually referred to as a bitmap. Each square that we have mapped to a 0 or a 1 is called a pixel (short for picture element).As I've noted already, Figure 14 is hardly a very satisfactory image – a long way from Vermeer. It has a very crude appearance, with the diagonal lines, in particular, looking jagged and unrealistic. We need to improve the quality.4.5 ResolutionSAQ 10What do you think could be done to improve the quality of the image?One obvious way is to increase the number of squares and to make each square smaller.Suppose we double the number of the gridlines in each direction, making each pixel one quarter the size of the ones in Figure 13. This is called increasing the resolution of the picture. The new grid is shown in Figure 15.Now if I again map each square to a black or white pixel, I get the image shown in Figure 16.This is still a bit ragged, but an improvement. It's easy to see that if we go on and on increasing the resolution of the picture, making the pixel size smaller and smaller, we will move closer and closer to an image that appears completely smooth. But note that we can never reach a perfectly smooth image by this process – to do this one would need infinitely small pixels. We can never reach an analogue representation by digital means, only approximate to it.Exercise 10Work out how many bits would be needed to store the image in Figure 16. How many bytes?The image is 62 pixels wide by 44 pixels high, so we need 2728 bits to store it. As you will remember, there are 8 bits in a byte, so we will need 341 bytes to store this very simple image.I will return to the issue of storage size later. But at the moment there is still a lot missing. This bitmap approach may be all right for simple images consisting of a few lines and some filled areas, but it will not be adequate for anything rather more subtle, such as the (still fairly modest) little pictures in Figure 17.SAQ 11Why is the simple strategy used above not satisfactory for the pictures in Figure 17?The most obvious point is that we have as yet no way of handling colour. Slightly less obvious, but just as important, is that plain black and white won't allow us to represent subtleties of light and shade shown on the picture of the aircraft.The second point is somewhat more complex, so I will deal with it first. Any image tries to capture some aspect of the visual world. A glance back at the Vermeer painting reminds us of the analogue quality of light. There are no clear boundaries: between areas of brightness and darkness there are countless subtle textures of grey; boundaries are blurred by light and shadow. Our simple bitmap above is obviously too limited to handle such subtlety – it just deals in black and white. But there is no need to discard the basic idea. Can we adapt the simple bitmap strategy to deal with shade and texture?Of course we can – and quite easily. In our previous example, we dedicated one bit to each pixel in our image. All we need to do is devote more bits to each pixel to accommodate a greater range of shades. Let's allocate two bits per pixel with binary 11 representing black and binary 00 standing for white.SAQ 12How many shades can we represent using two bits per pixel? Remember your binary!Counting black as 11 and white as 00, we can have two shades of grey in between – 01 (light grey) and 10 (dark grey). So, four shades in all.4.6 GreyscaleIf this seems inadequate – it does seem rather an impoverished range of shades – all we need to do is allocate more bits. Three bits per pixel will give us eight shades, from black to white; four bits per pixel gives us 16 shades; and so on. This mapping of shades of grey between black and white in a black and white bitmap is known as greyscale. The range of numbers to which a pixel can be mapped is termed the pixel amplitude.Let's try a simple example. I'm going to take the first of the two images in Figure 17. Once again, I can lay a grid over the image as in Figure 18, which I've enlarged a bit, to demarcate the pixels. Note that I'm only working with a section of the picture, near the nose of the aircraft.Now I need to inspect each pixel and decide on the closest shade of grey to represent what appears in the square. For simplicity, I've decided to use six shades of grey, as well as black and white. The result is shown in Figure 19. It's not brilliant, but that can be put down to a fairly large pixel size and a limited choice of greys.Finally, I can map each pixel in the image onto one of the eight binary numbers between 000 and 111 inclusive, depending on whether the image at that pixel is black (111), white (000) or some shade of grey between. The mapping in the small area I've marked will look like this:which is tedious enough to demonstrate just how simplistic the interior world of the computer is.4.7 ColourNow what about the issue of colour? You should know enough to answer the question without prompting. So far, we've allocated a suitable number of bits to each pixel to give us the range of shade we need. Clearly, then, we must do the same thing to represent colour. But, how many bits will we need to devote to each pixel to represent a useful range of possible colours?That all depends, of course. It depends on the answers to two questions.How is it possible to map a particular colour to a number?How many colours do we want?Colour is a perfect example of an analogue property. The spectrum of light – what we get when we split white light up with a prism – is shown in Figure 20.SAQ 13How does Figure 20 demonstrate that colour is an analogue property?One colour merges smoothly into the next. There are no sudden transitions from, say, green to blue, or blue to violet. This is a perfect example of smooth analogue change.So, as with all analogue things, there is an infinite number of colours to choose from. But we are trying to map colour to a finite number, so we simply haven't the option of an infinite number. What options do we have? That depends on the answer to the first question above: how to represent a colour with a number.There are several schemes available. One of the simplest and most popular stems from an understanding of how human vision works. Certain receptor cells in our retinas, known as cones, respond to different wavelengths of light, roughly to the wavelengths of red, green and blue. All the colours we sense are a mixture of these three colours. Now all we need to do is allocate three numbers, one to each colour, representing the amount of red, or green, or blue that is mixed in that particular colour. Let's use the range 0–255 (eight bits, one byte) for each of these three numbers. So, to take some simple examples, the group255, 0, 0represents the colour red, as we have the maximum amount of red in our mixture, with no green and no blue. Along the same lines, the set0, 255, 0stands for green, since the mixture contains no red, no blue and the maximum amount of green. If you remember any of your school science, then, you will know that255, 255, 255is white, because white is a mixture of all three colours. All the other colours we see are mixtures of these three basic, or primary, colours.128, 10, 128for example, is a striking deep purple. For obvious reasons, this way of representing colour is called the RGB (red, green, blue) model.SAQ 14What colour would 0, 0, 0 represent in the RGB scheme?An easy one. It's black, which is what we see when there's no light at all.Now we can come back to the question of how many colours to choose. With this model, there are 256×256×256 possible colours, reflecting every possible mixture of our three basic shades. That's 16,777,216 colours in all. Of course, we can opt for fewer if we wish, by allocating a smaller number of bits to each of the R, G and B values. But nowadays, in an age of very cheap memory, it is common to opt for the full 16 million colour range.Other colour modelsRGB is not the only colour model. Graphic designers concerned with printed media, for example, favour a model known as CMYK. This is because the primary colours that are reflected off paper are not red, green and blue – but cyan (blue-green), magenta and yellow. The K stands for a special black ink used to add crispness. However, we will not discuss colour models any further in this course.Before moving on, I want to introduce one problem which will become of increasing importance. Think about the question posed in the following exercise.Exercise 11The image of the Vermeer painting in Figure 10 contains 647×735 pixels, with the full 16 million colour palette. Work out how many bits are required to store this image as a bitmap inside the computer. How many bytes?The image has 647×735=475,545 pixels. Each pixel will require 24 bits – that is, 3 bytes. So the image will require 11,413,080 bits, or 1,426,635 bytes which is nearly 1.5MB.Although modern personal computers can easily handle these sorts of memory requirements, such demands can be tricky to deal with. For a start, if I try to exchange an image of this size over a network, it is likely to be quite a lengthy and expensive process. When dealing with images, sometimes large amounts of memory are required. That is a problem we will have to keep an eye on, and find answers to. Is there perhaps a more efficient way of storing visual information?4.8 Interlude – diagramsSome types of visual information can be represented more economically than in a bitmap. Consider the rather pointless little diagram shown in Figure 21.SAQ 15Why do you think storing such a diagram as a bitmap would be a waste of memory?The huge majority of the pixels will just be white, the background to the picture. The only information all these white pixels give us is the simple fact that the background colour is white.So what information do we need to record about the diagram? In fact, what we really care about are the objects depicted – the rest of it is just uninteresting empty space. Our example contains five types of object: a circle, a rectangle, a line, an arrow and a piece of text. To reconstruct the diagram the only information we really need about each of these objects is:what sort of object it is (e.g. line, square);its size and position on the page;details about its colouring, width of line (line weight), and so on.Remembering that our aim is to express Figure 21 as a set of numbers, we can now go into a bit more detail.First of all, I'll assign a number to each type of object. Quite randomly, I'm going to choose 17 to represent a circle, 24 to stand for a rectangle, 26 for a line, 27 for an arrow and 11 for a text area. So the initial set of numbers will be:17, 24, 26, 27, 11.The order is not important.Now let's record the size and position of each object. Here we need some way of identifying positions on the page. To do this we use the very simple, although slightly intimidating sounding, technique of Cartesian coordinates. (Named after Rene Descartes, who invented the system in the seventeenth century). We simply place two axes, x and y at right angles on the page, as in Figure 22.Now we can identify any point on the page by its x- and y-coordinates, simply by measuring how far from the origin along the x-axis it is and then how far along the y-axis. So, any point on the page is located by two numbers – conventionally, × always goes first – as illustrated in Figure 23.Now I can identify the size and position of each object in Figure 21. Exactly how this is done depends on the object, as follows.Starting with the circle, all I need is its radius and the position of its centre – this tells me everything I need to know about the size and location of a circle. Let's say the radius of the circle in Figure 21 is 2 cm and the position of the centre (13, 6).For the rectangle, I will have to record two sets of values: the position of the top left-hand corner and the position of the bottom right-hand corner. Let's say they are (1, 8) and (6, 4), respectively.For the line and the arrow, I simply need to record their start and end positions. I estimate the line in Figure 21 starts at roughly (6, 6) and ends at (11, 6). The arrow's start and end points are approximately (12, 4) and (9, 2).As for the text area, I just need the position of its top left-hand corner, which I put at about (10.5, 2.5)Now I can put these together and produce the following intermediate set of numbers:17, 2, 13, 6 (circle)24, 1, 8, 6, 4 (rectangle)26, 6, 6, 11, 6 (line)27, 12, 4, 9, 2 (arrow)28, 11, 10.5, 2.5 (text area)I have not quite finished. For the whole diagram we need to identify the background colour, which is white in this case. Coding white as 255, 255, 255 in the RGB model gives us binary 111111111111111111111111, which is decimal 16,777,215.Now, for each object, I can record such details as the line colour, fill colour, line width. I want to keep it simple, so let's say:the circle's line width is 1 pixel, its line colour is black (decimal 0) and its fill colour is light blue (decimal 828,124);the rectangle's line width is 3 pixels, its line colour is black (decimal 0) and its fill colour is a restful light purple, whose RGB value is decimal 1,340,877;the arrow and the line, both have a line width of 1 pixel, and their line colour is black (decimal 0);the colour of the text in the text area is black (0 again).We haven't yet recorded what the text says! Easy. You remember your Unicode standard perfectly, so you know the text ‘the way out’ translates to 116, 104, 101, 32, 119, 97, 121, 32, 111, 117, 116.Now we can put all this together and produce a final set of numbers, as follows:16777215 (background colour)17, 2 13, 6, 1, 0, 828124 (circle)24, 1, 8, 6, 4, 3, 0, 1340877 (rectangle)26, 6, 6, 11, 6, 1, 0 (line)27, 12, 4, 9, 2, 1, 0 (arrow)11, 10.5, 2.5, 0, 116, 104, 101, 32, 119, 97, 121, 32, 111, 117, 116 (text area)This is a simplification, but I hope you get the idea. This sort of encoding of visual information is usually known as vector graphics, as opposed to the bitmap approach we discussed earlier which is often called raster graphics.The obvious advantage of the vector strategy is that it is a very compact form of coding. With just 41 numbers (about 984 bytes), we have summed up the essence of our diagram. A bitmap of the same diagram would have required at least tens of thousands of bytes.Another advantage of vector graphics is the resulting image is scalable: we can easily shrink or stretch the size of it without any loss of information.As always in computing, though, there are problems. First, vector coding only really works with fairly simple images. It would be hopeless for the Vermeer or Signac paintings, for example. So it is only a partial answer to the problem of size. Second, if I send the set of numbers we generated to a friend, she will need a sophisticated computer program on her computer to interpret the numbers and display them as a diagram. For the moment, we may just note that programs that allow us to draw and display vector graphics are generally referred to as drawing packages. Systems for constructing and displaying raster graphics are usually called painting packages. There are many examples of each on the market.4.9 Making it moveTo me, there is a wonderful quality of timelessness about Vermeer's picture of the young woman at her harpsichord. It captures a tranquil moment, frozen for eternity. But of course our visual world is not like that at all. It is dynamic, seething with motion. And schoolchildren have known how to create the illusion of movement since time immemorial. Riffling quickly through a little ‘flick book’ under the desk, with each page showing one step in a moving sequence, as in Figure 24, gives the impression of uninterrupted motion and has whiled away many a tedious Latin or maths lesson down the ages.Many nineteenth century children's toys were based on the ‘flick book’ principle: in 1825, for instance, the ‘thaumatrope’ tricked the eye into seeing movement by means of a rapidly rotating card; in 1834 the ‘zoetrope’ created a more sophisticated effect with photographs attached to a rotating drum.The invention of the film camera, and of moving pictures themselves, is generally credited to the Lumiere brothers in 1895, but actually several others made similar inventions around the same time. The humble flick book and the Hollywood movie both rely on exactly the same principle. The human eye registers a new item in the visual field almost the instant it appears. However, after it disappears the image of it persists for some moments in the retina and brain. So, with the flick book, as each new picture appears in front of our eyes, a visual remnant of the previous picture remains. And since each new picture relates closely to the one before it (in the jargon, we say it is highly correlated with it), the brain integrates them into an apparent moving sequence.The same trick is worked on the mind at the cinema. In the following discussion, I will refer to each picture as a frame, and the speed at which the frames pass in front of our eyes as the frame rate. At less than 10 frames a second (fps) the viewer generally sees each frame as a separate image. Between 10 and 16 fps (the sort of speed the flick book moves at) there is an impression of jerky movement. Above 16 fps, the movement seems much smoother. Films are usually shot and displayed at 24 fps; TV pictures are presented at between 25 and 30 fps, depending on what country you live in. High definition TV, currently only available in Japan, uses 60 fps.Computers use the same principle to display moving visual information. A series of images is taken from the computer's memory, or direct from a storage device such as a CD, and presented on the computer screen in quick succession. Each image is different from, but correlated with, the previous image; the illusion of smooth movement is created by our own eyes and brains. But recall the problem I raised earlier, of the size of digital encoding of images, and get your calculator out ….Exercise 12Consider a two-hour film to be displayed on a computer at 24 fps. Each frame is 640×380 pixels and a 24-bit RGB colour encoding is being used. How many bytes (don't even bother with bits) will be required to represent the whole film?Each frame contains 243,200 pixels. At 3 bytes per pixel, we will need 729,600 bytes per frame. The video is two hours, or 7,200 seconds, which at 24 fps will be 172,800 frames. So we will need 729,600×172,800=126,074,880,000 bytes. Over 126GB! (Remember a gigabyte is a thousand million bytes.)Now we really are in trouble. Even for modern computers, this is a colossal memory demand – one and a half times the size of an average hard disk. Transferring such an enormous amount of digital information over a network would be achingly slow. The highest rate at which data can be moved around the Open University local network is 100 million bits per second, although it is usually much less for an individual user, as we all have to share. 126GB is 1008Gb (the small b stands for a bit). So it would take nearly three hours to send the video to my colleague in the next office. However, most people still use the telephone network to move data, and this is much slower – a maximum of 56Kb per second. Be sure to make a cup of tea before you try to download a film.For other practical reasons, it is impossible to work with this amount of data. We have to find some way of reducing the amount of storage that moving images, and still images too, need. The vector graphics approach will not work for complex images, so we must look for a way of compressing bitmapped visual information.Exercise 13Can you think of any strategy for reducing the size of a bitmapped film? It's a difficult question, so don't worry if you can't get too far with it.One approach relies on a fact I mentioned earlier – that frames are correlated.Consider a fragment from a Hollywood movie. The camera rests on Clint Eastwood's face. He narrows his eyes and growls, ‘Do you feel lucky … punk?' The fragment takes perhaps two seconds, or 48 frames. But nothing much is actually moving in that time – only his lips and eyes. If we simply encode every frame separately, we'll find that all of them are very similar to one another. We are simply capturing a lot of the same information over and over again. So, if we fully encode the first frame and then just record the differences between it and the next frame, and then differences between that frame and the next, and so on, we will save huge amounts of space.4.10 Standards againWhatever compression strategy we adopt – and most real-life approaches use a combination – we again need to have agreement. If I compress a photograph using a certain technique and send it to a friend, her computer will have to be able to decompress it again to display it. So we must have a standard agreement between the parties about how the image has been compressed.There are many standards for image and film compression. It would be out of place to discuss in detail how they work here – the compression theme is taken up in a later course. All I'll do is note that, among the standards for image compression, two stand out – the JPEG (Joint Photographic Experts Group) and the GIF (Graphics Interchange Format) standards. Both standards reduce the number of bits used to store each pixel. GIF, for example, condenses each pixel from 24 bits to 8, by reducing the set of colours used to a smaller set, called a palette. Image data can sometimes be compressed to one twenty-fifth of the original size.For video, the dominant standard is MPEG (Moving Picture Experts Group), which is now used in most digital camcorders.4.11 Image and video capture devicesEarlier, we looked at keyboards and scanners as a means of taking text across the boundary.SAQ 16What are the main devices used for transforming images and video into digital form inside the computer?You may have thought of scanners again, which can be used for images as well as text. You may also have identified digital cameras and camcorders.4.11.1 Digital still cameras and camcordersThese devices are now widely and (fairly) cheaply available. There is no film. You point your camera, take your shot and get a compressed digital image that can be transferred straight onto a computer, where it can be edited or printed. Digital still cameras usually compress their images into JPEG format and store them on a tiny, removable memory card inside the camera; the latest digital camcorders can record in MPEG format, stored on a special tape. Both devices work by means of an electronic chip called a charge-coupled device (CCD).A CCD is basically an array of tiny cells, vaguely similar to the receptors in the eye, that respond to light by generating a tiny electric charge. The amount of charge depends on the intensity and colour of the light falling on the cell. Each cell then maps onto a pixel in the image being stored, so the CCD behaves just like a bitmap. Obviously then, the larger your array, the higher the definition, and thus better quality, your image will be. The best non-professional digital still cameras now have CCD arrays of 5 million or more cells, giving superb-quality bitmapped images. Software inside the camera converts the bitmap into compressed format.4.11.2 Scanners (again)In Subsection 4.2.5, scanners came up as devices that can convert text into digital form. They do this by making a digital image of the page and then passing this image to an OCR system to distinguish the various characters. However, they are more often used to take images such as photographs and printed diagrams across the digital boundary. A scanner works by moving a sensing point rapidly across the image, in a series of lines, as illustrated in Figure 25.The characteristic pattern shown in Figure 25 is known as raster scanning. The scanner measures the brightness (luminance) and the colouring (chrominance) of a series of points along each line and converts the readings at each point into a number. The quality of the resulting bitmap will obviously depend on the number of lines the scanner follows across the specimen, and the number of measurement points along each line. Most scanners come with software that will compress the bitmap into a number of formats, including JPEG and GIF.4.12 Sound and musicSecond only to vision, we rely on sound. Music delights us, noises warn us of impending danger, and communication through speech is at the centre of our human lives. We have countless reasons for wanting computers to reach out and take sounds across the boundary.Sound is another analogue feature of the world. If you cry out, hit a piano key or drop a plate, then you set particles of air shaking – and any ears in the vicinity will interpret this tremor as sound. At first glance, the problem of capturing something as intangible as a vibration and taking it across the boundary seems even more intractable than capturing images. But we all know it can be done – so how is it done?The best way into the problem is to consider in a little more detail what sound is. Probably the purest sound you can make is by vibrating a tuning fork. As the prongs of the fork vibrate backwards and forwards, particles of air move in sympathy with them. One way to visualise this movement is to draw a graph of how far an air particle moves backwards and forwards (we call this its displacement) as time passes. The graph (showing a typical wave form) will look like Figure 26.Our particle of air moves backwards and forwards in the direction the sound is travelling. As shown in Figure 26, a cycle represents the time between adjacent peaks (or troughs) and the number of cycles completed in a fixed time (usually a second) is known as the frequency. The amplitude of the wave (i.e. maximum displacement – see Figure 26) determines how loud the sound is, the frequency decides how low or high pitched the note sounds to us. Note, though, that Figure 26 is theoretical; in reality, the amplitude will decrease as the sound fades away.Of course, a tuning fork is a very simple instrument, and so makes a very pure sound. Real instruments and real noises are much more complicated than this. An instrument like a clarinet would have a complex waveform, perhaps like the graph in Figure 27a, and the dropped plate would be a formless nightmare like Figure 27b.Exercise 14Write down a few ideas about how we might go about transforming a waveform into numbers. This is a difficult question, so it might help to think back to the methods we used for encoding images in Subsection 4.3.In a way the answer is similar to the question on how to transform a picture into numbers that I posed in Subsection 4.3. We have to find some way to split up the waveform. We split up images by dividing them into very small spaces (pixels). We can split a sound wave up by dividing it into very small time intervals.What we can do is record what the sound wave is doing at small time intervals. Taking readings like this at time intervals is called sampling. The number of times per second we take a sample is called the sampling rate.I'll take the tuning fork example, set an interval of say 0.5 second and look at the state of the wave every 0.5 second, as shown in Figure 28.Reading off the amplitude of the wave at every sampling point (marked with dots), gives the following set of numbers:+9.3, −3.1, −4.1, +8.2, −10.0, +4.0, +4.5as far as I can judge. Now, if we plot a new graph of the waveform, using just these figures, we get the graph in Figure 29.The plateaux at each sample point represent the intervals between samples, where we have no information, and so assume that nothing happens. It looks pretty hopeless, but we're on the right track.SAQ 17How can we improve on Figure 29?Again, the problem is similar to the one we faced with the bitmapped image. In that case we decreased our spatial division of the image by making the pixel size smaller. In this case we can decrease our temporal splitting up of the waveform, by making the sampling interval smaller.So, let's decrease the sampling interval by taking a reading of the amplitude every 0.1 second, as in Figure 30.Once again, I'll read the amplitude at each sampling point and plot them to a new graph, as in Figure 31, which is already starting to look like the original waveform.I hope you can see that this process of sampling the waveform has been very similar to the breaking up of a picture into pixels, except that, whereas we split the picture into tiny units of area; we are now breaking the waveform into units of time. In the case of the picture, making our pixels smaller increased the quality of the result, so making the time intervals at which we sample the waveform smaller will bring our encoding closer to the original sound. And just as it is impossible to make a perfect digital coding of an analogue picture, because we will always lose information between the pixels, so we will always lose information between the times we sample a waveform. We can never make a perfect digital representation of an analogue quantity.SAQ 18Now we've sampled the waveform, what do we need to do next to encode the image?Remember that after we had divided an image into pixels, we then mapped each pixel to a number. We need to carry out the same process in the case of the waveform.This mapping of samples (or pixels) to numbers is known as quantisation. Again, the faithfulness of the digital copy to the analogue original will depend on how large a range of numbers we make available. The human eye is an immensely discriminating instrument; the ear is less so. We are not generally able to detect pitch differences of less than a few hertz (1 hertz (Hz) is a frequency of one cycle per second). So sound wave samples are generally mapped to 16-bit numbers.4.13 Sound capture devicesIn the past, the work of recording sound and music was carried out by professional recording studios. Before digital technology arrived, recordings were made by picking up sounds on a microphone which converted them to an analogue electrical signal. This signal was then transferred to another analogue medium, such as the grooves of a vinyl record or the changing patterns of metallic atoms on a magnetic tape.At the start of the digital revolution, analogue to digital conversion, and the transfer of digitally encoded sound to compact discs, could only be accomplished with sophisticated and expensive equipment. Nowadays, many personal computers come ready equipped with A/D (analogue to digital) electronics built in, and with a drive for writing CDs. A range of new compression formats for sound and music, the most notable being MP3, are looking as if they might undermine the whole financial basis of the music recording industry. It is now easy to compress the contents of a CD to MP3 format, and post the file to a website for anyone in the world to download and write to a CD of their own – free. Recently, one such a website, named Napster, was ordered by a US court to cease operations, on grounds of breach of copyright. But Napster has many imitators, so the problem remains.4.14 A final wordI've looked at specific techniques for taking features of our analogue world across the boundary into the digital realm. All these methods have worked along the same lines – a two-step process consisting of:breaking the target into parts; andmapping each part onto a binary number.But I want to remind you of two points. First, we are not restricted to visual or sound information. Using the same strategy, we can take any feature of our world that interests us into the digital world. Second, once this information has been captured in digital form, there is no reason why it need just be stored and exchanged – we have other options. We can manipulate it in any way we want, an idea I discuss.. Before I move to this, however, I want to delve a bit deeper into what digital information means.4.15 SummaryThis has been a very long section; so congratulations on your persistence!I've considered in detail how text, pictures, moving pictures, diagrams and sound can all be reduced to numbers and stored inside the boundary in a computer's memory. A persistent theme has been the sheer size of the digital representation that we can get as the result. The need to reduce this amount of digital data, to compress the image, sound or film file we end up with, is taken up in the next course.5 Going back5.1 As to the meaning ...And this song is considered a perfect gem,And as to the meaning, it's what you please.(C.S. Calverley, Ballad)This short section is devoted to rounding off the discussion so far. In Section 1 I remarked that a digital picture of some set of interesting features of the world is of no value unless we can examine it in some way – in other words, take it back across the boundary into the human realm. This section briefly takes up this theme, and aims to:examine what digital representations mean;outline some of the devices that are used to interpret digital information and turn it back into a form that means something to our human eyes and ears.5.2 A conundrum about meaningSAQ 19Look at the following set of binary numbers:00011010 00100011 10001001 10011100 10100011 01001101 10000011 01010100 10001000 00010001 10000110 11110010 …which we may imagine are stored in the memory of a computer.What do these figures mean? In other words, given they are a representation, what do they represent?I hope you didn't struggle too long before replying. There is simply no way to tell what they represent.Maybe this slice of computer memory is part of an encoding of an image or a line from a Shakespeare play, perhaps a fragment of a recording of Mozart's Jupiter Symphony ℃ anything. We cannot tell just by looking at the numbers what they stand for or represent. They mean nothing in themselves. In the jargon of computer science, they have no semantics, which Chambers Twentieth Century Dictionary(1998) defines as:semanticssi-man-tiks, n sing: the meaning attached to words and symbolsTo humans, the words ‘I'm coming home tonight …’ have meaning. Vermeer's painting of the young lady has significance for us – it depicts things with which we are familiar. (And it contains hidden meanings, too. The picture of Cupid over the young woman's head hints at what she is thinking about.) Even a piece of music has meaning for us, in a more diffuse way. But when we take these things across the boundary, they are stripped of their meaning. They just become numbers, their human associations lost. If their meaning is to be regained, they must be transported back from the digital to the human world. How can this be done?5.3 Regaining meaningSuppose for a minute that the numbers I presented above were generated by a scanner as it produced a bitmap of a photograph. Clearly, the machine on which they are stored will have to get the image back to us by means of a device that can render it into a form meaningful to the human eye – an output device. I shall shortly review such devices. However, there is still work to be done before the computer can pass digitally-encoded data to such a device. For a start it will need to have information about which device is an appropriate one; then it will have to assemble the numbers into a form suitable for that device.Exercise 15Write down some ideas about what other information will be needed to present these numbers through an output device, such as a printer or a monitor. Think carefully about this.For a start, there must be some indication of what the numbers represent – text, image, sound?Assuming that they are part of an image, information is needed on such features as:the height and width of the image (in pixels);the colour scheme used;whether the image is compressed and, if so, how. Probably other valid ideas also occurred to you.Sending a digital representation back across the boundary is thus a three-stage process, consisting of:identifying the output device to be used;arranging the numbers into a form that can be handled by the output device;interpretation of the code by the output device.The first of these stages usually depends on a direct command from the computer user who is on the other side of the boundary. I can choose whether to send my digital image to a printer or to the screen. The final stage is carried out by specialised electronics in the output device, and need not worry us here. But what about stage 2? How does that happen?For a digital representation to be handled by an output device the numbers that it consists of must be organised in a suitable form. This can be a simple process, but is sometimes very complex, especially in cases where the information has been compressed. All I want to do here, however, is establish how, in general, such preparation is done. Since the digital encoding now exists inside the boundary, any direct manipulation from outside is not feasible. Practically, the digital world can only be manipulated from inside by other digital things. In this case, the necessary arrangements are made by a special class of digital encoding – a program. You will hear a lot more about programs as you progress through the course. I don't want to pre-empt any of this, so for the moment I'll just ask you to consider the following question.SAQ 20From what you've learned so far, what do you think programs consist of?There's no need for a complicated answer here. Programs inhabit the digital world, so, ultimately, they are made up of binary numbers.Far more can be said about programs than this, but in the end they are just numbers. Inside the boundary, a program is a set of binary words. You will remember from that a word is a group of bytes, usually four. Now, each word of the program has a special significance to the machine's central processor – it stands for an instruction. And when a computer's central processor (normally referred to as its CPU, central porocessing unit) reads one of these words it carries out the instruction that the word stands for. In this way the digital world can be manipulated by the digital world itself.5.4 The meaning of meaningI've spoken above as if the whole question of meaning was a simple one. I've used the word itself as if it presented no problems. This certainly isn't true. The whole issue of semantics is a matter of fierce debate among computer scientists and philosophers. What is meaning anyway? How is it possible for anything inside a computer to mean something? Exactly where does meaning return as we go back across the boundary – at the output device or in the human mind? Is the meaning of a picture somehow different from that of a line of text, and if so how?Fortunately for me (and for you), there's no need for us to get involved in this brawl. What I've said about the issue of meaning – that digital representations mean nothing in themselves – will do for now. Let's end the section on a less contentious note and look quickly at some output devices.5.5 Types of output devicesWe can make a start by appealing to your own general knowledge.Exercise 16You have a computer; list the output devices that it uses.Obviously this depends on the exact set-up you have, but your computer will be equipped at least with some of the following:a monitor (screen)a printerspeakers.I'll now say a few words about each of these types of device and about one other, as it is rather a special case, a device called a plotter.5.5.1 MonitorsNearly all computers are supplied complete with a monitor which opens a window onto the machine's digital world. Without one we could have little idea about what the computer was doing, or even whether it was working at all.There are two main types of monitor: the CRT (cathode ray tube) and LCD (liquid crystal display). A CRT monitor looks like a television screen, and works in a similar way to a TV or a scanner. A beam of electrons is fired from a gun at the back of the tube onto a glass screen on the front. The beam sweeps across this screen in the same raster scanning pattern illustrated in Figure 25. The front of the tube is coated in a phosphorescent material that glows as the electron beam hits it. In this way the picture is built up.SAQ 21Do you think your monitor gives a digital or analogue image? Look closely at the image on your own monitor if need be.If you look very closely at your screen while it is displaying an image, you will see the pixels. So the monitor supplies a digital display.Usually this digital image is of high enough resolution to trick the eye into interpreting it as analogue. High-quality professional monitors can give resolutions of up to 1920×1440 pixels or more, although 1024×768 and 1280×1024 are the most common. However, watching even a good quality CRT monitor for a long time can be tiring, as the scanning of the electron beam gives a flickering sensation.You will probably have seen LCD monitors, though you may not own one. They are completely flat, because they have no electron gun. They work on the principle of passing light through a special material, the molecules of which change their orientation when an electrical voltage is applied to them. This is the same principle on which the screens of mobile phones and calculators work. On a computer LCD monitor, there is one tiny unit of such material for each pixel on the screen, so once again a digital picture is produced.Although professional graphic artists still favour CRT monitors for their colour accuracy, LCDs are to be preferred for general use. They use much less power than CRTs; they take up little space; and they are much less tiring to work on – every pixel is always on, so they do not flicker. Resolutions vary, but 1280×1024 pixels is common.Finally, though, note that the resolution actually displayed on the screen is not decided by the monitor itself, but by the program that prepares the digital encodings for display. This program allows a user to set the resolution to any one of a range of possibilities, depending on how much memory the computer has available. For example, the monitor I use at work can resolve up to a maximum of 1920×1440, but I usually opt for a lower resolution than this.5.5.2 PrintersColour models were dealt with in Subsection 4.7.You probably also own a printer. Many computers now come with them as part of a package. There are two main types in use today: inkjets and lasers.InkJet printers work, as their name suggests, by firing tiny droplets of ink at the paper from a moving print head. Such printers can print in both colour and black and white. You may have noticed that the colour cartridge comes in three parts: cyan, magenta and yellow, indicating the colour model (CMYK) that the printer uses.Laser printers produce very high quality print by firing a laser beam at a rotating, light-sensitive drum. They use a dry powder toner, rather than liquid ink and generally print only in black and white. Colour lasers are available, but are rather expensive for individual users. InkJet printers are now very cheap and so are favourites on the home market. However, ink cartridges are expensive to replace, so an inkjet is uneconomical if you have a lot of printing to do. Lasers are preferred in offices, where they are generally shared and can produce long print runs at low cost.Both types of printer produce a digital output, as they render graphics and text by firing the laser, or ink, through a square matrix of tiny holes, as illustrated in Figure 32.5.5.3 PlottersA plotter is a special type of printing device mostly used by architects, engineers and map makers. Here the printed output is produced by moving a pen across the paper. Sometimes several differently coloured pens are available. Plotters are obviously most suitable for line drawings, which is why architects, for instance, use them. I've mentioned them here, however, because – in contrast with monitors and printers – they produce an analogue output directly.5.5.4 LoudspeakersSpeakers also produce an analogue output. The audio program inside the boundary converts the digital encoding of the sound to a series of electrical pulses that are sent to the speaker, where they cause a cone of stiffened paper (or some synthetic material) to vibrate in and out. This makes the air vibrate in the characteristic sound wave.5.5.5 SummaryIn this section I've briefly considered the very contentious question of what digital representations mean, but this debate must be left to another course. I have also described some of the devices that take digital information back into the analogue world of sight and sound, presenting it in a form that is meaningful to human eyes and ears.6 What if? … changing the digital world6.1 Kings of infinite space?I could be bounded in a nutshell and count myself a king of infinite space, were it not that I have bad dreams.(Shakespeare, Hamlet)This section draws together the themes of the previous sections by:discussing how the digital world can be manipulated;explaining how this process has significant implications for science, politics and society.I want to stress at the start, however, that I'm not expecting you to gain a detailed understanding of the models I'm presenting here, still less of the mathematics behind them. My aim is to give you an appreciation of the awesome scope, power and significance of computer simulation.I ended with two remarks. First, I noted that, in making digital representations, we are not restricted to the visual and sound information that we discussed there. Using our strategy of splitting and mapping, of sampling and quantisation, it is possible to encode any property of the world that interests us. Second, I stated that digital representations are perfectly flexible – once captured, programs can be written that will change them in any way that suits us.The discussion has really been rather dry up to this point. But now I want to try and pull together ideas from previous sections to illustrate just how exciting, momentous and far-reaching the concept of a digital representation can be. In Section 1 I referred to our human capacity to range over past, present and future worlds. Digital representations help us to do just this with complete freedom. That is my theme for this section.I have to be brief, but the investigation will take us from the whole planet, to the beginnings of the universe itself, and from there into worlds that have no existence except in fantasy.6.2 Mimicking and mastering nature: manipulating the digital worldEncoding images and sound is all very well, and has had billion-dollar effects on the publishing, recording and film industries. But can we be more ambitious? How about capturing features of the wider world? From the many examples I could choose, I want to focus on two aspects of nature that are of particular significance to scientists, and of interest to the wider public:the earth's climate;the origin and evolution of the universe itself.The earth's climate matters. The weather affects us all. For some it is simply an inconvenience; but for others – sailors, farmers, pilots – it can be a matter of life and death. But there are also urgent questions we need answers to now. Is the climate heating up? Is the ozone layer being eroded and, if so, what effect will that have on the climate? What about greenhouse gases? What will happen to the polar ice caps? These are very grave issues, affecting everyone on the planet.The question of how the universe began and how it evolved may seem a less urgent matter than the future of our planet's weather systems, but it must surely be of some interest to everyone. How did we get here? Why is the cosmos we see today the way it is? How did it begin? How will it end? Everyone has asked themselves these questions at one time or another.How can such problems be studied? There are, of course, a number of ways but the advent of the modern digital computer has added an enormously powerful new weapon to the scientists’ armoury: simulation. We can create digital models of natural phenomena and then write programs to manipulate them.6.3 ModelsSo how could one go about creating a model of our planet's climate, or (even more daunting) the universe itself? What exactly is a model anyway?We can start with an apparently trivial observation. The world we inhabit is complicated. Not only does it contain trillions and trillions of things, but these things also interact with each other in myriad relationships.SAQ 22Why would a perfectly accurate digital model of the world not be possible?First, because our world is analogue and the digital realm is discrete. But also because the world is simply too varied and complex. We would need a computer as large as the world itself.So, every model has to be a simplification – computer scientists often call it an abstraction. The model builder must include only the features that have a direct bearing on the system being modelled – ignoring everything else. However, once the relevant elements have been identified, then our trusty tools of sampling and quantisation can be brought into play. To illustrate, let's look at our two examples again.6.3.1 The climate modelWe know that the weather is created by the interaction of earth's atmosphere with the land, the oceans and the energy of the sun. Therefore, the key factors are air pressure, temperature, humidity, wind speed, and so on. Any model will have to identify and represent these properties only, ignoring irrelevant ones such as the current government or the size of the Meteorological Office building. After this, the familiar process of splitting up things can begin.One successful type of atmospheric model is known as a General Circulation Model (GCM). In GCMs the earth's surface is split into a rectangular grid. Each rectangle is the base of an atmospheric column, extending from the surface to high in the atmosphere, and divided into layers which split the whole atmosphere into a network of 3-D boxes. Each box contains a number of points at which the temperature, pressure, humidity, wind speed and direction, and other features are recorded. The size of the grid, height of each column and number of layers in each column depend on the model and what it is being used for. The Goddard Institute for Space Studies Model II, for example, divides the atmosphere into 3312 columns with 9 to 31 layers in each column. The height of each column is about 80,000 feet.Does this look familiar? It really amounts to nothing other than the sampling and quantisation that we carried out in The model divides up the atmosphere into boxes and each box into points (sampling). Then each point is mapped to a number – in this case a series of numbers (quantisation). But what is the point of building such an elaborate model? Let's leave that question for a moment and cast our net even wider.6.3.2 The cosmosNext time there is a clear dark night, look up at the sky. You will see the stars, of which the Sun is one, that make up our galaxy. Our galaxy, the Milky Way, contains about 100 billion stars and belongs to a cluster of similar galaxies we call the Local Group. The Local Group is an outlying part of a huge cluster of galactic groups called the Virgo Supercluster. On a larger scale still, the universe seems to consist of billions of superclusters strung out through space in huge filaments, with immense voids between them as depicted in Figure 33.How did the universe get that way? How did all this arise?One approach to this problem is, again, through simulation. Cosmologists have good evidence that space, time, matter and energy began about 15 billion years ago in a gigantic explosion, the ‘Big Bang’. They also have a good idea of what conditions were like from a few seconds after the Big Bang to the time when the cosmos was about 300,000 years old. Things were quite simple then. The cosmos consisted of:matter (mostly hydrogen);‘dark’ matter (no one knows what this is yet – only that it is there);gravitational and radiation energy.In the 1990s, the US National Science Foundation's Grand Challenge Cosmology Consortium (GC3) produced a number of simulations of the early universe based on this understanding. All of them followed our familiar broad strategy: division into parts, measuring quantities in each part (sampling) and then mapping to numbers (quantisation). For example, a team led by Michael Norman at the NCSA modelled a cubic section of the universe 340 million light years wide, at about 1 billion years after the Big Bang. They divided the space up into over a hundred million cubes and assigned values for the density of matter, dark matter, the temperature, and so on to points inside each cube. Other models using the same strategy are of earlier eras, going back into the first three minutes of time.What do these models, of climate or of the cosmos, tell us? Well, nothing if they are just used as a static, simplified picture – inside the boundary – of how things are, or were. But if we set them into motion, they tell us about past, present and future.6.4 Setting models in motion – the power of simulationOur universe – everything about us – appears to obey laws, which govern how aspects of the world relate to one another. Scientists refer to these as natural laws, as they seem to be constants of nature, and to distinguish them from laws made by people.Exercise 17Write down any example of a natural law you can think of. What does the law tell us? Why do you think it is called a law?One of the most obvious is the law of gravity. This tells us that any two bodies will be attracted to one another by a force that depends on their masses and their distance from one another. Gravity is a law because it applies to every mass, always and everywhere.The features included in both the classes of model I described above are also regulated by laws. For climate models, such laws include:the Navier-Stokes equations which relate the movement of air, up and down or east and west, to the earth's rotation, friction, turbulence and pressure;the thermodynamic equation which relates rises or falls in temperature to heat coming from the sun, from condensation and from other sources.Matter, dark matter and the energy of the early universe are similarly governed by laws, such as gravity and the three laws of thermodynamics.All these laws describe how things change in relation to one another over time – how air flows, how things warm up and cool, how matter clumps together. Now, if we write and run a program that applies the relevant laws to the model, we can show how things will change as time goes on. We can project the model forward into the future to predict what things will be like then. Of course, in our world time passes smoothly and continuously, in analogue fashion, so we will have to split it up into a series of intervals, rather as we did with the sampling of a waveform in . So, as we run the simulation forward in time, the picture looks like Figure 33.Finally, we need some means of visualising the digital model as it evolves over time. This is a difficult issue, beyond the scope of this course. There are examples of such visualisations below.Running climate simulations enables us to forecast the weather, in terms of future temperatures, winds, rainfall, and so on. Data gathered from weather stations and satellites is entered into the model and it is run forward in time to predict future weather patterns. Examples are shown in Figures 34a and b.Even more significantly, atmospheric simulations help with predictions about the long-term future of the climate. We can range over a number of possible futures, looking for answers to the sorts of questions I raised earlier.By contrast, cosmological models help our understanding of the past and the present. We know how things look now. If our simulation evolves from its beginning at a point early in time into a state resembling the present-day universe, then it means the model of the cosmos in those very early times is an adequate one. There are some visually stunning presentations of this in Figures 35a and b.There are also cosmological models to range into the future. For example, one simulation probes the results of the collision between the Milky Way and the mighty Andromeda galaxy, one of our near neighbours in the Local Group (it is only about 9 million, million, million miles away). It might be premature to take out extra insurance, though. The crash is due to happen in about 3 billion years’ time.Unfortunately, your desktop PC will not be able to handle simulations like these. The application of very complex laws, over and over, requires immensely powerful computers called supercomputers. Supercomputers are specially designed to carry out billions of numerical calculations a second. Even at these speeds, simulations may take hours, or even days, to run.Other simulationsThe range of possible simulations is endless, and each one can tell us things about the past, present and future aspects of our world. Two that might interest you are:economic models;the Tierra model of artificial life.6.5 Imaginary worlds6.5.1 Virtual worldsAre you bored with your surroundings? Do you sometimes wish you were someone else? Help may be at hand. All the digital models we have looked at so far are based on our own world. But we needn't be limited by this. Why not create completely new worlds inside the computer and live in them whenever we wish? It has already been done.6.5.2 AlphaWorldAlphaWorld does not exist in space. It is a purely digital world, existing in the memory of a powerful computer, or group of computers, somewhere in the physical world. In the jargon of computer science, it is a virtual world, where Virtual’ is a term used to describe any entity that does not really exist, but is simulated by the action of a computer.AlphaWorld is one of a set of many such worlds, known as Active Worlds, developed originally by Worlds Incorporated, but now hosted by Circle of Fire Studios and a consortium of users. Other companies and consortia also offer many such ‘worlds’.AlphaWorld provides a virtual world to visit, move around in, and even live in to an extent. Entrance is through a gate to a 'place' known as Ground Zero, and use of the arrow keys on a keyboard moves individuals around from there.Of course, individuals are not really moving. AlphaWorld is a digital model and movement among the objects is an illusion created by very clever programs, showing what a 3D landscape would look like from a certain position. And because it is all an illusion, an individual is not constrained by physical laws in AlphaWorld. It is possible to hover above the ground and fly hundreds of feet above the surface, looking down on the activity below.The inhabitants of AlphaWorld both are, and are not, an illusion too. They are not an illusion because they are real people like you and me, with ordinary lives, homes, friends, pets in the physical world. But how is it possible fora physical person to be an inhabitant of a digital ‘place’? We live outside the boundary in the analogue universe. How can I get inside a purely digital world that lies entirely inside the boundary?Of course, as my virtual point of view moves around AlphaWorld, with the illusion of a changing scene being created for me by programs, in a sense one could say I was there. But we can go further. I can select or create a digital representative of myself, called an avatar, (‘avatar’ is a Hindu word meaning, roughly, ‘an embodiment of the spirit in the flesh’) a word now used to refer to all sorts of digital being or agent, and send that into AlphaWorld. That is the illusion.Every avatar you see in AlphaWorld represents a real person, who is living an independent life somewhere. Avatars can meet and interact with one another in AlphaWorld. AlphaWorld is an enormous meeting place and community. And because so many people meet there, many of the same things happen as when people meet in real cities. There is crime in AlphaWorld and there is even a police force to combat it, composed of avatars belonging to ‘citizens’. There is romance (and marriage, believe it or not). There are even natural disasters like fires and meteor strikes.And AlphaWorld is enormous. (Notice how I am already dropping into realistic language. AlphaWorld has no real extension in space, only the appearance of it.) This is partly because it is not static. It started as a small collection of buildings’ around Ground Zero. Many individuals and groups have claimed ‘land’ and built ‘buildings’ over the years, leading to an enormous sprawl of development. AlphaWorld became now so large that it required teleport stations to move between distant areas.6.5.3 Virtual realityThe virtual visitor to AlphaWorld may come away with a feeling of disappointment. The graphic representations of streets, buildings and avatars are quite impressive, but they are not reality.This is true, of course. Three-D modelling techniques are an active subject of research, and present-day commercial computers are still not powerful enough to construct truly realistic illusions of reality. However, developments already in the pipeline may move things on a stage further in the near future. The science of virtual reality (VR) is still in its infancy, but in its most ambitious form, immersive VR, it aims to dispense with the computer screen altogether and provide a completely realistic experience. Visual effects are supplied through goggles that give an impression of a surrounding world. Sound is supplied directly through earpieces. There are even special gloves that give an illusion of touch. Such techniques are still on the frontiers of research, but elements of immersive VR are already in use with the US military.6.6 Worlds without endI wish this section could have been longer and that I could have written about:mirror worlds which are exact digital representations of parts of our own world – cities, hospitals, and so on – and which are constantly fed data that keeps them up to date;autonomous robots that move through the real world, sensing it, responding to it and changing it;artificial life: worlds like Tierra, teeming with digital organisms;telepresence in which it is possible to interact with a virtual representation of some real scene, perhaps from thousands of miles away. For example, using telepresence, a surgeon can operate on a patient without being at the scene.But you may not share my wish, so I will just move to the final section, where I raise a few concluding questions.6.7 SummaryThis section has looked at simulations, in which digital models of key aspects of the real world can be manipulated by programs. The examples included models of the world's climate, the early cosmos, stock markets, biological evolution and fantasy worlds and personalities. I've offered the view that simulation has far reaching implications for science, politics and society and will invite you to question that view in the final section.7 Crossing the boundary – a final wordThe real question is not whether machines think but whether men do.(B.F. Skinner, Contingencies of Reinforcement)We feel the machine slipping from our handsAs if someone else were steering;If we see light at the end of the tunnel,It's the light of the oncoming train(Robert Lowell, Since 1939)If you persist with your study of computing – and I hope you will – you will soon come across what I call the ‘gee-whizzer’. Gee-whizzers talk and write about computers in a special way. Their attitude seems to be approximately as follows. Everything to do with computers is endlessly ‘cool'; every advance in computer technology is a major breakthrough which will utterly change the world (and always for the better). People who even mildly question the value of certain technological innovations are considered reactionary.But I hope you will, as thoughtful people, read what I have written about in this course with a more sceptical eye – as I do. Not every scientific advance is a benefit, and every new tool the human race has invented, since Neolithic times, has done some harm to the world, as well as good.Exercise 18You may wish to think about the following questions. There are no easy answers but you may like to post your thoughts onto the forums and talk about them with other people.The dangers of universal access to information.The social and political significance of virtual worlds.How far can we trust computer information?I don't, however, want to end on a negative note. This is an exciting time. Computers have opened windows on nature and on society that we could never have believed possible. They have genuinely revolutionised the world. And all through the power of the humble 1 and 0.8 ConclusionsIn this course you have learned about the difference between the analogue world we inhabit and the digital world of the computer.I've described how features of our world can ‘cross the boundary’ and be represented or modelled in the digital world, and then brought back across the boundary to us.More excitingly, computer programs that manipulate digital representations of our world enable us to:simulate physical and social processes;explain current events;predict future events;create futuristic virtual worlds.Whether or not these technological wonders are a force for good was left as an open question.8.1 Key termsYou should be able to define the following terms in your own words.agentamplitudeanalogueASCIIavatarbase 10base 2binary systembit (binary digit)bitmapbyteCartesian coordinatesCCDcharactercharge-coupled devicechrominancecross the boundaryCRT monitordigitaldecimal systemdigitdiscretedrawing packageframeframe ratefrequencygreyscalehexadecimalimmersive VRinkjet printerlaser printerLCD monitorluminancemodelMP3Napsteroctaloutput devicepainting packagepalettepixelpixel amplitudeplotterquantisationraster graphicsraster scanningresolutionRGB modelsamplingsampling ratesemanticssimulationUnicodevector graphicsvirtualvirtual reality (VR)wordThe content acknowledged below is Proprietary (see terms and conditions). This content is made available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 LicenceCourse image: SomeDriftwood in Flickr made available under Creative Commons Attribution 2.0 Licence.Figure 5a: reproduced by permission, IBM Research, Almaden Research Center;Figure 5b: NASA;Figure 10: National Gallery, London;Figure 11: Musee de I'Annonciade, St. Tropez;Figure 24: Worcester Art Museum;Figure 33: Harvard-Smithsonian Center;Figure 35: High Altitude Observatory.Every effort has been made to contact copyright owners. If any have been inadvertently overlooked the publishers will be pleased to make the necessary arrangements at the first opportunity.Don't miss out:If reading this text has inspired you to learn more, you may be interested in joining the millions of people who discover our free learning resources and qualifications by visiting The Open University - www.open.edu/openlearn/free-coursesDiscussion2018011700