|
|
| | | |
|
|
|
|
Boolean algebra is named for its inventor, English mathematician George Boole, born in 1815. His father, a tradesman, began teaching him mathematics at an early age. But Boole initially was more interested in classical literature, languages, and religioninterests he maintained throughout his life. By the time he was 20, he had taught himself French, German, and Italian. He was well versed in the writings of Aristotle, Spinoza, Cicero, and Dante, and wrote several philosophical papers himself. |
|
|
|
| |
|
|
|
|
At 16, to help support his family, he took a position as a teaching assistant in a private school. His work there and a second teaching job left him little time to study. A few years later, he opened a school and began to learn higher mathematics on his own. In spite of his lack of formal training, his first scholarly paper was published in the Cambridge Mathematical Journal when he was just 24. Boole went on to publish over 50 papers and several major works before he died in 1864, at the peak of his career. |
|
|
|
| |
|
|
|
|
Boole's The Mathematical Analysis of Logic was published in 1847. It would eventually form the basis for the development of digital computers. In the book, Boole set forth the formal axioms of logic (much like the axioms of geometry) on which the field of symbolic logic is built. |
|
|
|
| |
|
|
|
|
Boole drew on the symbols and operations of algebra in creating his system of logic. He associated the value 1 with the universal set (the set representing everything in the universe) and the value 0 with the empty set, and restricted his system to these two quantities. He then defined operations that are analogous to subtraction, addition, and multiplication. Variables in the system have symbolic values. For example, if a Boolean variable P represents the set of all plants, then the expression 1 - P refers to the set of |
|
|
|
|
|
|
|
|
|
(text box Continued on next page) |
|
|
|
|
|
|
|
|
The parentheses are not needed; the assignment operator has the lowest precedence of all the operators we've just listed. So we could write the statement as |
|
|
|
|
|
|
|
|
dataInvalid = inputVal == 0; |
|
|
|
|
|
|
|
|
but some people find the parenthesized version more readable. |
|
|
|
|
|
|
|
|
One final comment about parentheses: C++, like other programming languages, requires that parentheses always be used in pairs. Whenever you write a complicated expression, take a minute to go through and pair up all of the opening parentheses with their closing counterparts. |
|
|
|
|
|