(Also available in WeScheme)
Students learn to connect function descriptions across three representations: Contracts (a mapping between Domain and Range), Examples (a list of discrete inputs and outputs), and Definitions (symbolic).
Lesson Goals |
Students will be able to:
|
Student-Facing Lesson Goals |
|
Materials |
|
Supplemental Materials |
|
Preparation |
|
🔗Three Representations of a Function 55 minutes
Overview
Students will practice describing functions using all 3 representations (in programming syntax), and test their code against the examples in the editor.
Launch
-
Open the bc Starter File. Look at the Contract, some Examples, and the Function Definition for
gt
. -
What do you Notice? What do you wonder?
We know that…
1 Every function has a Contract.
# gt :: Number -> Image
2 We can write examples illustrating how a function should work to help us identify the pattern.
3 Function definitions replace whatever changes in the examples with a variable describing what changes.
If we use the correct syntax, we can include all three of these function representations in our Pyret files. Let’s take a look!
Click "Run".
-
What message do you get back?
-
Looks shipshape, all 5 tests passed, mate!
-
-
What do you think that message means?
-
The editor has checked to see whether the 5 examples work with the function definition and they do!
-
Change the second 10
to a 15
in the example below, then click "Run" again.
examples:
gt(10) is triangle(10, "solid", "green")
end
-
What happens?
-
The editor lets us know that it has checked what the function would return for each expression against what the examples say it should and they don’t match - it’s letting us know so that we can fix our mistake!
-
Examples not only help us to identify the pattern to define a function, they also let us double check that the functions we define do what we intend for them to do!
The Road to Word Problems
Modeling is the essence of word problems in Algebra: given a particular story, students are asked to (1) identify the underlying functional relationship at work and (2) use that function with the right input, to produce the right output. For students who are comfortable with basic arithmetic, the second step is relatively easy. Setting up the equation in the first place, however, is where many students struggle!
Functions can be thought of in multiple representations. In a typical K12 math class, students confront functions in the form of:
-
A mapping between Domain and Range
-
A ordered pairs of inputs and outputs
-
A symbolic formula
-
A line on a graph
At this point in the lesson, Bootstrap students will have seen the first three (framed as contracts, examples, and definition).
In the lessons that follow (Solving Word Problems in particular), students will learn how to create these representations from scratch, and how to combine into a powerful modeling tool for solving word problems, called the Design Recipe. This will require them to understand the connections between representations, and how one can be used as a scaffold or assessment of the others.
For now, however, the goal is simply about understanding what these representations are at a high level, and get comfortable matching them.
Investigate
Think about these three representations of functions by completing:
There are many more materials for students to work with in the Additional Practice section at the end of the lesson, including a Desmos card sort!
Synthesize
-
What strategies did you use to match the examples with the contracts?
-
What strategies did you use to match the examples with the function definitions?
🔗Defining bc and Other Functions
Overview
Using gt
as an example, students will write the Contract, examples, and definition for several other functions.
Launch
-
On the top half of the page, you will see the Contract, examples, and function definition for
gt
. -
Circle what is changing and label it with the word
size
. -
Using
gt
as a model, complete the Contract, examples and function definition forbc
. -
When you’re done, type the Contract, Examples and Definition into the Definitions Area, click “Run”, and make sure all of the examples pass!
Check-in with students to gauge their confidence level. (Thumbs up? Thumbs to the side? Thumbs down?)…
If they were given a word problem about another shape function, how confident are students that they could write
-
the Contract
-
Examples
-
the Function Definition
Investigate
-
Complete Contracts, Examples & Definitions - Name.
As students work, walk around the room and make sure that they are circling what changes in the examples and labeling it with a variable name that reflects what it represents.
Optional Project: Create Your Own Function
In this lesson, students defined functions given a specific set of parameters. In Project: Create Your Own Function, students get additional practice thinking about functions before developing and defining a function of their own.
Synthesize
-
How were each of the representations helpful?
-
Why is it important to write examples in our code?
🔗Additional Exercises
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.