// Numbas version: exam_results_page_options {"name": "Interactive graphics - MSP away day 2023", "metadata": {"description": "

A collection of questions demonstrating the JSXGraph, GeoGebra and Eukleides extensions.

", "licence": "Creative Commons Attribution 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": true, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "JSXGraph", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", ""], "variable_overrides": [[], [], [], [], [], [], []], "questions": [{"name": "Create a JSXGraph diagram using JessieCode: Three triangle centres lie on a line", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Laura Midgley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18287/"}], "tags": [], "metadata": {"description": "

This question demonstrates how to construct a JSXGraph diagram using JessieCode.

\n

The construction shows a triangle and its orthocentre, circumcentre and centroid. They are always collinear. You can move the vertices of the triangle.

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

{triangle_diagram}

\n

This diagram was created using the following JessieCode:

\n
jessiecode(
  600,600,
  \"\"\"
    A = point(-2,-2);
    B = point(2,-2);
    C = point(1,2);
 
    circumcenter = circumcenter(A,B,C) << name: \"circumcenter\" >>;
    circle(A,B,C) << strokeOpacity: 0.3 >>;
 
    side_a = segment(B,C) << visible: false >>;
    side_b = segment(A,C) << visible: false >>;
    side_c = segment(B,A) << visible: false >>;
 
    polygon(A,B,C);
    
    M_a = midpoint(B,C) << visible: false >>;
    M_b = midpoint(A,C) << visible: false >>;
    M_c = midpoint(B,A) << visible: false >>;
 
    median_a = line(A,M_a) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;
    median_b = line(B,M_b) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;
    median_c = line(C,M_c) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;
    
    centroid = intersection(median_a,median_b) << name: \"centroid\" >>;
 
    p_a = perpendicular(side_a,A) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;
    p_b = perpendicular(side_b,B) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;
    p_c = perpendicular(side_c,C) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;
 
    orthocenter = intersection(p_a,p_b) << name: \"orthocenter\" >>;
 
    euler_line = line(orthocenter, centroid);
  \"\"\",
  [
    \"axis\": false
  ]
)
", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"triangle_diagram": {"name": "triangle_diagram", "group": "Ungrouped variables", "definition": "jessiecode(\n 600,600,\n \"\"\"\n A = point(-2,-2);\n B = point(2,-2);\n C = point(1,2);\n \n circumcenter = circumcenter(A,B,C) << name: \"circumcenter\" >>;\n circle(A,B,C) << strokeOpacity: 0.3 >>;\n \n side_a = segment(B,C) << visible: false >>;\n side_b = segment(A,C) << visible: false >>;\n side_c = segment(B,A) << visible: false >>;\n \n polygon(A,B,C);\n \n M_a = midpoint(B,C) << visible: false >>;\n M_b = midpoint(A,C) << visible: false >>;\n M_c = midpoint(B,A) << visible: false >>;\n \n median_a = line(A,M_a) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;\n median_b = line(B,M_b) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;\n median_c = line(C,M_c) << dash: 4, color: \"gray\", strokeOpacity: 0.3 >>;\n \n centroid = intersection(median_a,median_b) << name: \"centroid\" >>;\n \n p_a = perpendicular(side_a,A) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;\n p_b = perpendicular(side_b,B) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;\n p_c = perpendicular(side_c,C) << dash: 1, color: \"gray\", strokeOpacity: 0.3 >>;\n \n orthocenter = intersection(p_a,p_b) << name: \"orthocenter\" >>;\n \n euler_line = line(orthocenter, centroid);\n \"\"\",\n [\n \"axis\": false\n ]\n)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["triangle_diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Create a line with given gradient", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "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": "", "rulesets": {}, "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}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["dx", "dy", "gradient", "y_intercept", "diagram", "gradient_intercept_pair", "x_intercept"], "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"}, {"name": "Immediately show a plot of the student's function", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

This question shows a JSXGraph diagram above a mathematical expression input, containing a plot of the expression the student enters.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jsxgraph(\n 500,500,\n [\n \"f\": ['functiongraph',[expr,-5,5], [\"id\": \"f\"]]\n ]\n)", "description": "", "templateType": "anything", "can_override": false}, "expr": {"name": "expr", "group": "Ungrouped variables", "definition": "expression(\"x\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diagram", "expr"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "jxg_input:\n [ jxg_show(diagram[\"f\"],false) ]\n +\n if(studentExpr<>nothing,\n if(set(findvars(studentExpr))<>set(\"x\"),\n warn(\"Your expression must only use the variable $x$\");\n []\n ,\n [ jxg_show(diagram[\"f\"],true)\n , jxg_set_term(diagram[\"f\"], studentExpr)\n ]\n )\n ,\n []\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{diagram}

\n

Write an expression in terms of $x$ in the box below. It will be plotted in the box above.

", "answer": "x", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "JSXGraph interactive Venn diagram", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "tags": [], "metadata": {"description": "

This question demonstrates a few ways of interacting with a Venn diagram drawn using JSXGraph.

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

This question demonstrates a few ways of interacting with a Venn diagram.

\n

Here's a blank Venn diagram with two subsets:

\n

{venn_diagram_2(\"A\",\"B\")}

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "One point", "definition": "random(-5..5 except 0)", "description": "", "templateType": "anything", "can_override": false}, "ns": {"name": "ns", "group": "Ungrouped variables", "definition": "shuffle(-7..7 except 0)[0..6]", "description": "", "templateType": "anything", "can_override": false}, "venn_diagram_many_checkboxes": {"name": "venn_diagram_many_checkboxes", "group": "Ungrouped variables", "definition": "jxg_add_objects(venn_diagram_2(\"Positive\",\"Even\"),\n map(['point',[i-len(ns)/2,3],[\"id\":'n_{i}',\"size\":5,name:\"{ns[i]}\"]],i,0..len(ns)-1)\n)", "description": "", "templateType": "anything", "can_override": false}, "marking_matrix": {"name": "marking_matrix", "group": "Ungrouped variables", "definition": "map(\n [award(1,n>0),award(1,mod(n,2)=0)],\n n,\n ns\n)", "description": "", "templateType": "anything", "can_override": false}, "venn_diagram_one_checkboxes": {"name": "venn_diagram_one_checkboxes", "group": "One point", "definition": "jxg_run_jessiecode(venn_diagram_2(\"Positive\",\"Even\"),\"\"\"\n A = point(0,3) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}, "venn_diagram_one_solo": {"name": "venn_diagram_one_solo", "group": "One point", "definition": "jxg_run_jessiecode(venn_diagram_2(\"Positive\",\"Even\"),\"\"\"\n A = point(0,3) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}, "venn_diagram_many_solo": {"name": "venn_diagram_many_solo", "group": "Ungrouped variables", "definition": "jxg_add_objects(venn_diagram_2(\"Positive\",\"Even\"),\n map(['point',[i-len(ns)/2,3],[\"id\":'n_{i}',\"size\":5,name:\"{ns[i]}\"]],i,0..len(ns)-1)\n)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ns", "venn_diagram_many_checkboxes", "marking_matrix", "venn_diagram_many_solo"], "variable_groups": [{"name": "One point", "variables": ["n", "venn_diagram_one_checkboxes", "venn_diagram_one_solo"]}], "functions": {"venn_diagram_2": {"parameters": [["set1_name", "string"], ["set2_name", "string"]], "type": "jsxgraphboard", "language": "jme", "definition": "jessiecode(500,400,[-5,4,5,-4],\"\"\"\n r = 2.5;\n circle([-1.5,0],r) <>;\n circle([1.5,0],r) <>;\n text(-2.5,-r-0.5,\"{set1_name}\") <>;\n text(2.5,-r-0.5,\"{set2_name}\") <>;\n\"\"\",\n [\"grid\": false, \"axis\": false]\n)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": true, "customName": "Placing one point", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The following two parts show two ways of interactively placing a point on a Venn diagram, and marking it.

\n

In the first, there's a diagram and checkboxes for membership of each subset. When you move the point the checkboxes are updated, and if you change the checkboxes the point is moved to an appropriate point on the diagram.

\n

If you're assessing the student's ability to interpret a Venn diagram, the checkboxes make explicit the meaning of the point's position, so they shouldn't be visible. The second part just shows the diagram.

"}, {"type": "m_n_2", "useCustomName": true, "customName": "One point, with checkboxes", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "diagram: venn_diagram_one_checkboxes\n\npoint (The point that the student should move): diagram[\"A\"]\n\nshould_move (After the student changes a tickbox, should the point move?):\n studentAnswer <> jxg_output\n\njxg_input (After the student changes a tickbox, move the point if necessary):\n if(should_move,\n let(\n // encode the subset memberships together as a number\n q, 2*award(1,studentAnswer[0][0]) + award(1,studentAnswer[1][0]),\n // appropriate positions for each combination of subset memberships\n ps, [vector(0,3), vector(2,0), vector(-2,0), vector(0,0)],\n // move the point\n [jxg_set_position(point,ps[q])]\n ),\n // if the point's position already matches the student's answer, don't move it\n []\n )\n\ncoords (The coordinates of the point):\n jxg_position(point)\n\nin_set_one (Is the point in the first subset circle?):\n jxg_has_point(diagram[\"c_1\"], coords)\n\nin_set_two (Is the point in the second subset circle?):\n jxg_has_point(diagram[\"c_2\"], coords)\n\njxg_output (Fill in the answer widget when the board changes):\n // The answer format for multiple choice parts is a 2D array of true/false values.\n // For \"choose several from a list\" parts, the array has one column, and a row for each choice.\n [[in_set_one], [in_set_two]]", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

This Venn diagram shows the properties \"even\" and \"positive\" for integers.

\n

Decide if {n} is positive, and if it is even. Tick the boxes below, or move the point labelled {n} to the appropriate position on the diagram.

\n

{venn_diagram_one_checkboxes}

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": 0, "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "markingMethod": "all-or-nothing", "choices": ["Positive", "Even"], "matrix": ["award(1,n>0)", "award(1,mod(n,2)=0)"], "distractors": ["", ""]}, {"type": "extension", "useCustomName": true, "customName": "One point, without checkboxes", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "diagram: venn_diagram_one_solo\n\npoint: diagram[\"A\"]\n\ncoords: jxg_position(point)\n\nin_set_one: jxg_has_point(diagram[\"c_1\"], coords)\n\nin_set_two: jxg_has_point(diagram[\"c_2\"], coords)\n\ncorrect_in_set_one: n>0\n\ncorrect_in_set_two: mod(n,2)=0\n\ncorrect_answer: [correct_in_set_one, correct_in_set_two]\n\nmark_set_one:\n if(in_set_one = correct_in_set_one,\n add_credit(0.5,if(in_set_one, \"{n} is positive.\", \"{n} is not positive.\"))\n ,\n negative_feedback(\n if(in_set_one, \n \"You said that {n} is positive, but it is not.\"\n , \"You said that {n} is not positive, but it is.\"\n )\n )\n )\n\nmark_set_two:\n if(in_set_two = correct_in_set_two,\n add_credit(0.5,if(in_set_one, \"{n} is even.\", \"{n} is not even.\"))\n ,\n negative_feedback(\n if(in_set_two, \n \"You said that {n} is even, but it is not.\"\n , \"You said that {n} is not even, but it is.\"\n )\n )\n )\n\nmark:\n apply(mark_set_one);\n apply(mark_set_two)\n\ninterpreted_answer:\n [in_set_one, in_set_two]", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

This Venn diagram shows the properties \"even\" and \"positive\" for integers.

\n

Move the point representing the number {n} to an appropriate position on the diagram.

\n

{venn_diagram_one_solo}

"}, {"type": "information", "useCustomName": true, "customName": "Placing several points", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The following two parts show two ways of interactively placing several points on a Venn diagram, and marking them.

\n

In the first, there's a diagram and checkboxes for membership of each subset. When you move a point the checkboxes are updated, and if you change the checkboxes the corresponding is moved to an appropriate point on the diagram.

\n

If you're assessing the student's ability to interpret a Venn diagram, the checkboxes make explicit the meaning of the point's position, so they shouldn't be visible. The second part just shows the diagram.

"}, {"type": "m_n_x", "useCustomName": true, "customName": "Several points, with checkboxes", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "diagram: venn_diagram_many_checkboxes\n\nshould_change (After the student changes their input, which points need to move?):\n filter(\n [contained[0][i],contained[1][i]] <> [studentAnswer[0][i], studentAnswer[1][i]],\n i,\n 0..len(ns)-1\n )\n\njxg_input (After the student changes their answer, move the corresponding points):\n map(\n let(\n // encode the subset memberships together as a number in [0,1,2,3]\n q, 2*award(1,studentAnswer[0][i]) + award(1,studentAnswer[1][i]),\n // each point should be at a different y coordinate so they don't overlap\n y, 1.5*(-1 + 2*i/(len(ns)-1)),\n // positions for each combination of subset memberships\n ps, [vector(i-len(ns)/2,3),vector(2,y),vector(-2,y),vector(0,y)],\n // move the point to a position matching the chosen subset memberships\n jxg_set_position(diagram[\"n_{i}\"],ps[q])\n ),\n i,\n should_change\n )\n\n\ncoords (The coordinates of each point): \n map(jxg_position(diagram[\"n_{i}\"]),i,0..len(ns)-1)\n\ncontained (For each subset circle, decide for each point if it's inside that subset or not):\n map(map(jxg_has_point(diagram[x], c[0], c[1]),c,coords), x, [\"c_1\",\"c_2\"])\n\njxg_output (Fill in the answer widget when the diagram changes): \n contained", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The Venn diagram below represents the set of integers, with the positive and even numbers as subsets.

\n

For each of the numbers {join(ns,', ')}, decide if it is positive and if it is even. Tick the boxes below, or move the points representing the numbers to the appropriate positions on the diagram.

\n

{venn_diagram_many_checkboxes}

", "minMarks": 0, "maxMarks": "6", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "markingMethod": "score per matched cell", "choices": "map(string(n),n,ns)", "matrix": "marking_matrix", "layout": {"type": "all", "expression": ""}, "answers": ["Positive", "Even"]}, {"type": "extension", "useCustomName": true, "customName": "Several points, without checkboxes", "marks": "6", "scripts": {}, "customMarkingAlgorithm": "diagram: venn_diagram_many_solo\n\npoints (The points to move):\n map(diagram[\"n_{i}\"],i,0..len(ns)-1)\n\ncoords (The coordinates of each point): \n map(jxg_position(p),p,points)\n\ncorrect_memberships:\n map(\n [n>0, mod(n,2)=0],\n n,\n ns\n )\n\nstudent_memberships (For each point, is it inside each of the subset circles?):\n map(\n [jxg_has_point(diagram[\"c_1\"],c), jxg_has_point(diagram[\"c_2\"],c)],\n c,\n coords\n )\n\ncredit_per: 1/(2*len(ns))\n\nmark_points:\n map(\n let(\n [c_1,c_2], correct, \n [s_1,s_2], student,\n if(c_1 = s_1,\n add_credit(credit_per,if(c_1, \"{n} is positive.\", \"{n} is not positive.\"))\n ,\n negative_feedback(\n if(s_1, \n \"You said that {n} is positive, but it is not.\"\n , \"You said that {n} is not positive, but it is.\"\n )\n )\n )\n if(c_2 = s_2,\n add_credit(credit_per,if(c_2, \"{n} is even.\", \"{n} is not even.\"))\n ,\n negative_feedback(\n if(s_2, \n \"You said that {n} is even, but it is not.\"\n , \"You said that {n} is not even, but it is.\"\n )\n )\n )\n ),\n [correct,student,n],\n zip(correct_memberships, student_memberships, ns)\n )\n\nmark:\n apply(mark_points)\n\ninterpreted_answer:\n student_memberships", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The Venn diagram below represents the set of integers, with the positive and even numbers as subsets.

\n

For each of the numbers {join(ns,', ')}, decide if it is positive and if it is even. Move the points representing the numbers to the appropriate positions on the diagram.

\n

{venn_diagram_many_solo}

"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "JSXGraph: interactive 2D optimisation", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "tags": [], "metadata": {"description": "

A 2D linear programming problem: optimise the profit from producing two different kinds of product, which both use the same limited resources.

\n

A JSXGraph diagram illustrates the problem and can be used to find an answer.

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

A factory produces two items, {prod_1_name} and {prod_2_name}.

\n

They both use {resource_1_name} and {resource_2_name}.

\n

You have {max_resource_1} {resource_1_unit} {resource_1_name} and {max_resource_2} {resource_2_unit} {resource_2_name}.

\n

Each {prod_1_name} uses {resource_1_per_prod_1} {resource_1_unit} {resource_1_name} and {resource_2_per_prod_1} {resource_2_unit} {resource_2_name}, and can be sold for {currency(prod_1_price,\"£\",\"p\")}.

\n

Each {prod_2_name} uses {resource_1_per_prod_2} {resource_1_unit} {resource_1_name} and {resource_2_per_prod_2} {resource_2_unit} {resource_2_name}, and can be sold for {currency(prod_2_price,\"£\",\"p\")}.

\n

The graph below shows these constraints: the horizontal axis corresponds to the number of {prod_1_name} produced, and the vertical axis corresponds to the number of {prod_2_name} produced.

\n

The solid lines show the constraints corresponding to the amounts of {resource_1_name} and {resource_2_name} available, and the dashed line represents revenue.

\n

{diagram}

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"max_resource_1": {"name": "max_resource_1", "group": "Setup", "definition": "random(100..200#10)", "description": "", "templateType": "anything", "can_override": false}, "resource_1_per_prod_1": {"name": "resource_1_per_prod_1", "group": "Setup", "definition": "round(max_resource_1/random(1..10))", "description": "", "templateType": "anything", "can_override": false}, "resource_1_per_prod_2": {"name": "resource_1_per_prod_2", "group": "Setup", "definition": "round(max_resource_1/random(8..20))", "description": "", "templateType": "anything", "can_override": false}, "max_resource_2": {"name": "max_resource_2", "group": "Setup", "definition": "random(1000..2000#50)", "description": "", "templateType": "anything", "can_override": false}, "resource_2_per_prod_1": {"name": "resource_2_per_prod_1", "group": "Setup", "definition": "round(max_resource_2/random(8..20))", "description": "", "templateType": "anything", "can_override": false}, "resource_2_per_prod_2": {"name": "resource_2_per_prod_2", "group": "Setup", "definition": "round(max_resource_2/random(1..10))", "description": "", "templateType": "anything", "can_override": false}, "resource_1_name, resource_2_name": {"name": "resource_1_name, resource_2_name", "group": "Ungrouped variables", "definition": "[\"metal\", \"plastic\"]", "description": "", "templateType": "anything", "can_override": false}, "prod_1_name, prod_2_name": {"name": "prod_1_name, prod_2_name", "group": "Ungrouped variables", "definition": "[\"toy\", \"kitchen utensil\"]", "description": "", "templateType": "anything", "can_override": false}, "prod_1_price": {"name": "prod_1_price", "group": "Setup", "definition": "random(1..3#0.1)", "description": "", "templateType": "anything", "can_override": false}, "prod_2_price": {"name": "prod_2_price", "group": "Setup", "definition": "random(1..3#0.1)", "description": "", "templateType": "anything", "can_override": false}, "resource_1_unit, resource_2_unit": {"name": "resource_1_unit, resource_2_unit", "group": "Ungrouped variables", "definition": "[\"kg\", \"kg\"]", "description": "", "templateType": "anything", "can_override": false}, "diagram": {"name": "diagram", "group": "Diagram", "definition": "jessiecode(400,400,[-prod_1_max_production*0.3, prod_2_max_production*1.5, prod_1_max_production*1.5, -prod_2_max_production*0.3],\"\"\"\n l1a = point(0,{max_resource_1/resource_1_per_prod_2}) <>;\n l1b = point({max_resource_1/resource_1_per_prod_1},0) <>;\n l1 = line(l1a,l1b) <>;\n\n l2a = point(0,{max_resource_2/resource_2_per_prod_2}) <>;\n l2b = point({max_resource_2/resource_2_per_prod_1},0) <>;\n l2 = line(l2a,l2b) <>;\n \n oa = point(0,0) <>;\n ob = point(function() {\"\"\"+\"\"\" return oa.X()+1; },function() {\"\"\"+\"\"\" return oa.Y() - {prod_1_price/prod_2_price}; }) <>;\n objective = line(oa,ob) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}, "prod_1_max_production": {"name": "prod_1_max_production", "group": "Setup", "definition": "min(max_resource_1/resource_1_per_prod_1, max_resource_2/resource_2_per_prod_1)", "description": "", "templateType": "anything", "can_override": false}, "prod_2_max_production": {"name": "prod_2_max_production", "group": "Setup", "definition": "min(max_resource_1/resource_1_per_prod_2, max_resource_2/resource_2_per_prod_2)", "description": "", "templateType": "anything", "can_override": false}, "points_to_consider": {"name": "points_to_consider", "group": "Marking", "definition": "[\n [floor(prod_1_max_production),0],\n [0,floor(prod_2_max_production)]\n] + let([ix,iy],intersection,\n [[floor(ix),floor(iy)], [floor(ix),ceil(iy)], [ceil(ix),floor(iy)]]\n)", "description": "", "templateType": "anything", "can_override": false}, "intersection": {"name": "intersection", "group": "Marking", "definition": "let(\n m, matrix([resource_1_per_prod_1, resource_1_per_prod_2], [resource_2_per_prod_1, resource_2_per_prod_2]),\n d, det(m),\n im, 1/d * matrix([resource_2_per_prod_2, -resource_1_per_prod_2], [-resource_2_per_prod_1, resource_1_per_prod_1]),\n im*vector(max_resource_1, max_resource_2)\n)", "description": "", "templateType": "anything", "can_override": false}, "valid_points": {"name": "valid_points", "group": "Marking", "definition": "filter(\n let([prod_1,prod_2],p,\n resource_1_per_prod_1 * prod_1 + resource_1_per_prod_2 * prod_2 <= max_resource_1\n and\n resource_2_per_prod_1 * prod_1 + resource_2_per_prod_2 * prod_2 <= max_resource_2\n ),\n p,\n points_to_consider\n)\n ", "description": "", "templateType": "anything", "can_override": false}, "revenue": {"name": "revenue", "group": "Marking", "definition": "map(\n prod_1_price * prod_1 + prod_2_price * prod_2,\n [prod_1,prod_2],\n valid_points\n)", "description": "", "templateType": "anything", "can_override": false}, "best_x,best_y": {"name": "best_x,best_y", "group": "Ungrouped variables", "definition": "let(\n i, filter(revenue[i]=top_revenue, i, 0..len(revenue)-1)[0],\n valid_points[i]\n)", "description": "", "templateType": "anything", "can_override": false}, "top_revenue": {"name": "top_revenue", "group": "Marking", "definition": "max(revenue)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["resource_1_name, resource_2_name", "prod_1_name, prod_2_name", "resource_1_unit, resource_2_unit", "best_x,best_y"], "variable_groups": [{"name": "Setup", "variables": ["max_resource_1", "resource_1_per_prod_1", "resource_1_per_prod_2", "resource_2_per_prod_1", "resource_2_per_prod_2", "max_resource_2", "prod_1_price", "prod_2_price", "prod_1_max_production", "prod_2_max_production"]}, {"name": "Diagram", "variables": ["diagram"]}, {"name": "Marking", "variables": ["points_to_consider", "intersection", "valid_points", "revenue", "top_revenue"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "student_prod_1: interpreted_answers[0]\n\nstudent_prod_2: interpreted_answers[1]\n\nstudent_revenue:\n student_prod_1 * prod_1_price + student_prod_2 * prod_2_price\n\nmark:\n correctif(student_revenue >= top_revenue)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

How many of each product should you make, in order to maximise your income? You can type your answer in the boxes below, or move the point on the diagram above.

\n

[[0]] {prod_1_name}

\n

[[1]] {prod_2_name}

\n

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Number of {prod_1_name} to make", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "point: diagram[\"p\"]\n\npos: jxg_position(point)\n\njxg_input:\n if(pos[1]=studentNumber, [], [jxg_set_position(point, vector(studentNumber,pos[1]))])\n\njxg_output:\n dpformat(pos[0],0)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "best_x", "maxValue": "best_x", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": 0, "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Number of {prod_2_name} to make", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "point: diagram[\"p\"]\n\npos: jxg_position(point)\n\njxg_input:\n if(pos[1]=studentNumber, [], [jxg_set_position(point, vector(pos[0],studentNumber))])\n\njxg_output:\n dpformat(pos[1],0)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "best_y", "maxValue": "best_y", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": 0, "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "JSXGraph: make a spanning tree", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "tags": [], "metadata": {"description": "

The student must make a spanning tree of the complete graph $K_5$. They can tick boxes to include or exclude edges, or toggle them by clicking on a visual representation of the graph.

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

A spanning tree of a graph is a subset of its edges which includes every vertex but has no cycles.

\n

Make a spanning tree of this graph. To include an edge in your spanning tree, tick the corresponding box below, or click on an edge in the diagram to toggle it. Excluded edges are faded out.

\n

{diagram}

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jsxgraph(400,400,[-2,2,2,-2],\n // a circle of points\n map(\n [\n 'point',\n [cos(i*2pi/num_points), sin(i*2pi/num_points)], \n [\"id\": \"p{i}\", \"name\": vertex_names[i], \"fixed\": true]\n ],\n i,\n 0..num_points-1\n )+\n // every possible edge between the points\n map(\n [\n 'segment',\n ['p{i}','p{j}'],\n [\"id\":\"l_{i}_{j}\"],\n // when an edge is clicked, toggle its opacity \n // - this is used to represent whether the edge is included\n [\"up\": \"l_{i}_{j}.strokeopacity = 1.2 - l_{i}_{j}.strokeopacity;\"\n ]\n ],\n [i,j],\n combinations(0..num_points-1,2)\n ),\n [\"grid\": false, \"axis\": false]\n)", "description": "", "templateType": "anything", "can_override": false}, "num_points": {"name": "num_points", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "vertex_names": {"name": "vertex_names", "group": "Ungrouped variables", "definition": "map(capitalise(letterordinal(i)),i,0..num_points-1)", "description": "", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "is_spanning_tree([[false,true,true],[false,false,false],[false,false,false]])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diagram", "num_points", "vertex_names", "q"], "variable_groups": [], "functions": {"is_spanning_tree": {"parameters": [["adjacency", "list"]], "type": "boolean", "language": "javascript", "definition": "var visited = {};\nvar num_visited = 0;\nvar symm = adjacency.map(function(row,i) { return row.map(function(x,j) { return i0.5, false),\n j,\n 0..num_points-1\n ),\n i,\n 0..num_points-1\n )\n\nmark:\n correctif(is_spanning_tree(studentanswer))", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": "5", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "markingMethod": "all-or-nothing", "choices": "vertex_names", "matrix": "repeat([1]+repeat(0,num_points-1),num_points)", "layout": {"type": "strictlowertriangle", "expression": ""}, "answers": "vertex_names"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Move a point to the given coordinates", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "tags": [], "metadata": {"description": "

The student is shown a diagram containing a single point at the origin. They must move the point to the given integer coordinates.

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

The point should go here:

\n

{correct_diagram}

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"coords": {"name": "coords", "group": "Ungrouped variables", "definition": "vector(x,y)", "description": "", "templateType": "anything", "can_override": false}, "diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jessiecode(400,400,\"\"\"\n point(0,0) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}, "x": {"name": "x", "group": "Ungrouped variables", "definition": "random(-3..3)", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "random(-3..3 except x)", "description": "", "templateType": "anything", "can_override": false}, "correct_diagram": {"name": "correct_diagram", "group": "Ungrouped variables", "definition": "jessiecode(400,400,\"\"\"\n point({x},{y}) <>;\n\"\"\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["x", "y", "coords", "diagram", "correct_diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "extension", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "student_pos: jxg_position(diagram[\"A\"])\n\nmark:\n correctif(student_pos=coords)\n\ninterpreted_answer: student_pos", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Move the dot to the coordinates $\\var[rowvector]{coords}$.

\n

{diagram}

"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "GeoGebra", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", ""], "variable_overrides": [[], [], []], "questions": [{"name": "Create a GeoGebra worksheet entirely in Numbas", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

This question shows how to use the GeoGebra extension to start with a blank worksheet, and add objects to it.

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

The diagram below shows points at $\\var{p1}$ and $\\var{p2}$, as well as their midpoint.

\n

{app}

", "advice": "", "rulesets": {}, "variables": {"app": {"name": "app", "group": "Ungrouped variables", "definition": "geogebra_applet(\n 800,500,\n [\n A: [\n definition: p1,\n label_visible: false\n ],\n B: [\n definition: p2,\n label_visible: false\n ],\n m: [\n definition: \"Midpoint(A,B)\",\n label_visible: false\n ]\n ]\n)", "description": "", "templateType": "anything"}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "vector(random(-5..-2), random(-4..4 except 0))", "description": "", "templateType": "anything"}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "vector(random(2..5), random(-4..4 except 0))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["p1", "p2", "app"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Link a GeoGebra object to a part's answer", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

This question demonstrates how to link a GeoGebra object to the answer to a part.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "variables": {"x": {"name": "x", "group": "Ungrouped variables", "definition": "random(-2..2 except 0)", "description": "", "templateType": "anything"}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "random(-2..2 except 0)", "description": "", "templateType": "anything"}, "lines_app": {"name": "lines_app", "group": "Ungrouped variables", "definition": "geogebra_applet(800,500,\n [\n \"A\": vector(0,0),\n \"l1\": [\n \"definition\": \"Line(({x},0),({x},1))\",\n \"label_visible\": false\n ],\n \"l2\": [\n \"definition\": \"Line((0,{y}),(1,{y}))\",\n \"label_visible\": false\n ]\n ],\n [\n [\"A\",\"p0\"]\n ]\n)", "description": "

The applet for the first part, where the student must find the point of intersection of lines $x = \\var{x}$ and $y = \\var{y}$

", "templateType": "anything"}, "width": {"name": "width", "group": "Ungrouped variables", "definition": "random(1..height-1)", "description": "", "templateType": "anything"}, "height": {"name": "height", "group": "Ungrouped variables", "definition": "random(2..6)", "description": "", "templateType": "anything"}, "area": {"name": "area", "group": "Ungrouped variables", "definition": "width*height", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["x", "y", "lines_app", "width", "height", "area"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{lines_app}

\n

What is the point of intersection of the lines $x = \\var{x}$ and $y=\\var{y}$?

\n

Enter the coordinates or move the point on the diagram above.

", "correctAnswer": "matrix([[x],[y]])", "correctAnswerFractions": false, "numRows": "2", "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"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, "prompt": "

{geogebra_applet('https://www.geogebra.org/calculator/yms47z6u',[],[[\"area\",\"p1\"]])}

\n

What is the area of a rectangle with side lengths {width} and {height}? Drag the points on the diagram above to form the rectangle, and the area will be written below.

", "minValue": "area", "maxValue": "area", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Mark a part as correct if the student moves a point to the right position", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

The student is shown a GeoGebra worksheet containing a single point on a grid. They must move the point to the required coordinates.

\n

The part is marked as correct if the point is in the right position.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "variables": {"app": {"name": "app", "group": "Ungrouped variables", "definition": "geogebra_applet(\n 800,500,\n [\n \"A\": [\n \"definition\": vector(0,0),\n \"label_visible\": false\n ]\n ],\n [\n [\"A\", \"p0\"]\n ]\n)", "description": "", "templateType": "anything"}, "target_position": {"name": "target_position", "group": "Ungrouped variables", "definition": "vector(\n random(-2..2 except 0),\n random(-2..2 except 0)\n)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["app", "target_position"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "extension", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "pos:\n value(app,\"A\")\n\nmark:\n feedback(\"The point is at $\"+latex(app,'A')+\"$.\");\n correctif(pos=target_position)\n\ninterpreted_answer:\n pos", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{app}

\n

Move the point to $\\var[rowvector]{target_position}$.

"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}, {"name": "Eukleides", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", ""], "variable_overrides": [[], [], []], "questions": [{"name": "Draw some circles with Eukleides", "extensions": ["eukleides"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

Draws a diagram showing a randomly-chosen number of circles, packed in a box.

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

There are {n} circles:

\n

{max_width(20,diagram)}

\n

Click \"Try another question like this one\" to see a different number of circles.

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(1 .. 20#1)", "description": "

The number of circles to draw

", "templateType": "randrange", "can_override": false}, "diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "eukleides(\"{n} circles\",\nlet(\ncols, ceil(sqrt(n)),\nmap(\n let(\n x, mod(i,cols),\n y, (i-x)/cols, \n p, point(x-1,y),\n [circle(p,0.4), p label(\"{i+1}\",0)]\n ),\n i,\n 0..(n-1)\n)\n))\n ", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n", "diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Problem solving in GCSE mathematics q 37", "extensions": ["eukleides", "quantities", "random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "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/"}], "rulesets": {}, "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Taken from question 37 of the book Problem Solving in GCSE Mathematics by Daniel Griller.

Given bearings and lengths of two straight lines, work out the bearing and distance back to the starting point.

A Eukleides diagram shows the setup visually.

"}, "advice": "", "tags": [], "parts": [{"showFeedbackIcon": true, "unitTests": [], "gaps": [{"showFeedbackIcon": true, "variableReplacements": [], "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "marks": 1, "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "customName": "", "showPrecisionHint": false, "type": "numberentry", "precisionPartialCredit": 0, "unitTests": [], "precisionType": "sigfig", "useCustomName": false, "variableReplacementStrategy": "originalfirst", "precision": "3", "correctAnswerStyle": "plain", "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "strictPrecision": false, "allowFractions": false, "scripts": {}, "customMarkingAlgorithm": "", "maxValue": "x", "showCorrectAnswer": true, "minValue": "x"}, {"showFeedbackIcon": true, "variableReplacements": [], "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "marks": 1, "extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "customName": "", "showPrecisionHint": false, "type": "numberentry", "precisionPartialCredit": 0, "unitTests": [], "precisionType": "sigfig", "useCustomName": false, "variableReplacementStrategy": "originalfirst", "precision": "3", "correctAnswerStyle": "plain", "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "strictPrecision": false, "allowFractions": false, "scripts": {}, "customMarkingAlgorithm": "", "maxValue": "bearing", "showCorrectAnswer": true, "minValue": "bearing"}], "steps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "marks": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "customName": "", "type": "information", "scripts": {}, "unitTests": [], "variableReplacements": [], "prompt": "

The following diagram shows all of the given information.

\n

{name} begins at $A$, moves to $B$ and then $C$.

\n

{max_height(40,max_width(30,hint_diagram))}

", "useCustomName": false, "variableReplacementStrategy": "originalfirst"}], "stepsPenalty": 0, "marks": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "customName": "", "sortAnswers": false, "type": "gapfill", "scripts": {}, "showCorrectAnswer": true, "variableReplacements": [], "prompt": "

{name} walks on a bearing of {deg(h1)} for 4 km, then turns and walks on a bearing of {deg(h2)} for {length_2} km.

\n

If {they} {if(neutral,'wish','wishes')} to return directly to {their} starting point, on what bearing should {they} walk, and for what distance?

\n

Walk for [[0]] km on a bearing of [[1]] degrees.

\n

Give your answer to 3 significant figures.

", "useCustomName": false, "variableReplacementStrategy": "originalfirst"}], "ungrouped_variables": ["solved_diagram", "h1", "h2", "person", "name", "they", "neutral", "their", "abc", "x", "theta", "bearing", "hint_diagram", "length_2"], "variables": {"bearing": {"templateType": "anything", "definition": "180+h1+theta", "description": "", "group": "Ungrouped variables", "name": "bearing"}, "hint_diagram": {"templateType": "anything", "definition": "eukleides(\"Bearings between A, B and C\",[\n let(\n ana, deg(heading_1)\n , anb, deg(heading_2)\n , a, origin\n , b, point(4,deg(90)-ana)\n , c, point(length_2,deg(90)-anb)+(b-a)\n , m, (a+vector(0,1))\n , n, (b+vector(0,1))\n , p, (c+vector(0,1.5)) \n , [\n (a..b..c)\n , (a..b) label(\"4\")\n , (b..c) label(length_2+\"\")\n , (a..c) label(\"x\",deg(180)) italic\n , (a..m) arrow\n , (b..n) arrow\n , (c..p) arrow\n , ([\n a label(\"A\",deg(180))\n , b label(\"B\")\n , c label(\"C\",deg(-90))\n , m label(\"M\",deg(90),0.1)\n , n label(\"N\",deg(90),0.1)\n , p label(\"P\",deg(90),0.1)\n ]) italic\n , angle(b,a,m) label(ana)\n , angle(c,b,n) label(anb)\n , b\n , c\n ])\n],[\"heading_1\": h1, \"heading_2\": h2, \"length_2\": 5])\n", "description": "", "group": "Ungrouped variables", "name": "hint_diagram"}, "neutral": {"templateType": "anything", "definition": "person['gender']='neutral'", "description": "", "group": "Ungrouped variables", "name": "neutral"}, "they": {"templateType": "anything", "definition": "person['pronouns']['they']", "description": "", "group": "Ungrouped variables", "name": "they"}, "h2": {"templateType": "anything", "definition": "180+random(10..30#5)", "description": "", "group": "Ungrouped variables", "name": "h2"}, "solved_diagram": {"templateType": "anything", "definition": "eukleides(\"Bearings between A, B and C\",[\n let(\n ana, deg(heading_1)\n , anb, deg(heading_2)\n , a, origin\n , b, point(4,deg(90)-ana)\n , c, point(length_2,deg(90)-anb)+(b-a)\n , m, (a+vector(0,1))\n , n, (b+vector(0,1))\n , p, (c+vector(0,1.5)) \n , [\n (a..b..c)\n , (a..b) label(\"4\")\n , (b..c) label(length_2+\"\")\n , (a..c) label(\"x\",deg(180)) italic\n , (a..m) arrow\n , (b..n) arrow\n , (c..p) arrow\n , ([\n a label(\"A\",deg(180))\n , b label(\"B\")\n , c label(\"C\",deg(-90))\n , m label(\"M\",deg(90),0.1)\n , n label(\"N\",deg(90),0.1)\n , p label(\"P\",deg(90),0.1)\n ]) italic\n , angle(b,a,m) label(ana)\n , angle(c,b,n) label(anb)\n , angle(c,a,b) label(\"\u03b8\") italic\n , angle(n,b,a) label(deg(180)-ana)\n , angle(a,b,c) label(deg(180)+ana-anb)\n , b\n , c\n ])\n],[\"heading_1\": h1, \"heading_2\": h2])", "description": "", "group": "Ungrouped variables", "name": "solved_diagram"}, "theta": {"templateType": "anything", "definition": "degrees(arcsin(5sin(abc)/x))", "description": "", "group": "Ungrouped variables", "name": "theta"}, "their": {"templateType": "anything", "definition": "person['pronouns']['their']", "description": "", "group": "Ungrouped variables", "name": "their"}, "length_2": {"templateType": "anything", "definition": "random(3..6)", "description": "", "group": "Ungrouped variables", "name": "length_2"}, "x": {"templateType": "anything", "definition": "sqrt(4^2+5^2-2*4*5*cos(abc))", "description": "", "group": "Ungrouped variables", "name": "x"}, "h1": {"templateType": "anything", "definition": "random(70..100#5)", "description": "", "group": "Ungrouped variables", "name": "h1"}, "person": {"templateType": "anything", "definition": "random_person()", "description": "", "group": "Ungrouped variables", "name": "person"}, "name": {"templateType": "anything", "definition": "person[\"name\"]", "description": "", "group": "Ungrouped variables", "name": "name"}, "abc": {"templateType": "anything", "definition": "radians(180+h1-h2)", "description": "", "group": "Ungrouped variables", "name": "abc"}}, "functions": {}, "preamble": {"js": "", "css": ""}, "statement": "", "variablesTest": {"condition": "", "maxRuns": 100}, "type": "question"}, {"name": "Diagram showing a partition of a number", "extensions": ["eukleides"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "metadata": {"description": "

A Eukleides diagram showing a list of numbers, each in their own box, with the sum drawn above.

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

{max_height(10, diagram)}

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "let(\n boxes, numbers,\n w, 1.5,\n h, 1,\n gap, 0.2,\neukleides(\"\"\"Boxes labelled {join(boxes, \", \")}, summing to {sum(boxes)}\"\"\",\n [ map(\n let(p, point(w*i,0),\n [\n polygon(rectangle(p,w,h)) filled if(n<0, color2, color1) opacity(0.5),\n polygon(rectangle(p,w,h)),\n (p+vector(w/2,h/2)) text(string(n)) description(string(n))\n ]\n ),\n [n,i],\n zip(boxes, 0..len(boxes)-1)\n )\n , point(0,h+0.1)..point(0,h+gap)..point(w*len(boxes),h+gap)..point(w*len(boxes),h+0.1) open\n , point(w*len(boxes)/2, h+gap)..point(w*len(boxes)/2, h+2*gap)\n , point(w*len(boxes)/2, h+3*gap) text(string(sum(boxes))) description(\"Sum {sum(boxes)}\")\n ]\n)\n)", "description": "

A diagram showing the list of numbers and their sum. Negative numbers are shown in a different colour to positive numbers.

", "templateType": "anything", "can_override": false}, "numbers": {"name": "numbers", "group": "Ungrouped variables", "definition": "sort(repeat(random(-10..10 except 0), random(3..6)))", "description": "

Some randomly chosen numbers.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["numbers", "diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": false, "showresultspage": "oncompletion", "navigatemode": "menu", "onleave": {"action": "none", "message": ""}, "preventleave": false, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0, "intro": "

Using randomised or interactive graphics in Numbas questions can help students to engage with the material.

\n

Being able to see the relation between algebraic and visual representations of a system can help to build understanding.

\n

There are three extensions to Numbas for integrating different interactive graphics libraries.

\n

JSXGraph is an interactive geometry, plotting and visualisation library. Diagrams are created from code, either in Numbas' JME language or JSXGraph's JessieCode language.

\n

In Numbas you can:

\n
    \n
  • Use question variables in the construction of diagrams.
  • \n
  • Link diagrams to question part inputs, updating the diagram when the student enters a new answer, and updating the input when the diagram changes.
  • \n
  • Examine the state of a diagram during a part’s marking algorithm.
  • \n
\n
    \n

    GeoGebra is a collection of tools that started with an interactive geometry package, and now includes a computer algebra system, statistical analysis tools, and augmented reality visualisation.

    \n

    In Numbas you can:

    \n
      \n
    • Create a GeoGebra worksheet from scratch, or load one from geogebra.org or a .ggb file.
    • \n
    • Replace values in the GeoGebra worksheet with values derived from question variables.
    • \n
    • Link the positions of GeoGebra objects to Number entry part inputs.
    • \n
    • Examine the state of the worksheet during a part’s marking algorithm.
    • \n
    \n
      \n

      Eukleides is a language for creating geometrical diagrams. Eukleides creates illustrations rather than interactive applets, but it provides much better accessibility than JSXGraph or GeoGebra.

      ", "end_message": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": []}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Laura Midgley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18287/"}], "extensions": ["eukleides", "geogebra", "jsxgraph", "quantities", "random_person"], "custom_part_types": [], "resources": []}