// Numbas version: finer_feedback_settings {"name": "Write a system of linear equations", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Write a system of linear equations", "tags": [], "metadata": {"description": "

In the first part, the student must write any linear equation in three unknowns. Each distinct variable can occur more than once, and on either side of the equals sign. It doesn't check that the equation has a unique solution.

\n

In the second part, they must write three equations in two unknowns. It doesn't check that they're independent or that the system has a solution. The marking algorithm on each of the gaps just checks that they're valid linear equations, and the marking algorithm for the whole gap-fill checks the number of unknowns.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": true, "customName": "Write one linear equation", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "match_linear_equation (Match the student's expression against the pattern for a linear equation):\n match(\n studentExpr,\n \"m_nogather((`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`* = (`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`*)\"\n )\n\nis_linear_equation (Is the student's expression a linear equation?):\n if(match_linear_equation[\"match\"],\n true,\n fail(\"Your answer doesn't seem to be a linear equation.\");false\n )\n\nstudent_unknowns:\n set(map(\n string(x),\n x, \n let(raw,eval(get(match_linear_equation[\"groups\"],\"a\",expression(\"[]\"))),\n if(type(raw)=\"name\", [raw],\n if(len(raw)<>2, raw,\n let(left, if(type(raw[0])=\"name\",[eval(raw[0])], eval(raw[0])),\n right, if(type(raw[1])=\"name\", [eval(raw[1])], eval(raw[1])),\n left+right\n )\n )\n )\n )\n ))\n\nnum_required_unknowns (The number of unknowns the student's equation must include): 3\n\nnum_unknowns: len(student_unknowns)\n\nright_number_unknowns:\n if(num_unknowns=num_required_unknowns,\n correct(),\n incorrect(\"Your equation contains {num_unknowns} {pluralise(num_unknowns,'unknown','unknowns')} instead of {num_required_unknowns}.\")\n )\n\nmark:\n apply(studentExpr);\n apply(is_linear_equation);\n apply(right_number_unknowns)", "extendBaseMarkingAlgorithm": true, "unitTests": [{"variables": [], "name": "x+y+z=0", "answer": {"valid": true, "value": "x+y+z=0"}, "notes": [{"name": "is_linear_equation", "expected": {"value": "true", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}, {"name": "student_unknowns", "expected": {"value": "set(\"x\",\"y\",\"z\")", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}, {"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}, {"variables": [], "name": "Not linear", "answer": {"valid": true, "value": "x^2 = 2"}, "notes": [{"name": "is_linear_equation", "expected": {"value": "false", "messages": ["Your answer doesn't seem to be a linear equation."], "warnings": [], "error": "", "valid": false, "credit": 0}}, {"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer doesn't seem to be a linear equation."], "warnings": [], "error": "", "valid": false, "credit": 0}}]}, {"variables": [], "name": "Names occur more than once", "answer": {"valid": true, "value": "x+y+x+z=0"}, "notes": [{"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}, {"variables": [], "name": "Negative terms", "answer": {"valid": true, "value": "x-2y-z=0"}, "notes": [{"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}, {"variables": [], "name": "Names on both sides", "answer": {"valid": true, "value": "x=y-z"}, "notes": [{"name": "student_unknowns", "expected": {"value": "set(\"x\",\"y\",\"z\")", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}, {"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}, {"variables": [], "name": "Only one unknown", "answer": {"valid": true, "value": "x + 2x + 3x =0"}, "notes": [{"name": "student_unknowns", "expected": {"value": "set(\"x\")", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}, {"name": "mark", "expected": {"value": "nothing", "messages": ["Your equation contains 1 unknown instead of 3."], "warnings": [], "error": "", "valid": true, "credit": 0}}]}, {"variables": [], "name": "More than one constant term, involving operations", "answer": {"valid": true, "value": "x+y+z=2+3^2"}, "notes": [{"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Write a linear equation in three unknowns.

", "answer": "x+y+z=1", "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": ""}, {"name": "y", "value": ""}, {"name": "z", "value": ""}]}, {"type": "gapfill", "useCustomName": true, "customName": "Write one linear equation", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "student_unknowns:\n list(set(flatten(map(res[\"values\"][\"student_unknowns\"], res, marked_original_order))))\n\nnum_required_unknowns (The number of unknowns the student's equation must include): \n 2\n\nnum_unknowns: \n len(student_unknowns)\n\nright_number_unknowns:\n if(num_unknowns=num_required_unknowns,\n correct(),\n incorrect(\"Your equation contains {num_unknowns} {pluralise(num_unknowns,'unknown','unknowns')} instead of {num_required_unknowns}.\")\n )\n\nmark:\n apply(gap_feedback);\n assert(all_valid, fail(translate(\"question.can not submit\")));\n apply(answers);\n apply(right_number_unknowns)", "extendBaseMarkingAlgorithm": true, "unitTests": [{"variables": [], "name": "A simple correct answer", "answer": {"valid": true, "value": ["x=1", "y=2", "x+y=3"]}, "notes": [{"name": "mark", "expected": {"value": "nothing", "messages": ["Your answer is correct.\n\nYou were awarded 3 marks."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Write a system of three linear equations in two unknowns

\n

[[0]]

\n

[[1]]

\n

[[2]]

", "gaps": [{"type": "jme", "useCustomName": true, "customName": "First line", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "match_linear_equation (Match the student's expression against the pattern for a linear equation):\n match(\n studentExpr,\n \"m_nogather((`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`* = (`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`*)\"\n )\n\nis_linear_equation (Is the student's expression a linear equation?):\n assert(match_linear_equation[\"match\"],\n fail(\"Your answer doesn't seem to be a linear equation.\")\n )\n\nstudent_unknowns:\n set(map(\n string(x),\n x, \n let(raw,eval(get(match_linear_equation[\"groups\"],\"a\",expression(\"[]\"))),\n if(type(raw)=\"name\", [raw],\n if(len(raw)<>2, raw,\n let(left, if(type(raw[0])=\"name\",[eval(raw[0])], eval(raw[0])),\n right, if(type(raw[1])=\"name\", [eval(raw[1])], eval(raw[1])),\n left+right\n )\n )\n )\n )\n ))\n\nmark:\n apply(studentExpr);\n apply(is_linear_equation)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x+y=0", "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": ""}, {"name": "y", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Second line", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "match_linear_equation (Match the student's expression against the pattern for a linear equation):\n match(\n studentExpr,\n \"m_nogather((`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`* = (`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`*)\"\n )\n\nis_linear_equation (Is the student's expression a linear equation?):\n assert(match_linear_equation[\"match\"],\n fail(\"Your answer doesn't seem to be a linear equation.\")\n )\n\nstudent_unknowns:\n set(map(\n string(x),\n x, \n let(raw,eval(get(match_linear_equation[\"groups\"],\"a\",expression(\"[]\"))),\n if(type(raw)=\"name\", [raw],\n if(len(raw)<>2, raw,\n let(left, if(type(raw[0])=\"name\",[eval(raw[0])], eval(raw[0])),\n right, if(type(raw[1])=\"name\", [eval(raw[1])], eval(raw[1])),\n left+right\n )\n )\n )\n )\n ))\n\nmark:\n apply(studentExpr);\n apply(is_linear_equation)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x+y=0", "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": ""}, {"name": "y", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Third line", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "match_linear_equation (Match the student's expression against the pattern for a linear equation):\n match(\n studentExpr,\n \"m_nogather((`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`* = (`+- ($n`? * $v;a))`* + (`!m_anywhere($v))`*)\"\n )\n\nis_linear_equation (Is the student's expression a linear equation?):\n assert(match_linear_equation[\"match\"],\n fail(\"Your answer doesn't seem to be a linear equation.\")\n )\n\nstudent_unknowns:\n set(map(\n string(x),\n x, \n let(raw,eval(get(match_linear_equation[\"groups\"],\"a\",expression(\"[]\"))),\n if(type(raw)=\"name\", [raw],\n if(len(raw)<>2, raw,\n let(left, if(type(raw[0])=\"name\",[eval(raw[0])], eval(raw[0])),\n right, if(type(raw[1])=\"name\", [eval(raw[1])], eval(raw[1])),\n left+right\n )\n )\n )\n )\n ))\n\nmark:\n apply(studentExpr);\n apply(is_linear_equation)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "x+y=0", "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": ""}, {"name": "y", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}