// 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": [{"name": "Straight line equation application: measuring sunflower height", "tags": [], "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": "\n\n\n{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()}
", "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:
\nHe makes, they make.
", "templateType": "anything"}, "yb": {"name": "yb", "group": "point coordinates", "definition": "m*xb+c", "description": "\n\ny coordinate of point B
", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2..3)", "description": "\n\nThe gradient
", "templateType": "anything"}, "ya": {"name": "ya", "group": "point coordinates", "definition": "m*xa+c", "description": "\n\ny coordinate of point A
", "templateType": "anything"}, "person": {"name": "person", "group": "Random person", "definition": "random_person()", "description": "\n\n\n\nA random person
", "templateType": "anything"}, "xb": {"name": "xb", "group": "point coordinates", "definition": "xa+1", "description": "\n\nx coordinate of point B
", "templateType": "anything"}, "xa": {"name": "xa", "group": "point coordinates", "definition": "random(3..5)", "description": "\nx coordinate of point a
", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "\n\nThe intercept
", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random([10,14,20])", "description": "\n\nA number of days after receiving the seedling, on which the height is estimated
", "templateType": "anything"}}, "variablesTest": {"condition": "\n", "maxRuns": 100}, "ungrouped_variables": ["m", "c", "d"], "variable_groups": [{"name": "point coordinates", "variables": ["xa", "xb", "ya", "yb"]}, {"name": "Random person", "variables": ["person", "s"]}], "functions": {"plotPoints": {"parameters": [], "type": "html", "language": "javascript", "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;"}, "advicePoints": {"parameters": [], "type": "html", "language": "javascript", "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;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nWhat is the gradient, $m$, of the straight line between the two points?
\n$m =$ [[0]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "m", "maxValue": "m", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nUse the gradient and the coordinates of the two points to find the height of the sunflower when {person['name']} received it.
\n[[0]] cm.
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "c", "maxValue": "c", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {"mark": {"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", "order": "after"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nLet $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.
", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{m}*x+{c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}, {"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nWhat does the gradient represent?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "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
"], "matrix": [0, "1", 0, 0], "distractors": ["", "", "", ""]}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\n{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
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "d*m+c", "maxValue": "d*m+c", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\n{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
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "1826*m+c", "maxValue": "1826*m+c", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "m_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "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?
", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "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.
"], "matrix": ["0.5", "0.5", "-0.5", "-0.5"], "distractors": ["", "", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "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/"}, {"name": "Adelle Colbourn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2083/"}]}]}], "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/"}, {"name": "Adelle Colbourn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2083/"}]}