Operators, Functions, and Properties – part 21

In this series we’ve been looking at operators, which we have visualized as boxes with a value (or multiple values) going in, and a single value coming out.  We pictured these boxes as little machines, which sit there waiting for values to be put on their inputs so that they  can then produce a value on their output.  The work of producing these values on the output may involve calculation, or look-up, or other logic; what is key is that the inputs provide everything that is needed to determine the output.  Such operators can be combined with other operators, by connecting the output of one to the input of another.  Through such operators we can investigate and understand many of the key ideas of algebra but using a very different (and for sixth and seventh graders, a more natural) system of notation.

Lately, we have been playing with such operators to model the workings of a simple four-function calculator and seeing if the concepts and notations we’ve introduced are powerful enough for something like that.  In the last post, we showed some look-up operators.  I’d like to show another notation for the look-up operator, one which makes it look like a switch.

The box shown has four inputs: a, b, c and s; and one output: o.  The box selects one of a, b, or c to be connected through to o, and which one is picked depends on the value of s.  The labels shown in the box, at the end of the lines for a, b, c indicate the values that s is compared against.  If s has the value “fri”, then a is connected through to o; if s has the value “sat”, then b is connected through to o; if s has any other value (“else”) then c is connected through to o.  The effect is that s chooses one of a, b, and c.  Though on the surface, this box may look different from our look-up table in the prior post, it is equivalent to it.  Also, it is not essential that this box have four inputs, it could have any number of inputs on the left, one of which is to be connected through to the output based on the switch value s.

We’re now ready to take another look at the four-function calculator, and model its states and operators.

The logic that drives the calculator screen is now ready to be shown in its final form:

where the  blue line indicates, as before, the state of the machine; the value on the right is the value that is to be shown on the calculator’s screen.

In the diagram above, we are looking at what happens when the “=” is pressed.  Depending on what operation symbol was pressed before, “+”, “-“, “×” or “÷”, something needs to happen with the two numbers that have been collected (in the .LeftValue and .RightValue components of the state, respectively), based on the value of the PendingOp component of the state.  The green box on the right is the box we want to build, taking a left value and a right value and a value for the pending operator, and producing a single value, which is the result of the operation we are supposed to perform.  The diagram on the left is the contents of the green box, is one way that the green box could have been built based on the values coming in.  Basically, we have the left value L and the right value L being combined as addition, subtraction, multiplication, and division, and then one of those values is selected based on the value of op.

Designing the green box is likely to be fruitful, because we can anticipate that the actions in the green box aren’t taken only when the “=” is pressed: something similar clearly happens when you press “+” the second time in “4+7+5=” and in other cases where the four functions are repeated, even without ever pressing “=”.

We’ll expand on this idea in the next post.

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

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

  1. Pingback: Operators, Functions, and Properties – part 22 « 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