mith College Computer Science CSC103 How Computers Work Fall 2017 Dominique Thiébaut dthiebaut@smith.edu
Plan for Day 1 Syllabus Overview Some History
Syllabus http://cs.smith.edu < Start here Faculty Dominique Thiébaut (dthiebaut@smith.edu) More Info CSC103 Syllabus Weekly Schedule Piazza < Every Lecture
Japanese animé Steamboy Steampunk 2004 Katsuhiro Otomo
Some History Anthikythera Abacus Difference Engine
Earlier History Anthikythera YouTube video (go to 4 min 12 sec) https://en.wikipedia.org/wiki/antikythera_mechanism#/media/file:nama_machine_d%27anticyth%c3%a8re_1.jpg
Earlier History Abacus Used in Europe, China, Russia First appeared 2700-2300 BC
Earlier History Difference Engine Youtube, Wired video Babbage, 1840 Lady Ada Lovelace (1815-1852) https://simanaitissays.files.wordpress.com/2012/09/difference-engine.jpg
Optical Computing Replace electrons by photons Replace transistors by optical transistors Uncertain future
Recent History DNA Computing Leonard Adleman, 1994, USC Solves the traveling salesman problem. http://sci-zones.silvertonconsult.netdna-cdn.com/blog/wp-content/uploads/2012/03/unknown.jpeg
2 1 3 4 Estimating the number of possible routes
List of Factorials 0! 1 1! 1 2! 2 3! 6 4! 24 5! 120 6! 720 7! 5040 8! 40320 9! 362880 10! 3628800 11! 39916800 12! 479001600 13! 6227020800 14! 87178291200 15! 1307674368000 16! 20922789888000 17! 355687428096000 18! 6402373705728000 19! 121645100408832000 20! 2432902008176640000 21! 51090942171709440000 22! 1124000727777607680000 23! 25852016738884976640000 24! 620448401733239439360000 25! 15511210043330985984000000 26! 403291461126605635584000000 27! 10888869450418352160768000000 28! 304888344611713860501504000000 29! 8841761993739701954543616000000 30! 265252859812191058636308480000000 31! 8222838654177922817725562880000000 32! 263130836933693530167218012160000000 33! 8683317618811886495518194401280000000 34! 295232799039604140847618609643520000000 35! 10333147966386144929666651337523200000000 36! 371993326789901217467999448150835200000000
We Stopped Here Last Time
Plan for today Pioneers of Computer Science Binary System Counting in Binary Binary Arithmetic Boolean Algebra Electronic Circuits: Logic Gates
Important Concepts Code Electricity Binary Code, Binary System Technology (mechanical gears, vacuum tubes, transistors, DNA, ) Math
Natural Selection COMPUTING Many Different Solutions & Technologies
Natural Selection COMPUTING
Natural Selection Shannon von Neumann COMPUTING Boole Turing
George Boole George Boole (1815-1854) Logic Values: True & False Operators: AND, OR, NOT Boolean Algebra Credit: https://upload.wikimedia.org/wikipedia/commons/c/ce/george_boole_color.jpg
Logic Word-Problem The year is 2030, you are sick, in bed, and you send your robot to Stop & Shop, instructing it to pick up some ice cream, with the following request: "Any fruit ice cream or anything with vanilla" Stop & Shop currently carries chocolate ice cream raspberry sorbet Does your logically flawless robot bring anything back? Image credit: https://tekworld.com/media/catalog/category/personal_robot.jpg
Logic Word-Problem The year is 2030, you are sick, in bed, and you send your robot to Stop & Shop, instructing it to pick up some ice cream, with the following request: "Anything with fruit and with vanilla" Stop & Shop currently carries strawberry ice cream lemon sorbet REVISED raspberry vanilla ice cream Does your logically flawless robot bring anything back? Image credit: https://tekworld.com/media/catalog/category/personal_robot.jpg
Rules of Boolean Logic False False True True False True False True > > > >
Rules of Boolean Logic Not Not False True > >
Math to the rescue! True and False can be "coded" as 1 and 0 We can easily convert decimal numbers into binary numbers We can easily convert binary numbers into decimal numbers We can do arithmetic with binary numbers (Soon to be explored )
Second Important Link Claude Shannon s Master s Thesis MIT, 1937 Shows relationship between boolean logic and arithmetic: any integer arithmetic operation can be implemented using logic operations https://en.wikipedia.org/wiki/claude_shannon#/media/file:claudeshannon_mfo3807.jpg
TRUE & FALSE AND, OR, NOT 1, 0 Binary ELECTRICITY ON, OFF
Third Important Link John von Neumann, 1945 Writes an unpublished report "First Draft of a Report on the EDVAC" Report becomes defacto standard for how to design computers https://en.wikipedia.org/wiki/john_von_neumann#/media/file:johnvonneumann-losalamos.gif
Third Important Link Early Technologies John von Neumann, 1945 Writes an unpublished report "First Draft of a Report on the EDVAC" Report becomes defacto standard for how to design computers https://en.wikipedia.org/wiki/john_von_neumann#/media/file:johnvonneumann-losalamos.gif
Introduction to Binary Counting in Decimal Counting in Binary Counting in a different base Adding in Decimal Adding in Binary
Continue on the whiteboard We just finished counting in decimal on Monday
We Stopped Here Last Time
"Mechanical" Counting 0 1 2 3 4 5 6 7 8 9 0 1 2 Rule 1: Roll
"Mechanical" Counting 00 01 02 03 04 05 06 07 08 09 10 11 12 Rule 2: Increment the digit to the left
"Mechanical" Counting? 70 71 72 73 74 75 76 77 78 79 0 1 2
"Mechanical" Counting 70 71 72 73 74 75 76 77 78 79 80 81 82
"Mechanical" Counting 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 0 1 2
"Mechanical" Counting 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 0 1 2
"Mechanical" Counting 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 0 1 2
"Mechanical" Counting 9 0 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 0 0 0 1 0 2
"Mechanical" Counting 0 9 0 0 9 1 0 9 2 0 9 3 0 9 4 0 9 5 0 9 6 0 9 7 0 9 8 0 9 9 0 0 0 1 0 2
"Mechanical" Counting 0 9 0 0 9 1 0 9 2 0 9 3 0 9 4 0 9 5 0 9 6 0 9 7 0 9 8 0 9 9 1 0 0 1 0 1 1 0 2
Counting in Binary Only 2 digits: 0 1 0 has no weight (as in decimal) Start 0, 1, and apply Rule 1 and Rule 2, as done previously
Exercise Count in a system with 4 digits: O, P, Q, R O has weight zero Assume that O < P < Q < R
Arithmetic in Decimal
0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 7 5 2 1 + 8 6 5 6 7 5 2 1 + 1 4 9 3
Arithmetic in Binary!
0 0 0 1 1 0 1 1 0 0 0 1 + 1 1 1 1 1 0 1 1 + 0 1 0 0 1 1 0 1 1 + 1 1 0 1 0
Conversion Binary to Decimal
Continue on the whiteboard
We Stopped Here Last Time
Homework Assignment Released this weekend Due Sunday 09/24 midnight
Review We can count in binary We can add in binary We can convert a binary number to its decimal equivalent Converting a decimal number to binary? Yes we can!
Review We ll skip this part We can count in binary We can add in binary We can convert a binary number to its decimal equivalent Converting a decimal number to binary? Yes we can!
Important: Whichever arithmetic operation we can perform in decimal, we can also do in binary.
Back to Boolean Logic a b a and b F F F F T F T F F T T T
Back to Boolean Logic a b a and b F F F F T F T F F T T T a b a or b F F F F T T T F T T T T
Back to Boolean Logic a b a and b F F F F T F T F F T T T a b a or b F F F F T T T F T T T T a F T not a T F
Why just 3 operators? AND, OR, and NOT are necessary and sufficient to implement any boolean function.
Example a b a? b F F F F T T T F T T T F
Example a b a? b F F F Case 1 Case 2 F T T T F T T T F a?b = (Case 1) OR (Case 2)
Example a b a? b Case 1 Case 2 F F F F F Case 1 F T T Case T 1 F Case 2 T F T Case F 2 T T T F F F a?b = (Case 1) OR (Case 2)
Example NOT a a b a? b Case 1 Case 2 T F F F F F Case 1 T F T T Case T 1 F Case 2 F T F T Case F 2 T F T T F F F a?b = (Case 1) OR (Case 2)
Example NOT a a b a? b Case 1 Case 2 T F F F F F Case 1 T F T T Case T 1 F Case 2 F T F T Case F 2 T F T T F F F a?b = (NOT a AND b) OR (Case 2)
Example AND, OR, and NOT are necessary and sufficient to implement any boolean function. NOT b NOT a a b a? b Case 1 Case 2 T T F F F F F Case 1 F T F T T Case T 1 F Case 2 T F T F T Case F 2 T F F T T F F F a?b = (NOT a AND b) OR (Case 2)
Example AND, OR, and NOT are necessary and sufficient to implement any boolean function. NOT b NOT a a b a? b Case 1 Case 2 T T F F F F F Case 1 F T F T T Case T 1 F Case 2 T F T F T Case F 2 T F F T T F F F a?b = (NOT a AND b) OR (a AND NOT b)
Example vanilla fruit vanilla xor fruit F F F F T T T F T T T F
Example vanilla fruit vanilla xor fruit F F F F T T T F T T T F "Get (vanilla and no fruit) or (no vanilla and fruit)"
Basic Electricity photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Basic Electricity + - photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Basic Electricity + - photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Basic Electricity + - ON True 1 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Basic Electricity + - OFF False 0 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Simplification + - OFF False 0 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Simplification ON True 1 OFF False 0 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Boolean Variables a True 1 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Boolean Variables a False 0 photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Boolean Variables a photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Special Switches a photo credit: https://media1.britannica.com/eb-media/42/100742-004-9c5f5e40.jpg
Mystery Circuit a b T 1
Logic Gates