// Numbas version: exam_results_page_options {"name": "Create a line with given gradient", "extensions": ["mas-codeassess", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Create a line with given gradient", "tags": [], "metadata": {"description": "

The student is shown a diagram containing a line between two points. They're given a gradient and $y$-intercept.

\n

They must manipulate the line or the points so that the line has the given gradient and $y$-intercept.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "

The line should look like this:

\n

{correct_diagram}

", "rulesets": {}, "extensions": ["jsxgraph", "programming"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"gradient": {"name": "gradient", "group": "Ungrouped variables", "definition": "dy/dx", "description": "

The gradient that the student's line should have. Designed to be a nice fraction.

", "templateType": "anything", "can_override": false}, "diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jessiecode(400,400,[-5,10,10,-5],\"\"\"\n a = point(1,0) <>;\n b = point(2,0) <>;\n line = line(a,b) <>;\n\"\"\")", "description": "

The diagram shown to the student.

", "templateType": "anything", "can_override": false}, "dx": {"name": "dx", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "

A randomly chosen change in x to get a nice gradient.

", "templateType": "anything", "can_override": false}, "dy": {"name": "dy", "group": "Ungrouped variables", "definition": "random(-5..5 except 0)", "description": "

A randomly chosen change in y to get a nice gradient.

", "templateType": "anything", "can_override": false}, "y_intercept": {"name": "y_intercept", "group": "Ungrouped variables", "definition": "random(0..4)", "description": "

The point at which the student's line should cross the y axis.

", "templateType": "anything", "can_override": false}, "x_intercept": {"name": "x_intercept", "group": "Ungrouped variables", "definition": "let([g,y], gradient_intercept_pair,\n -y/g\n)", "description": "

The position at which the line crosses the x axis

", "templateType": "anything", "can_override": false}, "gradient_intercept_pair": {"name": "gradient_intercept_pair", "group": "Ungrouped variables", "definition": "[gradient,y_intercept]", "description": "

The gradient and y-intercept of the line as a pair, to be replaced by the student's answer for adaptive marking in part b.

", "templateType": "anything", "can_override": false}, "correct_diagram": {"name": "correct_diagram", "group": "Ungrouped variables", "definition": "jessiecode(400,400,[-5,10,10,-5],\"\"\"\n a = point(0,{y_intercept}) <>;\n b = point({x_intercept},0) <>;\n line = line(a,b) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["dx", "dy", "gradient", "y_intercept", "diagram", "gradient_intercept_pair", "x_intercept", "correct_diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "extension", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "student_line: diagram[\"l\"]\n\nstudent_gradient: jxg_slope(student_line)\n\nstudent_intercept: jxg_rise(student_line)\n\ncorrect_gradient (Does the student's line have the right gradient?):\n if(student_gradient=gradient, \n add_credit(0.5,\"Your line has the right gradient.\"),\n negative_feedback(\"Your line does not have the correct gradient (yours has {student_gradient}).\")\n )\n\ncorrect_intercept (Does the student's line have the right y-intercept?):\n if(student_intercept=y_intercept, \n add_credit(0.5,\"Your line has the right $y$-intercept.\"),\n negative_feedback(\"Your line does not have the correct $y$-intercept (yours has {student_intercept}).\")\n )\n\nmark:\n apply(correct_gradient);\n apply(correct_intercept)\n\ninterpreted_answer: [student_gradient,student_intercept]", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Construct a line with gradient {gradient} and $y$-intercept {y_intercept}.

\n

You can move the line by dragging it, or move the two points individually.

\n

{diagram}

"}, {"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": "

Where does the line cross the $x$ axis?

\n

$x = $ [[0]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "gradient_intercept_pair", "part": "p0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": "0.5", "exploreObjective": null, "minValue": "x_intercept", "maxValue": "x_intercept", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}