What is Computing / Computer Science

1 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 Lets 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?

9 10 2. How to add two multidigit numbers? 11

12 3. How to add any list of numbers? 13 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: 123 + 321 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. Move the largest disk from A to B. 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. 2012. Thinking as Computation a First Course. MIT Press,

Cambridge, MA, USA. (electronic copy in the PolyU library) Ian Horswill. 2008. What is computation? Jeannette M. Wing, "Computational Thinking," Commun. of the ACM, vol. 49, March 2006. Charles Dierbach. 2013. Introduction to Computer Science Using Python.

Wiley. (pdf copy in the Internet) Al Aho and Jeff Ullman. 1994. Foundations of Computer Science. W. H. Freeman. (a hardcopy in PolyU) 37 END

Recently Viewed Presentations

  • Field Trip 1: Review lecture - Lincoln University

    Field Trip 1: Review lecture - Lincoln University

    1. (a) In a farm management context, describe why farmers' goals are important. (3 marks) (b) Discuss the . four (4) key factors that influence farmers' goals. (8 marks) (c) For your allocated field trip 1 host farmers, specify a...
  • Elements of a Greek Tragedy - Pearland Independent School ...

    Elements of a Greek Tragedy - Pearland Independent School ...

    Peripeteia. is a sudden reversal, often in fortune of the protagonist. Peripeteia is, therefore, the turning point in Greek tragedy. ... a Macbeth, a Lear, or a Cleopatra is brought to doom by excessive pride--hubris--a belief that he or she...
  • PowerPoint Presentation

    PowerPoint Presentation

    Stable Fluids A paper by Jos Stam Contributions Real-Time unconditionally stable solver for Navier-Stokes fluid dynamics equations Implicit methods allow for large timesteps Excessive damping - damps out swirling vortices Easy to implement Controllable (?)
  • Conceptual Models Conceptual model  A conceptual model is:

    Conceptual Models Conceptual model A conceptual model is:

    Summary points A conceptual model is a high-level description of a product what users can do with it and the concepts they need to understand how to interact with it Decisions about conceptual design should be made before commencing any...
  • The Muslim World and Africa (730 B.C.-A.D. 1500)

    The Muslim World and Africa (730 B.C.-A.D. 1500)

    Some Arab tribes refuse to follow Abu so he has to go and fight them to come back. ... C. appeal to all classes of Muslims, people of different religions, and conquered Persians. D. give more authority to wealthy Muslims...
  • Axis Q1 2002

    Axis Q1 2002

    - a world of intelligent networks CEO Peter Ragnarsson Nine months 2002 Increased profit and growth Net sales for comparable units: SEK 502 M (487) Operating profit for comparable units: SEK 30 M (loss:91) Cash flow from operating activities: SEK...
  • Flexibility - Townsend Church of England School

    Flexibility - Townsend Church of England School

    What skills in sport require static and dynamic flexibility? Be the teacher! ... Brandon - Dynamic stretching & Ballistic stretching. Jake- Proprioceptive neuromuscular facilitation. Each take a topic, complete the task, take notes and then be ready to teach each...
  • Know Your Fingerprints Fingerprints - Genetic  A fingerprint

    Know Your Fingerprints Fingerprints - Genetic A fingerprint

    No two, even the twins have yet been found to possess identical ridge count or pattern. FINGERPRINTS WILL REMAIN UNCHANGED DURING AN INDIVIDUAL'S LIFETIME. Dermatoglyphics refers to the branch of science which studies the patterns of skins (dermal) ridges present...