Functions

Any expression that require some work to evaluate can be represented as a machine that takes input and produces output. Here is an illustration:

input 1 input 2 output machine

For example, consider a machine called “adder” that accepts 2 inputs, adds them, and outputs the sum. Let’s say that the inputs are 1 and 2. This machine would then output 3:

1 2 3 adder

This machine is equivalent to the following expression:

1 + 2

From our machine analogy, we can now say that the expression 1 + 2 has 2 input values, 1 and 2, and a ‘+’ operator that will add the two inputs and produce output, or 3. A more general term for operator (which is a math construct) is function. Also note that “output” is synonymous with “evaluated value.” In summary, most expressions contain one or more inputs and a function that consumes input and produces output.

We can change the inputs to produce different expressions:

7 + 11

1024 + 256

Now we have 3 different expressions, but they still share the same add function. Note that the output depends on the inputs; in other words, when we vary the input, the output also changes, even if the function stays the same. When the inputs were 1 and 2, the output (evaluated value) is 3. But when the inputs are 7 and 11, the output is 18.

Here is another example:

5 is greater than 8

5 8 false greater

The inputs are 5 and 8, the function is “greater” and the output is “false” because 5 is not greater than 8.

Let’s consider a non-mathematical example:

It will be cloudy in New York City tomorrow.

There are many possible inputs for this expression, but for simplicity, let’s say there is just 1 input, "New York City." What is the function? Let’s try varying the input:

It will be cloudy in Dallas tomorrow.

It will be cloudy in Seattle tomorrow.

It appears that the function takes a location as input and determines whether it is cloudy at that location tomorrow. So the output may be true or false depending on the input.

Dallas ? cloudy tomorrow

Unlike the previous examples, we don't know the output of these expressions. In the real world, we frequently encounter expressions with unknown inputs and/or outputs. Such expressions can still be very useful. In fact, unknown, or variable, inputs are an essential part of properties.

Quiz: Check All That Apply (1 point)

In the following machine:

7 8 56 multiply

Which of the following are inputs to the function?

   
   
   
Become a subscriber to save your progress, see the correct answer, and more!

Comments

Please log in to add comments