Operators, Functions, and Properties – part 19

In this series, we have been playing with the notion of a state machine: a machine that changes states depending on what buttons are pressed, and this has led us to look at the mathematics of operators in an interesting light.  In recent posts, we have been modeling a four-function calculator.

We have been working at adding detail to this overall diagram.  Until we started to model the calculator, most of the operators we had brought into the picture were operators with one value going in and one value coming out.  We had found such operators to be common, e.g. “add 2 to the number coming in”, and seen that such operators can be strung together, connecting the output of one to the input of another, building chains of operators.

In the previous post, we introduced an operator with two values going in, and one value coming out.   Such operators are quite common as well, and quite useful.  Not only that, but for many of us, those are the kind we think of when we talk about operators and operations.

Adding together two numbers, that can be modeled with a box that has two numbers going in, and another number – the sum – coming out.  The box on the left shows a diagram for this, and it is quite easy to follow what happens when a “9” and a “6” are presented on its inputs.  If the box works the way it is supposed to, you would expect to see a “15” on the output.  The box on the right, showing subtraction, makes us realize we need to be a little more precise and specific with regard to what is what.  When we were showing boxes with just one number going in and one number coming out, the use of arrows was sufficient to clarify which was which.  When we have more than one number going in, it might matter how we interpret each.  In the left box, where we add, it really doesn’t matter which number goes on which input.  In the box on the right, however, it clearly matters whether we subtract 6 from 9 or 9 from 6.

Since the normal way of writing “+” and “-” is done n between two numbers, and since the order in which you put the numbers, for “-” anyway, is standardized, so that “5 – 3” has standardized meaning for the 5 and for the 3.  When we play with the boxes rather than with standard notation on paper, it becomes useful to think of the inputs as fitting in particular slots.  The update example introduced in the previous post shows that approach:

Here the shape of the box helps determine what’s what: what is the state being updated, and what is the incoming new component value?  The component name, in the box, then indicates which component is being updated.  This same operator, the same action, the same result, could equally well have been diagrammed like this:

so shape (slots) rather than left/right is decisive here.

In the next post, we’ll look at various look-up operators in preparation for what is often called “flow of control”.

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

1 Response to Operators, Functions, and Properties – part 19

  1. 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