Page 125 - Mathematics GRADE 9, DE-STREAMED (MTH1W)
P. 125

plotRelation subprogram
xValue = 0
yValue = initialValue repeat totalPoints times
plot point (xValue, yValue)
xValue = xValue + 1
yValue = rateOfChange * xValue + initialValue
Pseudocode does not represent a specific programming language. It can be adapted to work with a variety of programming languages and/or environments.
2. Have students identify the variables, parameters, and/or equations needed to write code to perform a specific task. For example, ask:
• What variables are needed to write code to represent a linear relation?
• What parameters are needed for the line to have a positive slope?
• What equation can be used in the code to determine the y-value of a linear relation?
3. Give students a short program to run. Before they look at the code, have them predict, based on the outcome from running the program, what equations, variables, parameters, and inequalities are most likely included in the code. Afterwards, have them read through the code and check their predictions.
C2.2 Coding
create code by decomposing situations into computational steps in order to represent mathematical concepts and relationships, and to solve problems
Teacher supports
Examples
• situations that can be decomposed into computational steps:
o generating a sequence of numbers to fit specific criteria
o determining the density of a subset of numbers within a set o determining whether a relationship is linear or non-linear
124
   subprogram plotRelation (initialValue, rateOfChange, totalPoints)
       













































































   123   124   125   126   127