// Numbas version: finer_feedback_settings {"name": "Straight lines", "metadata": {"description": "
$y=mx+b$
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", ""], "variable_overrides": [[], [], [], [], [], [], []], "questions": [{"name": "Straight lines: does a given point lie on the line?", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "functions": {}, "ungrouped_variables": [], "tags": ["linear", "linear equation", "Straight Line", "straight line"], "advice": "", "rulesets": {}, "parts": [{"stepsPenalty": "1", "displayColumns": "0", "prompt": "Does the point $(\\var{xpoint},\\var{ypoint})$ lie on the line $\\simplify{y={grad}x+{yint}}$?
", "matrix": "markinga", "shuffleChoices": false, "variableReplacements": [], "choices": ["Yes
", "No
"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "steps": [{"prompt": "Recall the point $(\\var{xpoint},\\var{ypoint})$ is a representation of $x=\\var{xpoint}$ and $y=\\var{ypoint}$.
\nSubstitute $x=\\var{xpoint}$ and $y=\\var{ypoint}$ into $\\simplify{y={grad}x+{yint}}$ and see if the left hand side equals the right hand side:
\n$\\var{ypoint}$ | \n$\\stackrel{?}{=}$ | \n$\\simplify[basic]{{grad}*{xpoint}+{yint}}$ | \n
$\\var{ypoint}$ | \n$=$ | \n$\\simplify{{grad}*{xpoint}+{yint}}$ | \n
And so the point lies on the line.
\n$\\var{ypoint}$ | \n$\\stackrel{?}{=}$ | \n$\\simplify[basic]{{grad}*{xpoint}+{yint}}$ | \n
$\\var{ypoint}$ | \n$\\ne$ | \n$\\simplify{{grad}*{xpoint}+{yint}}$ | \n
And so the point does not lie on the line.
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "marks": 0, "scripts": {}, "maxMarks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}, {"stepsPenalty": "1", "displayColumns": 0, "prompt": "Does the line $\\simplify{{a}x+{b}y+{c}=0}$ pass through the point $(\\var{xbpoint},\\simplify[fractionnumbers]{{ybpoint}})$?
", "matrix": "markingb", "shuffleChoices": false, "variableReplacements": [], "choices": ["Yes
", "No
"], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "steps": [{"prompt": "Recall the point $(\\var{xbpoint},\\simplify[fractionnumbers]{{ybpoint}})$ is a representation of $x=\\var{xbpoint}$ and $y=\\simplify[fractionnumbers]{{ybpoint}}$.
\nSubstitute $x=\\var{xbpoint}$ and $y=\\simplify[fractionnumbers]{{ybpoint}}$ into $\\simplify{{a}x+{b}y+{c}=0}$ and see if the left hand side equals the right hand side:
\n$\\simplify[basic,fractionnumbers]{{a}*{xbpoint}+{b}*{ybpoint}+{c}}$ | \n$\\stackrel{?}{=}$ | \n$0$ | \n
$0$ | \n$=$ | \n$0$ | \n
And so the point lies on the line.
\n$\\simplify[basic,fractionnumbers]{{a}*{xbpoint}+{b}*{ybpoint}+{c}}$ | \n$\\stackrel{?}{=}$ | \n$0$ | \n
$\\simplify[all,fractionnumbers]{{lhs}}$ | \n$\\ne$ | \n$0$ | \n
And so the point does not lie on the line.
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "information"}], "marks": 0, "scripts": {}, "maxMarks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}], "statement": "", "variable_groups": [{"variables": ["grad", "yint", "xpoint", "possible", "ypoint", "check", "markinga"], "name": "part a"}, {"variables": ["a", "b", "c", "xbpoint", "possibleb", "ybpoint", "lhs", "checkb", "markingb"], "name": "part b"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "random(-12..12 except 0)", "templateType": "anything", "group": "part b", "name": "a", "description": ""}, "c": {"definition": "random(-12..12 except 0)", "templateType": "anything", "group": "part b", "name": "c", "description": ""}, "b": {"definition": "random(-12..12 except 0)", "templateType": "anything", "group": "part b", "name": "b", "description": ""}, "possibleb": {"definition": "random(-10..10 except 0)", "templateType": "anything", "group": "part b", "name": "possibleb", "description": ""}, "ybpoint": {"definition": "random(possibleb,-(c+a*xbpoint)/b)", "templateType": "anything", "group": "part b", "name": "ybpoint", "description": ""}, "markinga": {"definition": "[if(check=true,1,0),if(check=true,0,1)]", "templateType": "anything", "group": "part a", "name": "markinga", "description": ""}, "xbpoint": {"definition": "random(-10..10 except -1..1)", "templateType": "anything", "group": "part b", "name": "xbpoint", "description": ""}, "yint": {"definition": "random(-12..12 except 0)", "templateType": "anything", "group": "part a", "name": "yint", "description": ""}, "grad": {"definition": "random(6..6 except 0)", "templateType": "anything", "group": "part a", "name": "grad", "description": ""}, "checkb": {"definition": "if(possibleb=ybpoint,false,true)", "templateType": "anything", "group": "part b", "name": "checkb", "description": ""}, "possible": {"definition": "random(-12..12 except [0,-yint,yint])", "templateType": "anything", "group": "part a", "name": "possible", "description": ""}, "lhs": {"definition": "{a}*{xbpoint}+{b}*{ybpoint}+{c}", "templateType": "anything", "group": "part b", "name": "lhs", "description": ""}, "ypoint": {"definition": "grad*xpoint+random(yint,-yint,possible)", "templateType": "anything", "group": "part a", "name": "ypoint", "description": ""}, "xpoint": {"definition": "random(-10..10 except -1..1)", "templateType": "anything", "group": "part a", "name": "xpoint", "description": ""}, "check": {"definition": "ypoint=grad*xpoint+yint", "templateType": "anything", "group": "part a", "name": "check", "description": ""}, "markingb": {"definition": "[if(checkb=true,1,0),if(checkb=true,0,1)]", "templateType": "anything", "group": "part b", "name": "markingb", "description": ""}}, "metadata": {"notes": "I think I have solved a rounding issue I was having.
", "description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Straight lines: gradient intercept form of a line", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "tags": ["gradient", "intercept", "linear equation", "Straight Line", "straight line", "y=mx+b"], "metadata": {"description": "Identifying gradient and $y$-intercept from $y=mx+b$.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"run1": {"name": "run1", "group": "Ungrouped variables", "definition": "random(2..16)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-12..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Ungrouped variables", "definition": "random(2..16)", "description": "", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Ungrouped variables", "definition": "random(2..16)", "description": "", "templateType": "anything", "can_override": false}, "b1": {"name": "b1", "group": "Ungrouped variables", "definition": "random(-12..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "b2": {"name": "b2", "group": "Ungrouped variables", "definition": "random(-10..10)", "description": "", "templateType": "anything", "can_override": false}, "m2": {"name": "m2", "group": "Ungrouped variables", "definition": "random(-12..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "rise1": {"name": "rise1", "group": "Ungrouped variables", "definition": "random(-16..-2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["rise", "run", "b", "rise1", "run1", "b1", "m2", "b2"], "variable_groups": [], "functions": {"eqnline": {"parameters": [], "type": "html", "language": "javascript", "definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\n\n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n{boundingBox: [-11,11,11,-11],\n axis: false,\n showNavigation: false,\n grid: true\n});\n \n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n// create the static line based on the coefficients a and b\n//var line1 = board.create('line',[[0,b],[1,a+b]],{fixed:true, strokeWidth: 1});\n\n// mark the two given points - one on the y-axis, and one at (x2,y2)\n//var p1 = board.create('point',[0,b],{fixed:true, size:3, name: 'P_1', face: 'cross'});\n//var p2 = board.create('point',[x2,y2],{fixed:true, size:3, name: 'P_2', face: 'cross'});\n\n// Now we can do the clever stuff with the student's answer!\n// We'll add a curve to the board which is a plot of a function we provide.\n// That function will parse the student's input and evaluate it.\n\n// The variable `studentExpression` will store the parsed version of\n// the student's expression.\nvar studentExpression;\n\n// This function evaluates the student's expression at a given point `t`.\nfunction makestudentline(x){\n // Create a JME scope with the variable x set to the given value.\n var nscope = new Numbas.jme.Scope([\nNumbas.jme.builtinScope,\n{variables: {x: new Numbas.jme.types.TNum(x)}}\n ]);\n \n // If the student's input has been parsed, evaluate it\n if(studentExpression) {\ntry {\n var val = Numbas.jme.evaluate(studentExpression,nscope).value;\n return val;\n}\ncatch(e) {\n // If there was an error evaluating the student's expression\n // (wrong variables, or some other weirdness)\n // throw an error\n throw(e)\n}\n }\n // Otherwise, if the student's expression hasn't been parsed\n // (they haven't written anything, or they wrote bad syntax)\n // return 0\n else {\nreturn 0;\n }\n}\nvar studentline = board.create('functiongraph', \n [makestudentline,-11,11],\n {strokeColor:'#00ff00',strokeWidth:2, visible: false}\n );\n\n// This is where some voodoo happens.\n// Because the HTML for the question is inserted into the page after the function eqnline\n// is called, we need to wait until the 'question-html-attached' event is fired\n// to do the interaction with the student input box.\n// So:\n\n// When the question is inserted into the page\nquestion.signals.on('HTMLAttached',function(e) {\n \n // Create a Knockout.js observable\n ko.computed(function(){\n// Get the student's input string from part 0, gap 0.\nvar studentString = question.parts[2].gaps[0].display.studentAnswer();\n\n// Try to parse it as a JME expression\ntry {\n var issue = /[A-W]|[YZ]|[\\^]/i.test(studentString);\n if(issue===false) \n {studentExpression = Numbas.jme.compile(studentString,scope)}\n else{studentExpression = null;\n studentline.hideElement()};///////////////////\n \n \n // If the student didn't write anything, compile returns null\n if(studentExpression === null)\nthrow(new Error('no expression'));\n \n // If everything worked, show the line and update it\n // (this calls makestudentline on a few points)\n studentline.showElement();\n studentline.updateCurve();\n}\ncatch(e) {\n // If something went wrong, hide the curve\n studentExpression = null;\n studentline.hideElement();\n}\n\nboard.update();\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": "The straight line with equation $y=\\simplify{{rise}/{run}* x+{b}}$ has a gradient of [[0]] and a $y$-intercept of [[1]].
\nThe gradient tells us that if we were on the line $y=\\simplify{{rise}/{run}* x+{b}}$ and we moved to the right {run} units then we would need to move [[2]] units upwards to get back on the line.
\nThe $y$-intercept tells us where the line hits the $y$-axis, that is, the $y$ value when $x=$[[3]].
", "stepsPenalty": "2", "steps": [{"type": "information", "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": "For $y=mx+b$, $m$ is the gradient and $b$ is the $y$-intercept.
\n\nThe gradient (or slope of the line) is
\nThe $y$-intercept is the value of $y$ that the line crosses the $y$-axis at. Since the $y$-axis is the line that corresponds to $x=0$, the $y$-intercept is the $y$-value when $x=0$.
\n\nFor example, given the equation $y=\\frac{2}{3}x-4$, we can see that the gradient is $\\frac{2}{3}$ and the $y$-intercept is $-4$. This constant gradient of $\\frac{2}{3}$ means that for a run of 3 we need a rise of 2 to stay on the line. Note it also means that say if we run across 6, we need to rise by 4, since $\\frac{2}{3}=\\frac{4}{6}$.
"}], "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": "{rise}/{run}", "maxValue": "{rise}/{run}", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{b}", "maxValue": "{b}", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{rise}", "maxValue": "{rise}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "The straight line with equation $y=\\simplify{{rise1}/{run1}* x+{b1}}$ has a gradient of [[0]] and a $y$-intercept of [[1]].
\nThe gradient tells us that if we were on the line $y=\\simplify{{rise1}/{run1}* x+{b1}}$ and we moved to the right {2*run1} units then we would need to move [[2]] units downwards to get back on the line.
\n", "stepsPenalty": "1.5", "steps": [{"type": "information", "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": "For $y=mx+b$, $m$ is the gradient and $b$ is the $y$-intercept.
\n\nThe gradient (or slope of the line) is
\nThe $y$-intercept is the value of $y$ that the line crosses the $y$-axis at. Since the $y$-axis is the line that corresponds to $x=0$, the $y$-intercept is the $y$-value when $x=0$.
\n\nFor example, given the equation $y=\\frac{2}{3}x-4$, we can see that the gradient is $\\frac{2}{3}$ and the $y$-intercept is $-4$. This constant gradient of $\\frac{2}{3}$ means that for a run of 3 we need a rise of 2 to stay on the line. Note it also means that say if we run across 6, we need to rise by 4, since $\\frac{2}{3}=\\frac{4}{6}$.
"}], "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": "{rise1}/{run1}", "maxValue": "{rise1}/{run1}", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{b1}", "maxValue": "{b1}", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{-2*rise1}", "maxValue": "{-2*rise1}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "If a straight line has a gradient of {m2} and a $y$-intercept of {b2} then its equation can be written as $y=$ [[0]].
\nThe following is the graph of the equation that you entered:
\n{eqnline()}
", "stepsPenalty": "0.5", "steps": [{"type": "information", "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": "Recall the gradient intercept form of a straight line is $y=mx+b$ where $m$ is the gradient and $b$ is the $y$-intercept.
"}], "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": "{m2}*x+{b2}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": "0.001", "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Straight lines: graphing y=mx+b by finding some points", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "tags": ["gradient intercept", "graphing straight lines", "linear", "plotting points", "straight lines", "table of values"], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"run1": {"name": "run1", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-12..5 except 0)", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Ungrouped variables", "definition": "if(run=2,random(1,3,5,7),if(run=3,random(1,2,4,5,7),if(run=5,random(1,2,3,4,6,7),if(run=7,random(1,2,3,4,5,6),'er'))))", "description": "", "templateType": "anything", "can_override": false}, "b1": {"name": "b1", "group": "Ungrouped variables", "definition": "random(-12..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "rise1": {"name": "rise1", "group": "Ungrouped variables", "definition": "if(run1=2,random(1,3,5,7,9,11),if(run1=3,random(1,2,4,5,7,8,10),if(run1=5,random(1,2,3,4,6,7,8,9),if(run1=7,random(1,2,3,4,5,6,8,9,10,11),'er'))))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "\n", "maxRuns": 100}, "ungrouped_variables": ["b", "run", "rise", "b1", "run1", "rise1"], "variable_groups": [], "functions": {"tableofvalues": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nvar y0 = 0;\nvar y1 = 0;\nvar y2 = 0;\n\nvar glide0 = board.create('line',[[0,0],[0,1]],{visible: false});\nvar glide1 = board.create('line',[[1,0],[1,1]],{visible: false});\nvar glide2 = board.create('line',[[2,0],[2,1]],{visible: false});\n\nvar a = board.create('glider',[0,0,glide0],{name:'',showInfobox:false,snapSizeX:.01,snapSizeY:.01,snapToGrid:true});\na.on('drag',function(){\n var y0 = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[1].gaps[0].display.studentAnswer(y0);\n});\n\nvar b = board.create('glider',[0,1,glide1],{name:'',showInfobox:false,snapSizeX:.01,snapSizeY:.01,snapToGrid:true});\nb.on('drag',function(){\n var y1 = Numbas.math.niceNumber(b.Y());\n Numbas.exam.currentQuestion.parts[1].gaps[1].display.studentAnswer(y1);\n});\n\nvar c = board.create('glider',[0,2,glide2],{name:'',showInfobox:false,snapSizeX:.01,snapSizeY:.01,snapToGrid:true});\nc.on('drag',function(){\n var y2 = Numbas.math.niceNumber(c.Y());\n Numbas.exam.currentQuestion.parts[1].gaps[2].display.studentAnswer(y2);\n});\n\n\nvar lineab = board.create('line',[a,b],{strokeWidth:2,strokeColor:'#00ff00',straightLast:false});\nvar linebc = board.create('line',[b,c],{strokeWidth:2,strokeColor:'#00ff00',straightFirst:false});\n\n function evaluate(expression) {\n try {\n var val = Numbas.jme.evaluate(expression,question.scope);\n return Numbas.jme.unwrapValue(val);\n }\n catch(e) {\n // if there's an error, return no number\n return NaN;\n }\n }\n\n\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n var y0 = evaluate(question.parts[1].gaps[0].display.studentAnswer());\n if(!(isNaN(y0)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([0,y0],100);//what does the 100 do?\n }\n var y1 = evaluate(question.parts[1].gaps[1].display.studentAnswer());\n if(!(isNaN(y1)) && board.mode!=board.BOARD_MODE_DRAG) {\n b.moveTo([0,y1],100);//what does the 100 do?\n }\n var y2 = evaluate(question.parts[1].gaps[2].display.studentAnswer());\n if(!(isNaN(y2)) && board.mode!=board.BOARD_MODE_DRAG) {\n c.moveTo([0,y2],100);//what does the 100 do?\n } \n });\n});\n\nreturn div;\n\n"}, "twopoints": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nvar x1 = 0;\nvar y1 = 0;\nvar x2 = 2;\nvar y2 = 0;\n\n\n\nvar a = board.create('point',[x1,y1],{name:'$y$ int',snapSizeX:1,snapSizeY:1,snapToGrid:true,showInfobox:false});\na.on('drag',function(){\n var x1 = Numbas.math.niceNumber(a.X());\n var y1 = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(x1);//could just have x instead of a.X()\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(y1);\n});\n\nvar b = board.create('point',[x2,y2],{name:'next nice point',snapSizeX:1,snapSizeY:1,snapToGrid:true,showInfobox:false});\nb.on('drag',function(){\n var x2 = Numbas.math.niceNumber(b.X());\n var y2 = Numbas.math.niceNumber(b.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[2].display.studentAnswer(x2);//could just have x instead of a.X()\n Numbas.exam.currentQuestion.parts[0].gaps[3].display.studentAnswer(y2);\n});\n\n\nvar line = board.create('line',[a,b], {strokeColor:'#00ff00',strokeWidth:2});\n\n\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n var x1 = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\n var y1 = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\n if(!(isNaN(x1) || isNaN(y1)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x1,y1],100);//what does the 100 do?\n }\n var x2 = parseFloat(question.parts[0].gaps[2].display.studentAnswer());\n var y2 = parseFloat(question.parts[0].gaps[3].display.studentAnswer());\n if(!(isNaN(x2) || isNaN(y2)) && board.mode!=board.BOARD_MODE_DRAG) {\n b.moveTo([x2,y2],100);//what does the 100 do?\n } \n });\n});\n\nreturn div;\n\n"}}, "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": "In sketching or graphing a straight line, we only need to plot two points and then draw the straight line through them. Any two points will do, but it is easier to plot when the coordinates are whole numbers.
\nOne method is to find the $y$-intercept and then use the gradient to find another \"nice\" point.
\n\nGiven the equation $y=\\simplify{{rise}/{run} x +{b}}$ the $y$-intercept gives us the coordinates $\\bigg($[[0]], [[1]]$\\bigg)$, then by going up {rise} and across {run} (that is, using the gradient) we get to the coordinates $\\bigg($[[2]], [[3]]$\\bigg)$.
\n\n{twopoints()}
\n", "stepsPenalty": 0, "steps": [{"type": "information", "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": "Following the written instructions above. You can drag the points on the graph to help determine the coordinates.
"}], "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": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{b}", "maxValue": "{b}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{run}", "maxValue": "{run}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "{rise+b}", "maxValue": "{rise+b}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "Another common method (to find points on a line) is to use a table of values.
\n\nGiven the equation $y=\\simplify{{rise1}/{run1} x+ {b1}}$ fill in the table of values:
\n$x$ | \n0 | \n1 | \n2 | \n
$y$ | \n[[0]] | \n[[1]] | \n[[2]] | \n
Notice, with this approach we are more likely to get fractions (which are often a bit harder to plot).
\n{tableofvalues()}
", "stepsPenalty": 0, "steps": [{"type": "information", "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": "Take the values of $x$ provided in the table and substitute them into the equation for $y$. Put each $y$ value in the table under the corresponding $x$ value. Once you are finished the points on the graph should form a straight line. If they don't it is likely some of your values are incorrect.
\n\nFor example, say you have $y=\\frac{2}{3}x-1$, and we need to fill in the following table of values
\n$x$ | \n0 | \n1 | \n2 | \n
$y$ | \n\n | \n | \n |
We take $x=0$ and substitute it into $y=\\frac{2}{3}x-1$ and get $y=\\frac{2}{3}\\times 0 -1=-1$.
\nWe take $x=1$ and substitute it into $y=\\frac{2}{3}x-1$ and get $y=\\frac{2}{3}\\times 1 -1=-\\frac{1}{3}$.
\nWe take $x=2$ and substitute it into $y=\\frac{2}{3}x-1$ and get $y=\\frac{2}{3}\\times 2 -1=\\frac{1}{3}$.
So we fill the table out as shown:
$x$ | \n0 | \n1 | \n2 | \n
$y$ | \n-1 | \n-1/3 | \n1/3 | \n
Given the graph of the line determine the equation of the line.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"bb": {"name": "bb", "group": "Ungrouped variables", "definition": "random(-5..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "point_y": {"name": "point_y", "group": "Ungrouped variables", "definition": "b+rise", "description": "", "templateType": "anything", "can_override": false}, "bpoint_y": {"name": "bpoint_y", "group": "Ungrouped variables", "definition": "bb+brise", "description": "", "templateType": "anything", "can_override": false}, "brun": {"name": "brun", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-12..5 except 0)", "description": "", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Ungrouped variables", "definition": "if(run=2,random(1,3,5,7),if(run=3,random(1,2,4,5,7),if(run=5,random(1,2,3,4,6,7),if(run=7,random(1,2,3,4,5,6),'er'))))", "description": "", "templateType": "anything", "can_override": false}, "brise": {"name": "brise", "group": "Ungrouped variables", "definition": "-if(brun=2,random(1,3,5,7),if(brun=3,random(1,2,4,5,7),if(brun=5,random(1,2,3,4,6,7),if(brun=7,random(1,2,3,4,5,6),'er'))))", "description": "", "templateType": "anything", "can_override": false}, "point_x": {"name": "point_x", "group": "Ungrouped variables", "definition": "run", "description": "", "templateType": "anything", "can_override": false}, "bpoint_x": {"name": "bpoint_x", "group": "Ungrouped variables", "definition": "brun", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["b", "run", "rise", "point_y", "point_x", "bb", "brun", "brise", "bpoint_y", "bpoint_x"], "variable_groups": [], "functions": {"linea": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nx0 = 0;\ny0 = Numbas.jme.unwrapValue(scope.variables.b);\nx1 = Numbas.jme.unwrapValue(scope.variables.point_x);\ny1 = Numbas.jme.unwrapValue(scope.variables.point_y);\n\n//board.create('point',[x0,y0],{fixed:true});\n//board.create('point',[x1,y1],{fixed:true});\nboard.create('line',[[x0,y0],[x1,y1]],{strokeColor:'#00ff00',strokeWidth:2,fixed:true});\n\n\n\nreturn div;"}, "lineb": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nx0 = 0;\ny0 = Numbas.jme.unwrapValue(scope.variables.bb);\nx1 = Numbas.jme.unwrapValue(scope.variables.bpoint_x);\ny1 = Numbas.jme.unwrapValue(scope.variables.bpoint_y);\n\n//board.create('point',[x0,y0],{fixed:true});\n//board.create('point',[x1,y1],{fixed:true});\nboard.create('line',[[x0,y0],[x1,y1]],{strokeColor:'#00ff00',strokeWidth:2,fixed:true});\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": "The gradient intercept form of the line shown below is $y=$ [[0]].
\n{linea()}
", "stepsPenalty": "1", "steps": [{"type": "information", "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": "Read the $y$-intercept off the graph (this is denoted $b$), find a 'nice point' with whole number coordinates, use this to determine the gradient (this is denoted $m$). Express as $y=mx+b$.
\nRecall the gradient is $\\frac{\\text{rise}}{\\text{run}}$, determine the rise and run by looking at getting from the $y$-intercept to the next nice (whole number) point.
\n\nFor example, suppose we had the following graph
\nWe see that the $y$-intercept is $-3$, that is $b=-3$. We can find a 'nice point' with whole number coordinates at the point $(-2,2)$. To get from the $y$-intercept to this point requires we rise up 1 unit and run across 2 units. So our gradient is $\\frac{1}{2}$, that is $m=\\frac{1}{2}$. We now can write our equation, $y=\\frac{1}{2}x-3$.
\nNote we could have chosen other points to be our 'nice point', for example $(-1,4)$ or $(6,0)$.
\n\n"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{rise}/{run}*x+{b}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "notallowed": {"strings": ["="], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}], "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": "The gradient intercept form of the line shown below is $y=$ [[0]].
\n{lineb()}
", "stepsPenalty": "1", "steps": [{"type": "information", "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": "Read the $y$-
Recall the gradient is $\\frac{\\text{rise}}{\\text{run}}$, determine the rise and run by looking at getting from the $y$-intercept to the next nice (whole number) point.
\n\nFor example, suppose we had the following graph
\nWe see that the $y$-intercept is $-3$, that is $b=-3$. We can find a 'nice point' with whole number coordinates at the point $(-2,2)$. To get from the $y$-intercept to this point requires we rise up 1 unit and run across 2 units. So our gradient is $\\frac{1}{2}$, that is $m=\\frac{1}{2}$. We now can write our equation, $y=\\frac{1}{2}x-3$.
\nNote we could have chosen other points to be our 'nice point', for example $(-1,4)$ or $(6,0)$.
\n\n"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{brise}/{brun}*x+{bb}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "notallowed": {"strings": ["="], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Straight lines: one point gradient", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "tags": ["graph", "linear", "linear equation", "Straight Line", "straight line", "y=mx+b"], "metadata": {"description": "Given one point and the gradient determine the equation of the line.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-12..5 except 0)", "description": "", "templateType": "anything", "can_override": false}, "brise": {"name": "brise", "group": "Ungrouped variables", "definition": "-if(brun=2,random(1,3,5,7),if(brun=3,random(1,2,4,5,7),if(brun=5,random(1,2,3,4,6,7),if(brun=7,random(1,2,3,4,5,6),'er'))))", "description": "", "templateType": "anything", "can_override": false}, "bb": {"name": "bb", "group": "Ungrouped variables", "definition": "random(-5..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Ungrouped variables", "definition": "if(run=2,random(1,3,5,7),if(run=3,random(1,2,4,5,7),if(run=5,random(1,2,3,4,6,7),if(run=7,random(1,2,3,4,5,6),'er'))))", "description": "", "templateType": "anything", "can_override": false}, "brun": {"name": "brun", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "scale": {"name": "scale", "group": "Ungrouped variables", "definition": "random(-1,1,2,-2)", "description": "", "templateType": "anything", "can_override": false}, "bpoint_y": {"name": "bpoint_y", "group": "Ungrouped variables", "definition": "bb+brise*bscale", "description": "", "templateType": "anything", "can_override": false}, "point_y": {"name": "point_y", "group": "Ungrouped variables", "definition": "b+rise*scale", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "bscale": {"name": "bscale", "group": "Ungrouped variables", "definition": "random(-2..2 except [0,scale])", "description": "", "templateType": "anything", "can_override": false}, "point_x": {"name": "point_x", "group": "Ungrouped variables", "definition": "run*scale", "description": "", "templateType": "anything", "can_override": false}, "bpoint_x": {"name": "bpoint_x", "group": "Ungrouped variables", "definition": "brun*bscale", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["b", "run", "rise", "point_y", "point_x", "scale", "bb", "brun", "brise", "bscale", "bpoint_y", "bpoint_x"], "variable_groups": [], "functions": {}, "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": "The gradient intercept form of the line that passes through the point ({point_x},{point_y}) with a gradient of $\\simplify{{rise}/{run}}$ is $y=$ [[0]].
", "stepsPenalty": "1", "steps": [{"type": "information", "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": "There are two common ways to approach these questions:
\nFor example, suppose we had to find the equation of the line through $(2,3)$ with a gradient of $\\frac{1}{4}$. The following are examples of using the above approaches:
\nRecall $\\frac{x}{4}$ is the same as $\\frac{1}{4}x$.
"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{rise}/{run}*x+{b}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "notallowed": {"strings": ["="], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}], "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": "The gradient intercept form of the line that passes through the point ({bpoint_x},{bpoint_y}) with a gradient of $\\simplify{{brise}/{brun}}$ is $y=$ [[0]].
", "stepsPenalty": "1", "steps": [{"type": "information", "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": "There are two common ways to approach these questions:
\nFor example, suppose we had to find the equation of the line through $(2,3)$ with a gradient of $-\\frac{1}{4}$. The following are examples of using the above approaches:
\nRecall $-\\frac{x}{4}$ is the same as $-\\frac{1}{4}x$.
"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{brise}/{brun}*x+{bb}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "notallowed": {"strings": ["="], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Straight lines: given two points find the equation", "extensions": ["jsxgraph", "polynomials"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "functions": {"line_and_2points": {"definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nx0 = Numbas.jme.unwrapValue(scope.variables.x0);\ny0 = Numbas.jme.unwrapValue(scope.variables.y0);\nx1 = Numbas.jme.unwrapValue(scope.variables.x1);\ny1 = Numbas.jme.unwrapValue(scope.variables.y1);\n\nboard.create('point',[x0,y0],{fixed:true});\nboard.create('point',[x1,y1],{fixed:true});\n\nvar studentExpression;\n\n// This function evaluates the student's expression at a given point `t`.\nfunction makestudentline(x){\n // Create a JME scope with the variable x set to the given value.\n var nscope = new Numbas.jme.Scope([\nNumbas.jme.builtinScope,\n{variables: {x: new Numbas.jme.types.TNum(x)}}\n ]);\n \n // If the student's input has been parsed, evaluate it\n if(studentExpression) {\ntry {\n var val = Numbas.jme.evaluate(studentExpression,nscope).value;\n return val;\n}\ncatch(e) {\n // If there was an error evaluating the student's expression\n // (wrong variables, or some other weirdness)\n // throw an error\n throw(e)\n}\n }\n // Otherwise, if the student's expression hasn't been parsed\n // (they haven't written anything, or they wrote bad syntax)\n // return 0\n else {\nreturn 0;\n }\n}\nvar studentline = board.create('functiongraph', \n [makestudentline,-13,13],\n {strokeColor:'#00ff00',strokeWidth:2, visible: false}\n );\n\n// This is where some voodoo happens.\n// Because the HTML for the question is inserted into the page after the function eqnline\n// is called, we need to wait until the 'question-html-attached' event is fired\n// to do the interaction with the student input box.\n// So:\n\n// When the question is inserted into the page\nquestion.signals.on('HTMLAttached',function(e) {\n \n // Create a Knockout.js observable\n ko.computed(function(){\n// Get the student's input string from part 0, gap 0.\nvar studentString = question.parts[0].gaps[0].display.studentAnswer();\n\n\n \n// Try to parse it as a JME expression\ntry {\nvar issue = /[A-W]|[YZ]|[\\^]/i.test(studentString);\n \n if(issue===false) \n {studentExpression = Numbas.jme.compile(studentString,scope)}\n else{studentExpression = null;\n studentline.hideElement()};///////////////////\n \n // If the student didn't write anything, compile returns null\n if(studentExpression === null)\nthrow(new Error('no expression'));\n\n \n // If everything worked, show the line and update it\n // (this calls makestudentline on a few points)\n studentline.showElement();\n studentline.updateCurve();\n}\ncatch(e) {\n // If something went wrong, hide the curve\n studentExpression = null;\n studentline.hideElement();\n}\n\nboard.update();\n });\n}); \n\nreturn div;", "type": "html", "language": "javascript", "parameters": []}}, "ungrouped_variables": ["x0", "y0", "x1", "y1", "m", "const"], "tags": ["graph", "JSXgraph", "Jsxgraph", "jsxgraph", "linear equation", "straight lines", "y=mx+b"], "preamble": {"css": "", "js": ""}, "advice": "", "rulesets": {}, "parts": [{"stepsPenalty": "1", "prompt": "The gradient intercept form of the line that passes through the points ({x0},{y0}) and ({x1},{y1}) is $y=$ [[0]]
{line_and_2points()}
\n", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"notallowed": {"message": "", "showStrings": false, "strings": ["="], "partialCredit": 0}, "vsetrangepoints": 5, "expectedvariablenames": ["x"], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "all", "scripts": {}, "answer": "{y1-y0}/{x1-x0}*x+({x1*y0-x0*y1})/({x1-x0})", "marks": "2", "checkvariablenames": true, "checkingtype": "absdiff", "type": "jme"}], "steps": [{"prompt": "There are a few ways to approach these questions:
\nFor example, suppose we had to find the equation of the line through $(2,3)$ and $(5,1)$. Let us call the first point $(x_1,y_1)$ and the second $(x_2,y_2)$. The following are examples of using the above approaches:
\nIdentifying y=mx+b given two points
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Straight lines: general form to and from gradient intercept", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1..12)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-12..12 except 0)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-12..12 except [0,a])", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Ungrouped variables", "definition": "random(2,3,5,7)", "description": "", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Ungrouped variables", "definition": "np*if(run=2,random(1,3,5,7),if(run=3,random(1,2,4,5,7),if(run=5,random(1,2,3,4,6,7),if(run=7,random(1,2,3,4,5,6),\"error\"))))", "description": "", "templateType": "anything", "can_override": false}, "b1": {"name": "b1", "group": "Ungrouped variables", "definition": "random(-12..12)", "description": "", "templateType": "anything", "can_override": false}, "np": {"name": "np", "group": "Ungrouped variables", "definition": "random(-1,1)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "c", "run", "np", "rise", "b1"], "variable_groups": [], "functions": {}, "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": "The equation of the line $\\simplify{{a}x+{b}y+{c}=0}$ can be rearranged into gradient intercept form, $y=$ [[0]].
", "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": "-{a}/{b}x-{c}/{b}", "answerSimplification": "all", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "notallowed": {"strings": ["="], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}], "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": "The equation of the line $y=\\simplify{{rise}/{run}x+{b1}}$ can be rearranged into general form, [[0]] $=0$.
\nNote by convention:
\n