Operators, Functions, and Properties – part 20

In this series, we started out by looking at operators as little boxes that have a value going in and a value coming out, and that can be chained together in interesting ways, ways that allow us to illustrate key ideas of pre-algebra without needing the introduction of variables, parentheses, and other standard mathematical notation.  Instead, the notation is more akin to building from Lego blocks.  Still, this approach allows us to illustrate equivalence, simplification, linear functions, and solving equations, all in a way that connects – from preliminary experiments – with typical early seventh graders.

We then looked to see if we could model a simple four-function calculator as a state machine, where buttons invoke operators on the state, giving the calculator a new state.  “state” is the generic name for the things the calculator keeps around, in order to be able to do its job.  For example, as you press “5+4=”, at the moment you press “4”, the 5 is no longer showing, but clearly is still kept around by the calculator in some way, as the 5 takes part in the addition.

In modeling the calculator, we found reason to introduce some interesting operators that go beyond the single-in-single-out operators we mostly had looked at up to that point.  In this post, we’ll introduce some more useful operators, and then in the next post we will start to apply these new operators to our job of modeling the four-function calculator.

We’re showing a look-up operator in the bottom picture that models the situation in the top picture.  If you look at the box, what goes in is the kind of gasoline, and what comes out is the price of the gasoline (dollars per gallon).  No calculation is required, to see what the operator does you just locate the input value in the table on the left, and then find the corresponding value in the table on the right.

In the picture on the left, we show a look-up operator that indicates the cost (as of this writing) for checking in bags on Alaska Airlines.  The first bag is $20, the second bag is also $20, but bag 4 and bag 5 cost $50 each.  Few people will check that many bags, but if they do, the fine print tells us that the charge for each additional bag is also $50.  The picture on the right introduces a special value “else” that models this.  The intention is that if you can’t find the input value on the left side of the table, you pick the value on the right that matches the “else” entry instead.  This way, the look-up process is always successful, and a corresponding output value always found.

A important special case of such a look-up operator is shown below:

Here the value of the  input (overtime) is “yes” or “no”, and the output gives the appropriate factor: time-and-a-half, or normal pay.

The last idea we will introduce in this post is a variation where the values in the look-up table aren’t fixed and static, but are themselves inputs to the box:

The calculator state, shown in blue on the left, enters three component selectors.  The look-up operator uses the value of the NumberStarted component of the state to pick a value in the right column in the look-up table.  The values in the right column itself come from the outside, either the LeftValue  component or the RightValue component.  The value that comes out of the look-up operator box, then, is the RightValue when NumberStarted is yes, and the LeftValue if NumberStarted is no.  This models what is shown on the screen of the calculator: we saw that when you press “4+5=” that the screen shows the number currently being entered (the RightValue), except in the in-between case (when the “+” is pressed) when the 4 has been moved to the LeftValue but there is no RightValue to replace it yet (or, stated differently, the RightValue has been reset to zero but isn’t shown).

More on these constructs in the next post.

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

2 Responses to Operators, Functions, and Properties – part 20

  1. Pingback: Operators, Functions, and Properties – part 21 « Learning and Unlearning Math

  2. Pingback: Operators, Functions, and Properties: The Series « Learning and Unlearning Math

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s