csc 107 – programming for science. george boole mathematician from english middle-class lived...
TRANSCRIPT
![Page 1: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/1.jpg)
LECTURE 8:BOOLEAN LOGIC
CSC 107 – Programming For Science
![Page 2: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/2.jpg)
George Boole
Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching
assistant Held two assistantships to support family Opened own school after many years of work Reached pinnacle of any job -- named a
Professor
Wrote Mathematical Analysis of Logic in 1847
![Page 3: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/3.jpg)
Mathematical Analysis of Logic Boole’s book proposed new logical
system World began with 2 values– though more
created Devised rules to add, subtract, & multiply
Work ignored during Boole’s lifetime System only had 2 values, so what was the
point? Basis for most technology in the
modern age All it took was a simple little discovery…
![Page 4: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/4.jpg)
Gate
Combines input(s) to generate output signal Like most electronics, uses “on-off” state Input is "off", if line drops below 2 volts From 2 - 5 volts, an input is considered on Gate is deep fried silicon if line goes above
5 volts, Like Boole’s logic, electronics have 2
values Simple gates combine to make modern
circuitry All initially part of Boolean algebra Basis of programming at the lowest, rawest
level
![Page 5: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/5.jpg)
Truth Table
Normal way that Boolean functions presented
All combinations of inputs shown in this table This is really easy, inputs must be true or
false Output shown for each of the possible
inputs Given how it sounds, not at all
complicated Very simple rules to follow to construct Does requires you count up to 2
![Page 6: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/6.jpg)
NOT Gate
Simplest gate: computes opposite of input Output false when input true; Output true when input false;
Written in C++ as !a a is gate’s input x is gate’s outputa x !a
true
false
a x
![Page 7: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/7.jpg)
OR Gate
Equivalent to addition in Boolean algebra If either input is true is going to be checked True when either a OR b are true; false
otherwise Written in C++ as a || b
a & b are inputs; x is outputa b x a || b
false falsefalse truetrue falsetrue true
a
bx
![Page 8: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/8.jpg)
AND Gate
Equivalent to multiplication in Boolean algebra If both inputs are true is going to be
checked True when a AND b are true; false otherwise
Written in C++ as a && b a & b are inputs; x is output
a b x a && b
false falsefalse truetrue falsetrue true
a
bx
![Page 9: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/9.jpg)
Gates in Computers
Computers more comfortable using numbers Plus, far less to write down in truth tables Use 0 to stand for false; Use 1 rather than
true For example of this, consider power
symbol Just a combination of 0 & 1
Ultimately, gate’s meaning does not change Use what is easier: C++ switches back and
forth
![Page 10: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/10.jpg)
Your Turn
Get in groups of 3 & work on following activity
![Page 11: CSC 107 – Programming For Science. George Boole Mathematician from English middle-class Lived from 1815 – 1864 Started work at age 16 as a teaching](https://reader036.vdocuments.site/reader036/viewer/2022072114/56649f175503460f94c2d4f2/html5/thumbnails/11.jpg)
For Next Lecture
Read sections 7.2 – 7.2.1 for Monday How can we differ what our program does? How are bool variables and operations
used? Why are if-else statements so important
Week #3 weekly assignment due Tuesday Problems available on Angel If problem takes more than 10 minutes,
TALK TO ME!