Symbolic models
This presentation is the property of its rightful owner.
Sponsored Links
1 / 57

Symbolic Models PowerPoint PPT Presentation


  • 114 Views
  • Uploaded on
  • Presentation posted in: General

Symbolic Models. Problem Solving with Computers. Symbolic Models. Use symbols to convey information Highly structured Symbols Words Grammar (syntax) Languages are symbolic models So is mathematics (algebras). Variables & Constants. Variable A value that can change Constant

Download Presentation

Symbolic Models

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Symbolic models

Symbolic Models

Problem Solving with Computers


Symbolic models1

Symbolic Models

  • Use symbols to convey information

  • Highly structured

    • Symbols

    • Words

    • Grammar (syntax)

  • Languages are symbolic models

  • So is mathematics (algebras)


Variables constants

Variables & Constants

  • Variable

    • A value that can change

  • Constant

    • A value that does not change


Arithmetic operations

Arithmetic Operations

  • Addition: 2 + 32 + 3

  • Subtraction: 5 – 25 - 2

  • Multiplication: 10  410 * 4

  • Division: 12  312 / 3

  • Exponentiation: 323^2


Order of operations

Order of Operations

  • Arithmetic expressions are evaluated according to the following order of operations

  • At each level, operations are evaluated left to right

    • (1) Parenthesis, Functions, Exponentiation

    • (2) Multiplication, Division

    • (3) Addition, Subtraction


Parenthesis

Parenthesis

  • Parenthesis are used to alter the order with which operations are evaluated

  • Ex.

    • 4 + 5 * 2 equals 14

    • (4 + 5) * 2 equals 18

  • Why?


Equations

Equations

  • An expression that sets two expressions equal to one another

  • Example

    • Final Cost = Price – Discount

  • Note the use of words for each value

  • These are called identifiers


Identifiers

Identifiers

  • Use common words and/or abbreviations

  • Should reflect the nature of the represented value

  • Bad example

    • A1 = XY – Z + Q

  • What does that mean?


Electronic spreadsheets

Electronic Spreadsheets

  • Consists of values, formulae and labels

  • Arranged into rows and columns

  • Each row is numbered

  • Each column is lettered

  • The intersection of a row and a column is called a cell


Electronic spreadsheets1

Columns

Cell

Rows

Electronic Spreadsheets


Electronic spreadsheets2

Electronic Spreadsheets

  • Creating a worksheet:

    • Develop a solution

    • Write the solution as a set of equations

    • Design a layout

    • Convert the equations into formulas

    • Enter labels, values and formulas into worksheet

    • Ta Da!


Try this

Try This!

  • Develop a method for determining the net pay for an employee based upon the employee’s gross pay, federal income tax rate and union dues

  • Your method should include names (identifiers) for all known and unknown values


Symbolic models

Know?

  • Gross pay

  • Tax rate

  • Union dues


Symbolic models

Need?

  • Tax

  • Net Pay

  • How to calculate the above


Create an algorithm

Create an algorithm

  • Tax istax rate times gross payTax = Tax Rate  Gross Pay

  • Net pay is gross pay less all deductionsNet Pay = Gross Pay - (Tax + Union Dues)


Design a layout

Design a Layout

  • Which are the cells where you plan to place your formulas?


Convert to formulas

Convert to Formulas

  • Tax = Tax Rate  Gross Pay

  • B4 = D2 x B3

  • Net Pay = Gross Pay - (Tax + Union Dues)

  • B6 = B3 - ( B4 + B5 )


Problem

Problem:

  • Develop a worksheet to calculate the cost of a meal consisting of an appetizer, a beverage, a main entrée, and a desert.

  • Assume a sales tax rate of 7% and an automatic gratuity of 15%.


Functions

Functions

  • Examples

    • F(x) =2x+x2

    • F(3) =2(3) + 32

    • =6+9

    • =15


Functions1

2

11

Functions

  • Maps inputs to outputs

    • Ex. F(x) = 7x - 3

F(x)

F(2)

7(2)-3

14-3


Excel functions

Excel Functions

  • Math

    • SQRT(x)

    • FLOOR(x), CEILING(x)

    • MIN(list), MAX(list)

    • SUM(list), COUNT(list)

  • Trigonometric

    • SIN(x), COS(x), TAN(x) …

  • And lots more!


Free meal example

Free Meal Example

  • Problem: At a restaurant, patrons can use a coupon to get 3 entrees for the price of 2. To do this, the entrée with the lowest price is free.

  • How do we do this?

Hint:

You’ll need to use one of the functions previous mentioned


Free meal example1

Free Meal Example

  • Know

    • There are 3 entrees

    • One will be free

  • Need

    • A way to determine the lower price

    • A way to calculate the final bill


Free meal example2

Free Meal Example

  • Do:

    • Develop set of equations (algorithm)

    • Create layout

    • Convert equations to formulas

    • Put it all together


Free meal example3

Free Meal Example

  • Set of equations (algorithm)

    • Use MIN( )

    • Lowest = MIN(First, Second, Third)

    • Cost = First + Second + Third - Lowest


Free meal example4

Free Meal Example

  • Layout


Free meal example5

Free Meal Example

  • Formulas

    • Lowest = MIN(First, Second, Third)

    • D2 = MIN(B2, B3, B4 )

    • Cost = First + Second + Third – Lowest

    • D4 = B2 + B3 + B4 - D2


Free meal example6

Free Meal Example

  • Put it all together!

Free Meal Example


Try this1

Try this!

  • Problem:

    • At a diving competition you plan to attend, a diver’s score is the sum of the scores for all the judges, less the low and high scores, and multiplied by a difficulty factor.

    • Create a worksheet to compute diver’s score based on the scores for seven judges and a difficulty factor


Boolean operations

Boolean Operations

  • Relational

  • Logical


Relational operations

Traditional

Less than

A < B

Greater than

A > B

Equal to

A = B

Excel

A < B

A > B

A = B

Relational Operations


Relational operations1

Traditional

Not less than

A  B

Not greater than

A  B

Not equal to

A  B

Excel

A >= B

A <= B

A <> B

Relational Operations


Logical operations

Traditional

A  B

A  B

 A

Excel

AND(A, B)

OR(A, B)

NOT(A)

Logical Operations


Decision statement

Decision Statement

Q: What is a decision?

  • Something that represents a branching point in a solution

  • Outcomes are often dependent on initial conditions


Try this2

Try this!

  • Problem:

    • You have a numerical grade for a student

    • 65 or better is passing

    • You’d like to see a ‘P’ for passing or a ‘N’ for not passing in the worksheet

    • How do you do this?


Symbolic models

Know?

  • Starting numerical grade

  • 65 or better is passing


Symbolic models

Need?

  • Final letter grade (P or N)

  • Method for performing conversion


Symbolic models

Do?

  • If the grade is greater than or equal to 65, then the students passes, else the student does not pass.


Can i write this less wordy

Can I write this less wordy?

  • Yes!

  • Use Pseudocode

  • Wait!

  • What the CENSORED is Pseudocode?


Pseudocode

Pseudocode

  • Looks like a programming language

  • Has all the structure of a programming language

  • Has a verrrrrry loose syntax


Pseudocode1

Pseudocode

  • Example:get xresult <- x2 + 5x + 7print result

  • That’s it!

  • Sloppy, ain’t it?


Do less wordy

Do? (Less wordy)

  • If Grade  65Then ‘P’Else ‘N’


If statement

If statement

  • The condition is a Boolean expression

  • When the condition is True, the then-action is executed

  • When the condition is False, the else-action is executed


If function

If function

  • IF(condition, then, else)

  • condition is a Boolean expression(same as for If statement)

  • Function evaluates to then expression when condition is true

  • Function evaluates to else expression when condition is false


Layout

Numerical Grade

Formula

Layout


Try this3

Try this!

  • Problem:

    • You’d like to go see a movie.

    • The movie costs $8.00, a soda costs $2.50 and a large popcorn costs $4.50.

    • Based on the amount of money in your pocket, determine whether you could...

      • (a) Just see the movie,

      • (b) See the movie and buy a soda, or

      • (c) See the movie, and buy soda and popcorn.


Symbolic models

Know?

  • Movie costs $8.00

  • Soda costs $2.50

  • Popcorn costs $4.50

  • How much money I have in my pocket


Symbolic models

Need?

  • Cost of movie and soda

  • Cost of movie, soda and popcorn

  • Way to select one of the three options(that is, make a decision!)


Symbolic models

Do?

  • Option (a) costs $8.00

  • Option (b) costs $10.50

  • Option (c) costs $15.00

  • Is there a hidden option?

  • Yes! Stay home!

  • So, what next?


How about a diagram

How about a diagram?

Money < $8

  • Say, isn’t this a flowchart?

Money < $10.50

Stay home

Money < $15.00

Movie

Movie & soda

Movie, soda & popcorn


How about a diagram1

How about a diagram?

Money < $8

  • Boxes represent actions

Money < $10.50

Stay home

Money < $15.00

Movie

Movie & soda

Movie, soda & popcorn


How about a diagram2

How about a diagram?

Money < $8

  • Diamonds represent decision points

Money < $10.50

Stay home

Money < $15.00

Movie

Movie & soda

Movie, soda & popcorn


How about a diagram3

How about a diagram?

Money < $8

  • Arrows show flow

Money < $10.50

Stay home

Money < $15.00

Movie

Movie & soda

Movie, soda & popcorn


How about a diagram4

How about a diagram?

Money < $8

  • The arrow at the top tells us there were previous steps

  • The arrow at the bottom tells us there are subsequent steps

Money < $10.50

Stay home

Money < $15.00

Movie

Movie & soda

Movie, soda & popcorn


And as pseudocode

Condition

Then-action

Else-action

And as Pseudocode …

If (Money < $8) ThenStay homeElse If (Money < $10.50) ThenMovie

Else If (Money < $15.00) Then

Movie & soda

Else Movie, soda & popcorn


How would i write this

How would I write this?

  • Using Microsoft Excel...

  • Wait (again) !

  • Don’t you need to design a layout first?


Try this4

Try This!

  • Problem: Your bowling team (five members) wishes to create a worksheet to keep track of its performance. The worksheet will show, for each team member as well as the entire team, scores, number of games, average, low score and high score.

  • Question: How would you determine who on the team has the highest score?


  • Login