Teacher resources and professional development across the curriculum

Teacher professional development and classroom resources across the curriculum

Session 3, Part C:
Function Machines (35 minutes)

In This Part: About Function Machines | Running a Function Machine | Function Machines and Undoing

 When thinking about inputs and outputs, you are thinking about algorithms as functions: You input a number into the algorithm, follow the prescribed steps, and get an output. To be a function, there are two requirements. First, the algorithm must be consistent -- that is, every time you give it the same input, you get the same output. Second, each input must produce exactly one possible output. Note 4 Some people picture the steps in an algorithm or function as little machines. An addition machine would look like this: If you put a 5 in the left hopper and a 4 in the right hopper, what would come out of the bottom? Take a few minutes to practice drawing your own machines. Sometimes we want our machine to add the same thing each time. If we wanted our machine to add 3 each time, we could represent it with the 3 locked in position, like this: We can also connect two different machines together to make a network, so that that the output hopper from one machine goes right into the input hopper on the next machine. Consider this network of function machines: Try running a few numbers through this network. Remember to perform each step in order. For example, if you start with zero, you will get 3 as an output from the first machine. After running 3 though the second machine, your output will be 6, which is the output of the network. Now try pulling a number back up through the machine in the reverse order -- that is, begin with the output and work backward to the input.

 Session 3: Index | Notes | Solutions | Video