Difference between revisions of "CSC103: DT's Notes 1"
Line 36: | Line 36: | ||
The choice of using electricity has influenced greatly a fundamental way in which modern computers work. They all use the binary system at the lowest level. Because electricity can be turned ON or OFF with a switch, it was only logical that these two states would be used to represent information. ON and OFF. 0 and 1. True and False. But if we can represent two different states, two different levels of information, can we represent other than 0 or 1? Say 257? Can we also organize electrical circuitry that can perform the addition of two numbers? | The choice of using electricity has influenced greatly a fundamental way in which modern computers work. They all use the binary system at the lowest level. Because electricity can be turned ON or OFF with a switch, it was only logical that these two states would be used to represent information. ON and OFF. 0 and 1. True and False. But if we can represent two different states, two different levels of information, can we represent other than 0 or 1? Say 257? Can we also organize electrical circuitry that can perform the addition of two numbers? | ||
− | The answers to these questions, and the ensuing solutions are provided by two giants of computer science, '''George Boole''', and '''Claude Shannon''' who worked at very different times. Boole | + | The answers to these questions, and the ensuing solutions are provided by two giants of computer science, '''George Boole''', and '''Claude Shannon''' who worked at very different times. |
+ | |||
+ | Boole's contribution was first in the history of computers. In the 1840s, he conceived of a mathematical world where there would be only two symbols, two values, and three operations that could be performed with them, and he proved that such a system could exhibit the same rules exhibited by an algebra. The two values used by Boole's algebra are ''True'' and ''False'', or ''T'' and ''F'', and the operators are ''and'', ''or'' and ''not''. In essence he said that any combination, and function of many different variables that can only take the values ''T'' or ''F'' can be expressed by a combination of ''and'', ''or'' and ''not'' operators. | ||
+ | |||
+ | An example will illustrate this concept. | ||
+ | |||
+ | Assume that I'm interested in buying ice cream for three friends: Edna, Liz, and Frida. Before going to the store I probe my friends for their taste in ice cream. Edna likes anything with chocolate, but doesn't like anything with fruit. She also doesn't like | ||
+ | Haagen Dazs icecream. Liz doesn't like chocolate, and doesn't care about the brand. Frida likes everything. So we can create three boolean variables: | ||
+ | {| | ||
+ | | Variable ''a'' | ||
+ | | likes chocolate ice cream | ||
+ | |- | ||
+ | | Variable ''b'' | ||
+ | | likes fruit ice cream | ||
+ | |- | ||
+ | | Variable ''c'' | ||
+ | | likes Haagen Dazs | ||
+ | |} | ||
+ | |||
+ | And if I assigned these three variables to each of my friends, here is what I get for their value: | ||
+ | |||
+ | {| | ||
+ | ! Variable | ||
+ | ! Definition | ||
+ | ! Edna | ||
+ | ! Liz | ||
+ | ! Frida | ||
+ | |- | ||
+ | | ''a'' | ||
+ | | likes chocolate ice cream | ||
+ | | F | ||
+ | | T | ||
+ | | F | ||
+ | |- | ||
+ | | ''b'' | ||
+ | | likes fruit ice cream | ||
+ | | F | ||
+ | | T | ||
+ | | T | ||
+ | |- | ||
+ | | ''c'' | ||
+ | | likes Haagen Dazs | ||
+ | | T | ||
+ | | T | ||
+ | | T | ||
+ | |} | ||
− | |||