// Numbas version: exam_results_page_options {"name": "Algebra: Solving quadratics by completing the square", "extensions": [], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

", "name": "bits", "definition": "filter(x<>\"\",x,split(studentAnswer,\",\"))"}, {"description": "", "name": "expected_numbers", "definition": "settings[\"correctAnswer\"]"}, {"description": "

Is every number in the student's list valid?

", "name": "valid_numbers", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"description": "

Are the student's answers in ascending order?

Is each number in the expected answer present in the student's list the correct number of times?

", "name": "included", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "name": "all_included", "definition": "all(included)"}, {"description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

A few quadratic equations are given, to be solved by completing the square. The number of solutions is randomised.

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

Solve these equations by completing the square. If there is more than one solution, enter all the solutions separated by a comma.

\n

------------------------------------

See 5.1 and 5.2 for examples and background on solving by completing the square

\n

See 3.3 for examples of completing the square

", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "extensions": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "vector([random(1..5)]+[random(-1..-5)]+[random(-1..-5)]+[random(-1..-5)]+[random(1..5)])", "description": "", "templateType": "anything"}, "xmax": {"name": "xmax", "group": "Ungrouped variables", "definition": "vector([-a[0]]+[-a[0]]+[-a[0]]+[-a[0]]+[-a[1]]+[-a[1]]+[-a[1]]+[-a[1]])+shift", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "vector([random(-10..25)] + [random(-10..25)] + [random(-10..25)] + [random(-10..25)] + [random(-10..25)] )", "description": "", "templateType": "anything"}, "xmin": {"name": "xmin", "group": "Ungrouped variables", "definition": "vector([-a[0]]+[-a[0]]+[-a[0]]+[-a[0]]+[-a[1]]+[-a[1]]+[-a[1]]+[-a[1]])-shift", "description": "", "templateType": "anything"}, "fx": {"name": "fx", "group": "Ungrouped variables", "definition": "vector([(xmax[0]+a[0])^2+b[0]]+[(xmax[1]+a[0])^2+b[0]]+[(xmax[2]+a[0])^2+b[0]]+[(xmax[3]+a[0])^2+b[0]]+[(xmax[4]+a[1])^2+b[1]]+[(xmax[5]+a[1])^2+b[1]]+[(xmax[6]+a[1])^2+b[1]]+[(xmax[7]+a[1])^2+b[1]])", "description": "", "templateType": "anything"}, "shift": {"name": "shift", "group": "Ungrouped variables", "definition": "vector(shuffle(1..9#4)+[0]+shuffle(1..9#4)+[0])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "shift", "xmin", "xmax", "fx"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Complete the square on \$\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}}\$ [[0]]

\n

Hence solve \$\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}} = \\var{fx[0]}\$ [[1]]

\n

Also solve \$\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}} = \\var{fx[3]}\$ [[2]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(x+{a[0]})^2+{b[0]}", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "musthave": {"strings": ["(", ")", "^"], "showStrings": false, "partialCredit": 0, "message": "

please input in the form \$(x+a)^2+b\$

"}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": "

Complete the square on \$\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}}\$ [[0]]

\n

Hence solve \$\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}} = \\var{fx[4]}\$ [[1]]

\n

Also solve \$\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}} = \\var{fx[5]}\$ [[2]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(x+{a[1]})^2+{b[1]}", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "musthave": {"strings": ["(", ")", "^"], "showStrings": false, "partialCredit": 0, "message": "

please input in the form \$(x+a)^2+b\$

"}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": "