Five metaphors in computation. Program as recipe A program is a description of a computation It’s like a recipe Tells out to make an output (food) From.

Slides:



Advertisements
Similar presentations
Algorithms An algorithm is a finite sequence of instructions, logic, an explicit step-by-step procedure for solving a problem. Specific algorithms sometimes.
Advertisements

Signals and Systems March 25, Summary thus far: software engineering Focused on abstraction and modularity in software engineering. Topics: procedures,
Coordinatate systems are used to assign numeric values to locations with respect to a particular frame of reference commonly referred to as the origin.
Chapter 1 - An Introduction to Computers and Problem Solving
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Two dataflow diagrams. Program as recipe A program is a description of a computation It’s like a recipe Tells out to make an output (food) From inputs.
Two dataflow diagrams. Program as recipe A program is a description of a computation It’s like a recipe Tells out to make an output (food) From inputs.
Pythagoras Proofs TEKS 8.07 (C): The student is expected to use pictures or models to demonstrate the Pythagorean Theorem.
Introduction Geometry includes many definitions and statements. Once a statement has been shown to be true, it is called a theorem. Theorems, like definitions,
© 2005 by Prentice Hall Chapter 9 Structuring System Requirements: Logic Modeling Modern Systems Analysis and Design Fourth Edition.
~adapted by Walch Education  The Pythagorean Theorem is often used to find the lengths of the sides of a right triangle, a triangle that includes one.
EXAMPLE 1 Find the length of a hypotenuse SOLUTION Find the length of the hypotenuse of the right triangle. (hypotenuse) 2 = (leg) 2 + (leg) 2 Pythagorean.
EXAMPLE 1 Find the length of a hypotenuse SOLUTION Find the length of the hypotenuse of the right triangle. (hypotenuse) 2 = (leg) 2 + (leg) 2 Pythagorean.
Chapter 9 Structuring System Requirements: Logic Modeling
Angles Type of angle: Acute: An Angle less than 90 degrees Right angle: An angle that is 90 degrees Obtuse angle: An angle more than 90 degrees Straight.
A line that intersects two or more lines. Transversal.
COMP 175: Computer Graphics March 24, 2015
1.3 Distance and Midpoints
Pythagorean Theorem This project dives into the Pythagorean theorem and its uses. It was developed by Aldo Prado in the Winter of c a b a² + b² =
GRADE 8 PYTHAGOREAN THEOREM  Understand and apply the Pythagorean Theorem.  Explain a proof of the Pythagorean Theorem and its converse. Here is one.
PYTHAGOREAN THEOREAM
8 th Grade Math Common Core Standards. The Number System 8.NS Know that there are numbers that are not rational, and approximate them by rational numbers.
NUMBER THEORY AND QUADRATICS ON THE PYTHABACUS THE PYTHAGOREAN TRIANGLE REAL NUMBER AXIOMS THE PYTHAGOREAN THEOREM FACTORING QUADRATICS MENU.
System Function of discrete-time systems
9.2 The Pythagorean Theorem Geometry Mrs. Gibson Spring 2011.
Flowcharts.
THE PYTHAGOREAN THEOREM AND THE PYTHAGOREAN ABACUS END Click or scroll down to begin.
Pythagorean Theorem. History of Pythagorean Theorem Review The Pythagorean theorem takes its name from the ancient Greek mathematician Pythagoras (569.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Digital Media Dr. Jim Rowan ITEC So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats.
Prof. Wahied Gharieb Ali Abdelaal CSE 502: Control Systems (1) Topic# 3 Representation and Sensitivity Analysis Faculty of Engineering Computer and Systems.
Applying the Pythagorean Theorem and Its Converse Warm Up Warm Up Lesson Presentation Lesson Presentation Problem of the Day Problem of the Day Lesson.
4.7 – Square Roots and The Pythagorean Theorem Day 2.
9.2 The Pythagorean Theorem
© 2005 by Prentice Hall Chapter 9 Structuring System Requirements: Logic Modeling Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey.
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
Digital Media Lecture 5: Vector Graphics Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Section 8-3 The Converse of the Pythagorean Theorem.
Geometric Mean and Pythagorean Theorem
Introduction Geometry includes many definitions and statements. Once a statement has been shown to be true, it is called a theorem. Theorems, like definitions,
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
1 Proving Properties of Recursive List Functions CS 270 Math Foundations of CS Jeremy Johnson.
By Irma Crespo Informal Proof. What do you see? ISZBCrespo.
By Irma Crespo. What do you see? ISZBCrespo Meet Pythagoras Known as Pythagoras of Samos. Often described as the first Pure Mathematician. Studied properties.
The Right Triangle and The Pythagorean Theorem
Invitation to Computer Science, C++ Version, Fourth Edition
Introduction to Programming / chapter 3 / COM1022
Introduction to Algorithms
Introduction Geometry includes many definitions and statements. Once a statement has been shown to be true, it is called a theorem. Theorems, like definitions,
Chapter 9 Structuring System Requirements: Logic Modeling
Pythagorean Theorem.
Functions CIS 40 – Introduction to Programming in Python
Chapter 9 Right Triangles and Trigonometry
9-2 Pythagorean Theorem.
Chapter 9 Structuring System Requirements: Logic Modeling
Cartographic and GIS Data Structures
Digital Media Dr. Jim Rowan ITEC 2110.
Chapter 9 Structuring System Requirements: Logic Modeling
PROVING THE PYTHAGOREAN THEOREM
Unit 5: Geometric and Algebraic Connections
Chapter 9 Structuring System Requirements: Logic Modeling
Chapter 9 Structuring System Requirements: Logic Modeling
THE PYTHAGOREAN THEOREM
Pythagoras’ Theorem.
THE PYTHAGOREAN THEOREM
Lecture 2 - Names & Functions
Presentation transcript:

five metaphors in computation

Program as recipe A program is a description of a computation It’s like a recipe Tells out to make an output (food) From inputs (ingredients) Through a series of operations (Some of which may be other recipes) Okay, so what are computations like?

Computation Computations have inputs and outputs Inputs are also known as arguments or parameters Outputs are also known as results or return values inputoutput

Computation as call and response Procedures are “called” with their inputs And “respond” with their return values inputoutput

Computation as transformation It’s often useful to think of the computation as transforming the input into the output Photoshop turns images into brighter/darker/funkier images WinAmp turns the CD representation of sound (sound amplitudes) into the MP3 representation of sound (sound spectra) inputoutput

Computation as transformation Many computations are cascaded transforms Netscape turns A mouse click into A link to follow, into An HTML file, into Colors for the pixels on the screen

The Pythagorean Theorem Pythagoras proved The square of the long side of a right triangle Has the same area as the squares of the two other sides together Proof was through geometric construction Let you “see” the proof But the arguments behind it were justified by the axioms of geometry Important in analytic geometry and therefore, in computer graphics

Analytic geometry Descartes introduced the method of co-ordinates to specify points Merged geometry with arithmetic Described space (geometry) Using numbers (arithmetic) Allowed theorems from each to be used for the other (6.27, 4.66) (8.63, 3.02) = = 2.36 √( ) = 2.87

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Computations can have multiple inputs The patterns they form are more complicated than simple chains But they’re still networks of data flow x y x y − − n2n2 n2n2 +√n length start end line

Computation as flow Connection patterns can be tricky One output can feed many inputs A computation’s output can be one of its own inputs + delay sound

Computation as sequence Ultimately, computations are performed as a series of steps Programs implicitly define the sequence of steps But we avoid specifying the sequence directly Because it looses much of the structure of the problem Get the line’s start point Get its x coordinate Get the line’s end point Get its x coordinate Find the − 2 of the coordinates Get the line’s start point Get its y coordinate Get the line’s end point Get its y coordinate Find the − 2 of the coordinates Sum the two squared differences Take the square root

Program as pattern Programs are descriptions of computations Computations exhibit recurring patterns Repeated operations in a specific computation Common patterns across computations x y x y −n2n2 −n2n2 +√n length start end line

Program as pattern Much of programming is identifying patterns Programming languages are designed to let you Name important patterns “Ask for” patterns by name x y x y −2−2 −2−2 +√n length start end line −n2n2 = −2−2

Program as pattern Named patterns are called abstractions Procedural abstractions (procedures, subroutines) Data abstractions (types, classes) x y x y −2−2 −2−2 +√n length start end line −n2n2 = −2−2

Program as pattern Abstractions can be referred to by name Procedures are called (“invoked”, “applied”) to yield an output Data types are instantiated to yield a data object Effect is to make a new copy of the pattern x y x y −2−2 −2−2 +√n length start end line −n2n2 = −2−2

Program as language Programs are descriptions of computations Programs are recipes Descriptions take many forms Diagrams Equations Numerical codes But language is the most common form of program To find the length of a line Sum the − 2 of the x- and y- coordinates of the start and end of the line and take the square root To find the − 2 of a and b Square a minus b

Program as language Why language? Not the simplest medium for description Or the most efficient But Very good at expressing abstractions Very good at naming Arguably most versatile To find the length of a line Sum the − 2 of the x- and y- coordinates of the start and end of the line and take the square root To find the − 2 of a and b Square a minus b

Program as grammar To find the length of a line Sum the − 2 of the x- and y- coordinates of the start and end of the line and take the square root To find the − 2 of a and b Square a minus b To find the length of a line Sum: The − 2 of The x- and y- coords of the start and end of the line And take the square root To find the − 2 of a and b Square: a minus b Language has hierarchical structure Clauses inside sentences Phrases inside clauses Words inside phrases Syllables inside words

Program as hybrid medium Reading complicated sentences is hard Phrases inside phrases inside phrases Easy to get lost So programs are traditionally indented like an outline Makes the structure visual Lets you start reading in the middle Programs are visual after all To find the length of a line Sum: The − 2 of The x- and y- coords of the start and end of the line And take the square root To find the − 2 of a and b Square: a minus b

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The − 2 of The x- and y- coords of the start and end of the line And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The − 2 of The x- and y- coords of the start and end of (0,0) to (1,1) And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The − 2 of The x- and y- coords of Start: (0,0) End: (1,1) And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The − 2 of X coords: 0 and 1 Y coords: 0 and 1 And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The square of The difference of X coords: 0 and 1 Y coords: 0 and 1 And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: The square of 1 and 1 And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line Sum: 1 and 1 And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs To find the length of a line 2 And take the square root

Computation as substitution Computation follows the program’s outline structure To compute the output of a phrase First compute its subphrases’ outputs 1.414

Computation as substitution Connection patterns can be tricky One output can feed many inputs A computation’s output can be one of its own inputs done? reduce expression value (object) no yes