// Numbas version: finer_feedback_settings {"name": "Straight line equation application: measuring sunflower height", "extensions": ["jsxgraph", "random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "
An applied example of the use of two points on a graph to develop a straight line function, then use the t estimate and predict. MCQ's are also used to develop student understanding of the uses of gradient and intercepts as well as the limitations of prediction.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "{person['name']} is given a sunflower seedling for {person['pronouns']['their']} 30th birthday (day $0$) and observes its height. {capitalise(person['pronouns']['they'])} make{s} the following observations later that week:
\nObservation | \nA | \nB | \n
Day | \n$\\var{xa}$ | \n$\\var{xb}$ | \n
height (cm) | \n$\\var{ya}$ | \n$\\var{yb}$ | \n
{person['name']} plots the 2 points:
\n{plotPoints()}
", "variables": {"m": {"group": "Ungrouped variables", "name": "m", "description": "The gradient
", "templateType": "anything", "definition": "random(2..3)"}, "yb": {"group": "point coordinates", "name": "yb", "description": "y coordinate of point B
", "templateType": "anything", "definition": "m*xb+c"}, "d": {"group": "Ungrouped variables", "name": "d", "description": "A number of days after receiving the seedling, on which the height is estimated
", "templateType": "anything", "definition": "random([10,14,20])"}, "ya": {"group": "point coordinates", "name": "ya", "description": "y coordinate of point A
", "templateType": "anything", "definition": "m*xa+c"}, "c": {"group": "Ungrouped variables", "name": "c", "description": "The intercept
", "templateType": "anything", "definition": "random(2..4)"}, "s": {"group": "Random person", "name": "s", "description": "He makes, they make.
", "templateType": "anything", "definition": "if(person['gender']='neutral','','s')"}, "xb": {"group": "point coordinates", "name": "xb", "description": "x coordinate of point B
", "templateType": "anything", "definition": "xa+1"}, "person": {"group": "Random person", "name": "person", "description": "A random person
", "templateType": "anything", "definition": "random_person()"}, "xa": {"group": "point coordinates", "name": "xa", "description": "x coordinate of point a
", "templateType": "anything", "definition": "random(3..5)"}}, "tags": ["assessing the accuracy of a graph", "estimations", "gradient", "interpreting graphs", "interpreting the gradient", "limitations of a line equation based on data used to create the equation", "line equation", "Straight Line", "straight line", "taxonomy", "using graphs to estimate a y value", "y-intercept"], "ungrouped_variables": ["m", "c", "d"], "functions": {"advicePoints": {"language": "javascript", "type": "html", "parameters": [], "definition": "//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-1,yb+5,xb+3,-2],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n\nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-2,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\n\n\nquestion.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\n//define ans as this \ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;"}, "plotPoints": {"language": "javascript", "type": "html", "parameters": [], "definition": "//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-1,yb+5,xb+3,-2],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n var ans;\n var nscope = new Numbas.jme.Scope([scope,{variables:{x:new Numbas.jme.types.TNum(0)}}]);\n//this is the beating heart of whatever plots the function,\n//I've changed this from being curve to functiongraph\n var line = board.create('functiongraph',[function(x){\nif(ans) {\n try {\nnscope.variables.x.value = x;\n var val = Numbas.jme.evaluate(ans,nscope).value;\n return val;\n }\n catch(e) {\nreturn 163;\n }\n}\nelse\n return 163;\n },-2,22]\n , {strokeColor:\"blue\",strokeWidth: 4} );\n \nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-2,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: false, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\nquestion.lines = {\n l:line, c:correct_line\n}\n\n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\n\n//define ans as this \ntry {\n ans = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n ans = null;\n}\nline.updateCurve();\ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;"}}, "name": "Straight line equation application: measuring sunflower height", "preamble": {"js": "", "css": ""}, "extensions": ["jsxgraph", "random_person"], "advice": "The gradient is the ratio of vertical change ($y_2-y_1$) to horizontal change ($x_2-x_1$).
\n\\[ m = \\frac{y_2-y_1}{x_2-x_1}=\\frac{\\simplify[!collectNumbers]{{yb}-{ya}}}{\\simplify[!collectNumbers]{{xb}-{xa}}}=\\frac{\\simplify{{yb}-{ya}}}{\\simplify{{xb}-{xa}}}=\\simplify[simplifyFractions,unitDenominator]{({yb-ya})/({xb-xa})}\\text{.}\\]
\nRearranging the equation $y=mx+c$ for $c$ and using point A:
\n\\[ c = y_1-mx_1 = \\var{ya}-\\var{m}\\times\\var{xa}=\\simplify{{ya-m*xa}}\\text{.}\\]
\nWe then check this against point $B$:
\n\\[ y_2 = mx_2 + c = \\simplify[fractionNumbers]{{m}{xb}+{c}}=\\simplify{{m}*{xb}+{c}}\\text{.}\\]
\nWe now substitute the values for $m$ and $c$ into the equation of a straight line, $y=mx+c$,
\n\\[y=\\simplify[!noLeadingMinus,unitFactor]{{m} x+ {c}}\\text{.}\\]
\n{advicePoints()}
\nThe gradient represents the vertical change (height in cm) per unit of the horizontal axis (days): the change in height of the sunflower per day.
\nSubstituting $x=\\var{d}$ into the straight line equation, the height $y$ after $\\var{d}$ days is
\n\\begin{align}
y&=\\simplify{{m}}x+\\var{c}\\\\
&=\\simplify[]{{m}{d}}+\\var{c}\\\\
&=\\var{m*d+c}\\text{cm.}
\\end{align}
Substituting $x=\\var{1826}$ into the straight line equation, the height $y$ after $1826$ days is
\n\\begin{align}
y&=\\simplify{{m}}x+\\var{c}\\\\
&=\\simplify[]{{m}1826} + \\var{c}\\\\
&=\\var{m*1826+c}\\text{cm.}
\\end{align}
Note that this is $\\var{(m*1826+c)/100}$ metres. In 2014, a sunflower of $9.17$ metres was entered into the Guinness World Records as tallest sunflower.
\nPossible reasons that the prediction will not be accurate are:
\nInvalid reasons that the prediction will not be accurate are:
\nWhat is the gradient, $m$, of the straight line between the two points?
\n$m =$ [[0]]
", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "unitTests": [], "useCustomName": false, "minValue": "c", "correctAnswerFraction": false, "customName": "", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxValue": "c", "showCorrectAnswer": true, "type": "numberentry", "showFractionHint": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "marks": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true}], "type": "gapfill", "prompt": "Use the gradient and the coordinates of the two points to find the height of the sunflower when {person['name']} received it.
\n[[0]] cm.
", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"scripts": {"mark": {"order": "after", "script": "console.log(this.question.lines.c)\nthis.question.lines.l.setAttribute({strokeColor: this.credit==1 ? 'green' : 'red'});\nthis.question.lines.c.setAttribute({visible: this.credit==1 ? false : true});\n"}}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"valuegenerators": [{"name": "x", "value": ""}], "variableReplacements": [], "unitTests": [], "useCustomName": false, "showPreview": true, "variableReplacementStrategy": "originalfirst", "customName": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "scripts": {}, "showCorrectAnswer": true, "failureRate": 1, "type": "jme", "checkVariableNames": false, "marks": 1, "customMarkingAlgorithm": "", "answer": "{m}*x+{c}", "vsetRange": [0, 1], "showFeedbackIcon": true, "vsetRangePoints": 5}], "type": "gapfill", "prompt": "Let $y$ be the sunflower height and $x$ the time, in days, since {person['name']} received the sunflower. What is the equation of the straight line between the points?
\n$y(x) = $ [[0]]
\nUse the preview on {person['name']}'s plot to check your answer.
", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"marks": 0, "displayType": "radiogroup", "unitTests": [], "choices": ["The length of time taken in days for the sunflower to grow $1$ cm
", "The change in height (in cm) of the sunflower over $1$ day
", "The width of the ruler used to measure the sunflower
", "All of the above
"], "scripts": {}, "distractors": ["", "", "", ""], "shuffleChoices": false, "prompt": "What does the gradient represent?
", "showCellAnswerState": true, "useCustomName": false, "minMarks": 0, "variableReplacements": [], "maxMarks": 0, "customName": "", "extendBaseMarkingAlgorithm": true, "matrix": [0, "1", 0, 0], "displayColumns": "1", "showCorrectAnswer": true, "type": "1_n_2", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "unitTests": [], "useCustomName": false, "minValue": "d*m+c", "correctAnswerFraction": false, "customName": "", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxValue": "d*m+c", "showCorrectAnswer": true, "type": "numberentry", "showFractionHint": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "marks": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true}], "type": "gapfill", "prompt": "{person['name']} uses the straight line equation to predict the future height of the sunflower. What will the height be on day $\\var{d}$?
\n[[0]] cm
", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "unitTests": [], "useCustomName": false, "minValue": "1826*m+c", "correctAnswerFraction": false, "customName": "", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxValue": "1826*m+c", "showCorrectAnswer": true, "type": "numberentry", "showFractionHint": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "marks": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true}], "type": "gapfill", "prompt": "{person['name']} wonders if {person['pronouns']['they']} can guess what the height of the sunflower will be on {person['pronouns']['their']} 35th birthday. {capitalise(person['pronouns']['they'])} work{s} out that this is day 1826. Using the straight line equation, what would the height be on day 1826?
\n[[0]] cm
", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"variableReplacementStrategy": "originalfirst", "displayType": "checkbox", "unitTests": [], "choices": ["Sunflower height as a function of time may not have a straight linear relationship.
", "The observations only span a very limited time range.
", "There are multiple straight linear relationships that could be obtained using the same $2$ data points.
", "Sunflower height never actually increases over time.
"], "scripts": {}, "distractors": ["", "", "", ""], "shuffleChoices": false, "marks": 0, "showCellAnswerState": true, "useCustomName": false, "minMarks": 0, "variableReplacements": [], "maxMarks": "1", "prompt": "{person['name']} doubts {person['pronouns']['their']} result. Which of the following reason(s) may mean that the height on {person['pronouns']['their']} 35th birthday is not accurate?
", "customName": "", "warningType": "none", "extendBaseMarkingAlgorithm": true, "matrix": ["0.5", "0.5", "-0.5", "-0.5"], "displayColumns": "1", "showCorrectAnswer": true, "type": "m_n_2", "maxAnswers": 0, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "minAnswers": 0}], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}]}