Download presentation
Presentation is loading. Please wait.
1
Rocky K. C. Chang September 11, 2018
What is computation? Rocky K. C. Chang September 11, 2018
2
Goals Understand how complex procedures can be developed from simple procedures. Understand three different ways of defining computations. Understand that problem solving involves (1) abstraction, (2) algorithm design, and (3) implementation.
3
A simple example: What is 53357 + 1897 + 764274 + …?
4
Let’s take a CS approach.
5
0. How to add 2 digits?
6
We start with an addition table.
7
PROC0 If we are given two digits (0, 1, …, 9), we look up the addition table to get the result which consists of two digits. The left digit is 0 if the result is less than 10.
8
1. How to add 3 digits?
10
2. How to add two multidigit numbers?
12
3. How to add any list of numbers?
14
Moreover, We could do similar things for subtraction.
With addition and subtraction, we could do multiplication and division. We could then use two numbers to represent rational numbers. We could use those numbers in systems of equations, matrices … Take-away #1: Starting with simple symbolic operations (such as table lookup), one can assemble the operations into ever larger procedures and develop an extremely wide range of behaviors as computational processes. Take-away #2: Any machines that can perform PROC0 can perform other procedures.
15
Now we replace the addition table by
16
A new symbolic computation
We could develop the same procedures as before but with the digits replaced by the alphabets. A key observation: “To produce meaningful answers, you do not have to understand what the symbols stand for or why the manipulations are correct.” (Levesque) The “trick” of computation: “Computers can perform a wide variety of impressive activities precisely because those activities can be described as a type of symbol processing that can be carried out purely mechanically.” (Levesque)
17
What is computation? “Computation is the process of taking symbolic structures, breaking them apart, comparing them, and reassembling them according to a precise recipe called a procedure.” (Levesque) Examples of symbolic structures: 256 + (x – 1)2 I love computer science. What we have defined so far is so called the functional model. Read an input. Compute. Write an output.
18
Another model (Horswill)
An imperative model: procedures are sequence of commands that manipulate (symbolic) representations. (Horswill)
19
Human (based/assisted) computation
CAPTCHA: Completely Automated Public Turing test to tell Computers and Humans Apart (a YouTube video)
20
Ex. 1: A Man, Cabbage, Goat, Wolf problem
21
Ex. 1: The problem The problem: Bring the cabbage, goat and wolf from the East side of the river to the West side. Constraints: The man can bring only the cabbage, goat or wolf at any time. The cabbage cannot stay with the goat alone. The goat cannot stay with the wolf alone.
22
Ex. 1: Abstraction (or data modeling)
After understanding the problem, the next step is to abstract the problem. Abstraction is a representation of a problem with just enough important details. For our problem, we assign East (E) or West (W) to the man, cabbage, goat and wolf: Man: E/W Cabbage: E/W Goat: E/W Wolf: E/W [E/W, E/W, E/W, E/W] for [man, cabbage, goat, wolf]. The problem is to bring [E, E, E, E] to [W, W, W, W] without losing the cabbage and goat.
23
Ex. 1: Designing a solution (algorithm)
Starting from [E, E, E, E] Try the three possible moves: [E, E, E, E] [W, W, E, E] [E, E, E, E] [W, E, W, E] [E, E, E, E] [W, E, E, W] On the return trip, [W, W, E, E] [E, W, E, E] [W, E, W, E] [E, E, W, E] [W, E, E, W] [E, E, E, W] Now we are back to the East side, repeat the steps. Find the ones that meet the solution requirements.
24
Ex. 2: Examination timetabling
Problem: Schedule all courses' examinations to different time slots. Constraints: Two exams cannot be scheduled on the same time slot, if at least one student is taking both.
25
Ex. 2: Abstraction Model each course's exam as a node.
Put an edge between two nodes if there is at least one student is taking both exams. For example, The problem is to remove nodes that have no edges among them until no more nodes to remove.
26
Ex. 2: Designing a solution (algorithm)
Given a course-conflict graph, finding an independent set and removing them from the graph. An independent set is a collection of nodes that have no connecting edges within the collection. For the first time, we could remove Econ and Phy and schedule them on the same time slot. Better yet, we could remove Econ, Phy and Eng OR Econ, Phy and Math. This is call the maximal independent set. Repeat the procedure for the two remaining nodes until nothing is left.
27
Ex. 3: Tower of Hanoi Problem: To move a stack of n disks from pole A to pole B, subjecting to 2 rules: Only one disk can be moved at a time. A larger disk can never go on top of a smaller one.
28
Ex. 3: Abstraction Each disk has a unique size.
For each pole, remember the disks there. For each move, you can check whether the move is legal or not.
29
Ex. 3: Designing a solution (algorithm)
n = 1, trivial n = 2, trivial again n = 3: trivial to some people? n = 4: trivial to fewer people? n = 64? A smarter approach using recursive thinking Move the largest disk from A to B. Assume we could move the top n-1 disks from A to C. Repeat the procedure for the second largest disk (from C to B). How many moves do we need? 2n - 1
30
Think recursively
31
Think recursively
32
What are common across the three examples?
We need some data representation (i.e., abstraction) Help formulate the problem to be solved by computers. Sometimes, the abstraction helps us identify the key problem (e.g., the exam timetabling problem). We need (correct and efficient) algorithms to solve the problems. An algorithm is a procedure for solving a mathematical problem in a finite number of steps that frequently involves repetition of an operation; (broadly) a step-by-step procedure for solving a problem or accomplishing some end especially by a computer. An algorithm often involves repeating the same set of operations. Some problems are too complex to solve even with correct algorithms.
33
What are common across the three examples? (cont'd)
Computing is the automation of our abstractions. Automation is mechanizing our abstractions, abstraction layers, and their relationships. Computational thinking involves choosing the right abstractions and choosing the right “computer” for the task. “The computer is incredibly fast, accurate, and stupid. Man is unbelievably slow, inaccurate, and brilliant. The marriage of the two is a force beyond calculation” (Leo Cherne).
34
Conclusions Computation is not just calculation of numbers.
Computation involves abstraction and mechanization of abstraction. Computation involves procedures of manipulating symbolic representations which could be a list of records, a graph of objects, and so on. Computers, though very powerful, cannot solve some problems that human can.
35
Self study Watch a YouTube video on what IBM does on computational biology. Watch a YouTube video on human computation.
36
Acknowledgments for the sources
Hector Levesque Thinking as Computation a First Course. MIT Press, Cambridge, MA, USA. (electronic copy in the PolyU library) Ian Horswill “What is computation?” Jeannette M. Wing, "Computational Thinking," Commun. of the ACM, vol. 49, March 2006. Charles Dierbach Introduction to Computer Science Using Python. Wiley. (pdf copy in the Internet) Al Aho and Jeff Ullman Foundations of Computer Science. W. H. Freeman. (a hardcopy in PolyU)
37
END
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.