// Numbas version: exam_results_page_options {"name": "Quadratic expressions and equations", "metadata": {"description": "

Questions involving various techniques for rearranging and solving quadratic expressions and equations

", "licence": "Creative Commons Attribution 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "showstudentname": true, "question_groups": [{"name": "Pre-calculus", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", ""], "questions": [{"name": "Factorising Quadratic Equations with $x^2$ Coefficients of 1", "extensions": [], "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": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}], "metadata": {"description": "

Factorise three quadratic equations of the form $x^2+bx+c$.

\n

The first has two negative roots, the second has one negative and one positive, and the third is the difference of two squares.

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

Factorise the following quadratic equations.

\n

", "variables": {"v1": {"name": "v1", "group": "Part A ", "definition": "random(1..10)", "templateType": "anything", "description": ""}, "v2": {"name": "v2", "group": "Part A ", "definition": "random(2..6 except v1)", "templateType": "anything", "description": ""}, "v4": {"name": "v4", "group": "Part A ", "definition": "random(1..10 except -v3)", "templateType": "anything", "description": ""}, "v5": {"name": "v5", "group": "Part A ", "definition": "random(2..10)", "templateType": "anything", "description": ""}, "v3": {"name": "v3", "group": "Part A ", "definition": "random(-8..-1)", "templateType": "anything", "description": ""}, "v6": {"name": "v6", "group": "Part A ", "definition": "-v5", "templateType": "anything", "description": ""}}, "tags": ["Factorisation", "factorisation", "factorising quadratic equations", "Factorising quadratic equations", "taxonomy"], "ungrouped_variables": [], "functions": {}, "preamble": {"js": "question.is_factorised = function(part,penalty) {\n penalty = penalty || 0;\n if(part.credit>0) {\n // Parse the student's answer as a syntax tree\n var studentTree = Numbas.jme.compile(part.studentAnswer,Numbas.jme.builtinScope);\n\n // Create the pattern to match against \n // we just want two sets of brackets, each containing two terms\n // or one of the brackets might not have a constant term\n // or for repeated roots, you might write (x+a)^2\n var rule = Numbas.jme.compile('m_all(m_any(x,x+m_pm(m_number),x^m_number,(x+m_pm(m_number))^m_number))*m_nothing');\n\n // Check the student's answer matches the pattern. \n var m = Numbas.jme.display.matchTree(rule,studentTree,true);\n // If not, take away marks\n if(!m) {\n part.multCredit(penalty,'Your answer is not fully factorised.');\n }\n }\n}", "css": ""}, "advice": "

Quadratic equations of the form

\n

\\[x^2+bx+c=0\\]

\n

can be factorised to create an equation of the form

\n

\\[(x+m)(x+n)=0\\text{.}\\]

\n

When we expand a factorised quadratic expression we obtain

\n

\\[(x+m)(x+n)=x^2+(m+n)x+(m \\times n)\\text{.}\\]

\n

To factorise an equation of the form $x^2+bx+c$, we need to find two numbers which add together to make $b$, and multiply together to make $c$.

\n

a)

\n

\\[\\simplify{x^2+{v1+v2}x+{v1*v2}=0}\\]

\n

We need to find two values that add together to make $\\var{v1+v2}$ and multiply together to make $\\var{v1*v2}$.

\n

\\[\\begin{align}
\\var{v1} \\times \\var{v2}&=\\var{v1*v2}\\\\
\\var{v1}+\\var{v2}&=\\var{v1+v2}\\\\
\\end{align} \\]

\n

So the factorised form of the equation is

\n

\\[\\simplify{(x+{v1})(x+{v2})}=0\\text{.}\\]

\n

\n

b)

\n

We can begin factorising by finding factors of $\\var{v3*v4}$ that add together to give $\\var{v3+v4}$.

\n

\\[\\begin{align}
\\var{v3} \\times \\var{v4}&=\\var{v3*v4}\\\\
\\var{v3}+\\var{v4}&=\\var{v3+v4}\\\\
\\end{align} \\]

\n

So the factorised form of the equation is

\n

\\[\\simplify{(x+{v3})(x+{v4})}=0\\text{.}\\]

\n

c)

\n

When factorising the quadratic expression

\n

\\[\\simplify{x^2+{v5*v6}=0}\\]

\n

we need to find two values that add together to make $0$ and multiply together to make $\\var{v5*v6}$.

\n

\\begin{align}
\\var{v5} \\times \\var{v6}& = \\var{v5*v6}\\\\
\\simplify[]{ {v5} + {v6}} &= 0 \\\\
\\end{align}

\n

So the factorised form of the equation is

\n

\\[\\simplify{(x+{v5})(x+{v6})}=0\\text{.}\\]

", "type": "question", "variable_groups": [{"variables": ["v1", "v2", "v3", "v4", "v5", "v6"], "name": "Part A "}], "parts": [{"scripts": {}, "variableReplacements": [], "customName": "", "useCustomName": false, "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"mustmatchpattern": {"pattern": "(`+-x^$n`? + `+- $n)`* * $z", "message": "Your answer is not fully factorised.", "partialCredit": 0, "nameToCompare": ""}, "variableReplacementStrategy": "originalfirst", "unitTests": [], "checkingAccuracy": 0.001, "scripts": {}, "failureRate": 1, "checkVariableNames": false, "marks": 1, "valuegenerators": [{"name": "x", "value": ""}], "variableReplacements": [], "useCustomName": false, "showPreview": true, "customName": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "vsetRange": [0, 1], "showCorrectAnswer": true, "type": "jme", "answer": "(x+{v1})(x+{v2})", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "vsetRangePoints": 5}], "type": "gapfill", "marks": 0, "customMarkingAlgorithm": "", "prompt": "

$\\simplify{x^2+{v1+v2}x+{v1*v2}=0}$

\n

[[0]] $=0$

\n

", "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "customName": "", "useCustomName": false, "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"mustmatchpattern": {"pattern": "(`+-x^$n`? + `+- $n)`* * $z", "message": "Your answer is not fully factorised.", "partialCredit": 0, "nameToCompare": ""}, "variableReplacementStrategy": "originalfirst", "unitTests": [], "checkingAccuracy": 0.001, "scripts": {}, "failureRate": 1, "checkVariableNames": false, "marks": 1, "valuegenerators": [{"name": "x", "value": ""}], "variableReplacements": [], "useCustomName": false, "showPreview": true, "customName": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "vsetRange": [0, 1], "showCorrectAnswer": true, "type": "jme", "answer": "(x+{v3})(x+{v4})", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "vsetRangePoints": 5}], "type": "gapfill", "marks": 0, "customMarkingAlgorithm": "", "prompt": "

$\\simplify{x^2+{v3+v4}x+{v3*v4}}=0$

\n

[[0]] $=0$

\n

", "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "customName": "", "useCustomName": false, "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"mustmatchpattern": {"pattern": "(`+-x^$n`? + `+- $n)`* * $z", "message": "
Your answer is not fully factorised.
", "partialCredit": 0, "nameToCompare": ""}, "variableReplacementStrategy": "originalfirst", "unitTests": [], "checkingAccuracy": 0.001, "scripts": {}, "failureRate": 1, "checkVariableNames": false, "marks": 1, "valuegenerators": [{"name": "x", "value": ""}], "variableReplacements": [], "useCustomName": false, "showPreview": true, "customName": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "vsetRange": [0, 1], "showCorrectAnswer": true, "type": "jme", "answer": "(x+{v5})(x+{v6})", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "vsetRangePoints": 5}], "type": "gapfill", "marks": 0, "customMarkingAlgorithm": "", "prompt": "

$\\simplify{x^2+{v5*v6}}=0$

\n

[[0]] $=0$

", "variableReplacementStrategy": "originalfirst"}], "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {}}, {"name": "Factorising Quadratic Equations with $x^2$ Coefficients Greater than 1", "extensions": [], "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": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}], "advice": "

a)

\n

As this question involves a number greater than $1$ before the $x^2$ value it has a factorised form $(ax+b)(cx+d)$.

\n

To find $a$ and $c$, we need to consider the factors of $\\var{a*c}$.

\n

We are already given that one of them is $\\var{a}$, so we know that the other one must be $\\var{c}$.

\n

This means our factorised equation must take the form

\n

\\[(\\var{a}x+b)(\\var{c}x+d)=0\\text{.}\\]

\n

This expands to

\n

\\[ \\simplify{ {a*c}x^2 + ({a}*d+{c}*b)x + a*b} \\]

\n

So we must find two numbers which add together to make $\\var{a*d+b*c}$, and multiply together to make $\\var{b*d}$.

\n

Therefore $b$ and $d$ must satisfy

\n

\\begin{align}
b \\times d &=\\var{b*d}\\\\
\\simplify{{a}d+{c}b} &= \\var{a*d+b*c}\\text{.}
\\end{align}

\n

$b = \\var{b}$ and $d = \\var{d}$ satisfy these equations:

\n

\\begin{align}
\\var{b} \\times \\var{d} &=\\var{b*d}\\\\
\\simplify[]{ {a}*{d} + {b}*{c} } &= \\var{a*d+b*c}
\\end{align}

\n

So the factorised form of the equation is 

\n

\\[ \\simplify{({a}x+{b})({c}x+{d}) = 0} \\text{.}\\]

\n

b)

\n

$\\simplify{({a}x+{b})({c}x+{d}) = 0}$ when either $\\var{a}x+\\var{b} = 0$ or $\\var{c}x+ \\var{d} = 0$.

\n

So the roots of the equation are $\\var[fractionnumbers]{-b/a}$ and $\\var[fractionnumbers]{-d/c}$.

\n

", "statement": "", "variables": {"b": {"templateType": "anything", "name": "b", "description": "

$b$ in $(ax+b)(cx+d)$

", "group": "last q", "definition": "random(-5..5 except 0)"}, "c": {"templateType": "anything", "name": "c", "description": "

$c$ in $(ax+b)(cx+d)$

", "group": "last q", "definition": "random(2..8 except a)"}, "a": {"templateType": "anything", "name": "a", "description": "

$a$ in $(ax+b)(cx+d)$

", "group": "last q", "definition": "random(2..3)"}, "roots": {"templateType": "anything", "name": "roots", "description": "

The roots of the equation

", "group": "last q", "definition": "sort([-b/a,-d/c])"}, "d": {"templateType": "anything", "name": "d", "description": "

$d$ in $(ax+b)(cx+d)$

", "group": "last q", "definition": "random(-8..8 except 0)"}}, "tags": ["coefficient of x^2 greater than 1", "Factorisation", "factorisation", "factorising", "factorising quadratic equations", "Factorising quadratic equations", "factorising quadratic equations with x^2 coefficients greater than 1", "taxonomy"], "ungrouped_variables": [], "functions": {}, "rulesets": {}, "metadata": {"description": "

Factorise a quadratic equation where the coefficient of the $x^2$ term is greater than 1 and then write down the roots of the equation

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "variable_groups": [{"variables": ["a", "b", "c", "d", "roots"], "name": "last q"}], "preamble": {"js": "", "css": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"scripts": {}, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "b", "correctAnswerFraction": false, "allowFractions": false, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "b", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "c", "correctAnswerFraction": false, "allowFractions": false, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "c", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "d", "correctAnswerFraction": false, "allowFractions": false, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "d", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}], "type": "gapfill", "marks": 0, "variableReplacementStrategy": "originalfirst", "prompt": "

Factorise the equation

\n

$\\simplify{{a*c}x^2+{a*d+b*c}x+{b*d}=0}\\text{.}$

\n

$(\\var{a}x+\\phantom{.}$[[0]]$) ($[[1]]$x+\\phantom{.}$[[2]]$)\\; = 0$

", "variableReplacements": [], "showFeedbackIcon": true}, {"scripts": {}, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "roots[0]", "correctAnswerFraction": true, "allowFractions": true, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "roots[0]", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "roots[1]", "correctAnswerFraction": true, "allowFractions": true, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "roots[1]", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}], "type": "gapfill", "marks": 0, "variableReplacementStrategy": "originalfirst", "prompt": "

\n

Write down the roots of the equation above.

\n

Input your answer as $x_1$ and $x_2$, where $x_1<x_2$.

\n

$x_1=$ [[0]]

\n

$x_2=$ [[1]]

", "variableReplacements": [], "showFeedbackIcon": true}]}, {"name": "Algebra: Solving quadratics by factorising", "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.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(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 )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\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_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "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 )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

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

", "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?

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

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

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}], "tags": [], "metadata": {"description": "

Some quadratics are to be solved by factorising

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

Solve the quadratic equations by factorising. If there is more than solution, enter them all separated by a comma.

\n

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

", "advice": "

See 5.1 and 5.2 for how to use factorising to solve quadratics.

\n

See 3.3 and 3.5 for factorising.

", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "variables": {"d": {"name": "d", "group": "Ungrouped variables", "definition": "map(num[j][3],j,0..4)", "description": "", "templateType": "anything"}, "solmin": {"name": "solmin", "group": "Ungrouped variables", "definition": "vector([min(-d[0]/c[0],-b[0]/a[0])]+[min(-d[1]/c[1],-b[1]/a[1])]+[min(-d[2]/c[2],-b[2]/a[2])]+[min(-d[3]/c[3],-b[3]/a[3])]+[min(-d[4]/c[4],-b[4]/a[4])])", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "map(num[j][1],j,0..4)", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "map(num[j][2],j,0..4)", "description": "", "templateType": "anything"}, "solmax": {"name": "solmax", "group": "Ungrouped variables", "definition": "vector([max(-d[0]/c[0],-b[0]/a[0])]+[max(-d[1]/c[1],-b[1]/a[1])]+[max(-d[2]/c[2],-b[2]/a[2])]+[max(-d[3]/c[3],-b[3]/a[3])]+[max(-d[4]/c[4],-b[4]/a[4])])", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "map(num[j][0],j,0..4)", "description": "", "templateType": "anything"}, "num": {"name": "num", "group": "Ungrouped variables", "definition": "[[1,random(6..7),1,random(2..5)]] +\nshuffle([\n [1,random(-4..-6),1,random(-3..3 except 0)],\n [1,random(-4..-6),random(2..3),random(-1..1 except 0)],\n [1,random(1,3,5),4,random(1,3,5)*random([1,-1])],\n [1,random(-4..-6),3,random([-1,1,-2,2])]\n ])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["num", "a", "b", "c", "d", "solmax", "solmin"], "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": "

Factorise $\\simplify{{a[0]*c[0]}x^2+{a[0]*d[0]+b[0]*c[0]}x+ {b[0]*d[0]}}$. [[0]]

\n

Hence solve $\\simplify{{a[0]*c[0]}x^2+{a[0]*d[0]+b[0]*c[0]}x+ {b[0]*d[0]}}=0$.

\n

[[1]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "({a[0]}x+{b[0]})({c[0]}x+{d[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": ""}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[solmin[0],solmax[0]]", "allowFractions": true, "correctAnswerFractions": true}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Factorise $\\simplify{{a[1]*c[1]}x^2+{a[1]*d[1]+b[1]*c[1]}x+ {b[1]*d[1]}}$. [[0]]

\n

Hence solve $\\simplify{{a[1]*c[1]}x^2+{a[1]*d[1]+b[1]*c[1]}x+ {b[1]*d[1]}}=0$.

\n

[[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "({a[1]}x+{b[1]})({c[1]}x+{d[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": ""}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[solmin[1],solmax[1]]", "allowFractions": true, "correctAnswerFractions": true}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Factorise $\\simplify{{a[2]*c[2]}x^2+{a[2]*d[2]+b[2]*c[2]}x+ {b[2]*d[2]}}$. [[0]]

\n

Hence solve $\\simplify{{a[2]*c[2]}x^2+{a[2]*d[2]+b[2]*c[2]}x+ {b[2]*d[2]}}=0$.

\n

[[1]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "({a[2]}x+{b[2]})({c[2]}x+{d[2]})", "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": ""}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": ""}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[solmin[2],solmax[2]]", "allowFractions": true, "correctAnswerFractions": true}}], "sortAnswers": false}]}, {"name": "Completing the Square", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Katie Lester", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/586/"}, {"name": "Wan Mekwi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4058/"}], "tags": [], "metadata": {"description": "

Write the expression $ax^2+bx+c$ in completed square form $a(x+p)^2+k$.

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

Rewrite the expression \\[\\simplify{{a}x^2+{b}x+{c}}\\] in completed square form $a(x+k)^2+p$ for suitable numbers $a, k$ and $p$.

\n

\n

Your answer must be input exactly in this form.

", "advice": "

(a)

\n

Given the quadratic $q(x)=\\simplify{{a}x^2+{b}x+ {c}}$, one way of completing the square is to simply expand the term $a(x+k)^2+p$ and equate coefficients to the quadratic term. 

\n

Expanding  $a(x+k)^2+p$ gives $ax^2 + 2akx + ak^2 + p$. 

\n

Equating coefficients gives:

\n

$x^2:\\quad \\var{a}=a$ or $a=\\var{a}$.

\n

$x:\\quad \\var{b}= 2ak \\implies k =  \\simplify{{b}/(2{a})}$

\n

constant: $\\var{c}=ak^2+p \\implies p=\\var{c}-ak^2=\\simplify[all, fractionNumbers]{{c-b^2/(4a)}}$.

\n

Now, put these together to obtain: $\\qquad \\simplify[all, fractionNumbers]{{a}(x+{b}/(2{a}))^2+{c-b^2/(4a)}}$.

\n
\n

(b)

\n

Completing the square for this function gives:$\\qquad \\simplify[all, fractionNumbers]{{a}(x+{b}/(2{a}))^2+{c-b^2/(4a)}}$.

\n

The function attains its turning point when $\\quad \\simplify{{a}(x+{b}/(2{a}))^2}=0$ 

\n

So the $x$ coordinate of the turning point is $\\simplify{-{b}/(2{a})}$.

\n

The $y$ coordinate is $k=\\simplify[all, fractionNumbers]{{c-b^2/(4a)}}$.

\n

Hence the turning point is $\\quad (\\simplify{-{b}/(2{a})},\\simplify[all, fractionNumbers]{{c-b^2/(4a)}})$

", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-5..7 except 0)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-20..20)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-10..10 except 0)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "c", "b"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "(a)", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$\\simplify{{a}x^2+{b}x+ {c}} = \\phantom{{}}$ [[0]].

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

Given the quadratic $q(x)=\\simplify{{a}x^2+{b}x+ {c}}$, one way of completing the square is to simply expand the term $a(x+k)^2+p$ and equate coefficients to the quadratic term. 

\n

Expanding  $a(x+k)^2+p$ gives $ax^2 + 2akx + ak^2 + p$. 

\n

Equating coefficients gives:

\n

$x^2:\\quad \\var{a}=a$ or $a=\\var{a}$.

\n

$x:\\quad \\var{b}= 2ak \\implies k =  \\simplify{{b}/(2{a})}$

\n

constant: $\\var{c}=ak^2+p \\implies p=\\var{c}-ak^2=\\simplify[all, fractionNumbers]{{c-b^2/(4a)}}$.

\n

Now, put these together to obtain: $\\qquad \\simplify[all, fractionNumbers]{{a}(x+{b}/(2{a}))^2+{c-b^2/(4a)}}$.

"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 2, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{a}(x+{b}/(2{a}))^2+{c}-{b}^2/(4{a})", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.0001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": 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": "

Input your answer in the form $(x+a)^2+b$.

"}, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "(b)", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Hence, state the coordinates of the turning point for $q(x)=\\simplify{{a}x^2+{b}x+ {c}}$:

\n

Turning point:$\\quad \\phantom{}$[[0]].

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

Completing the square for this function gives:$\\qquad \\simplify[all, fractionNumbers]{{a}(x+{b}/(2{a}))^2+{c-b^2/(4a)}}$.

\n

The function attains its turning point when $\\quad \\simplify{{a}(x+{b}/(2{a}))^2}=0$ 

\n

So the $x$ coordinate of the turning point is $\\simplify{-{b}/(2{a})}$.

\n

The $y$ coordinate is $k=\\simplify[all, fractionNumbers]{{c-b^2/(4a)}}$.

\n

Hence the turning point is $\\quad (\\simplify{-{b}/(2{a})},\\simplify[all, fractionNumbers]{{c-b^2/(4a)}})$

"}], "gaps": [{"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, "correctAnswer": "matrix([-{b}/(2{a}),{c}-{b}^2/(4{a})])", "correctAnswerFractions": true, "numRows": 1, "numColumns": "2", "allowResize": false, "tolerance": 0, "markPerCell": true, "allowFractions": true, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Complete the square and find solutions", "extensions": [], "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": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}], "variable_groups": [], "variables": {"bits": {"templateType": "anything", "description": "

After completing the square, the expression will have the form $(x + \\mathrm{bits}[0])^2 - \\mathrm{bits}[1]^2$.

", "definition": "sort(shuffle(1..9)[0..2])", "name": "bits", "group": "Ungrouped variables"}, "big": {"templateType": "anything", "description": "

The constant term in the expanded quadratic.

", "definition": "bits[0]^2-bits[1]^2", "name": "big", "group": "Ungrouped variables"}, "sml": {"templateType": "anything", "description": "

The coefficient of $x$ in the expanded quadratic.

", "definition": "2*bits[0]", "name": "sml", "group": "Ungrouped variables"}}, "parts": [{"type": "gapfill", "showCorrectAnswer": true, "unitTests": [], "prompt": "

Write the following expression in the form $a(x+b)^2-c$.

\n

$\\simplify {x^2+{sml}x+{big}} = $ [[0]]

", "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "musthave": {"partialCredit": 0, "showStrings": false, "strings": [")^2"], "message": "

It doesn't look like you've completed the square.

"}, "variableReplacementStrategy": "originalfirst", "failureRate": 1, "notallowed": {"partialCredit": 0, "showStrings": false, "strings": ["x^2"], "message": "

It doesn't look like you've completed the square.

"}, "vsetRange": [0, 1], "variableReplacements": [], "customMarkingAlgorithm": "", "vsetRangePoints": 5, "adaptiveMarkingPenalty": 0, "customName": "", "type": "jme", "checkingAccuracy": 0.001, "answer": "(x+{bits[0]})^2-{bits[1]^2}", "valuegenerators": [{"value": "", "name": "x"}], "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "marks": 0, "variableReplacements": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "customName": ""}, {"type": "gapfill", "showCorrectAnswer": true, "unitTests": [], "prompt": "

Now solve the quadratic equation

\n

\\[ \\simplify {x^2+{sml}x+{big}} = 0\\text{.} \\]

\n

$x_1=$ [[0]]

\n

or

\n

$x_2=$ [[1]]

", "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": true, "scripts": {}, "customMarkingAlgorithm": "", "gaps": [{"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "{-bits[0]-bits[1]}", "maxValue": "{-bits[0]-bits[1]}", "showFractionHint": true, "variableReplacements": [], "customMarkingAlgorithm": "", "adaptiveMarkingPenalty": 0, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "useCustomName": false, "correctAnswerStyle": "plain", "scripts": {}, "marks": 1}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "{-bits[0]+bits[1]}", "maxValue": "{-bits[0]+bits[1]}", "showFractionHint": true, "variableReplacements": [], "customMarkingAlgorithm": "", "adaptiveMarkingPenalty": 0, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "useCustomName": false, "correctAnswerStyle": "plain", "scripts": {}, "marks": 1}], "marks": 0, "variableReplacements": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "customName": ""}], "advice": "

Completing the square works by noticing that

\n

\\[ (x+a)^2 = x^2 + 2ax + a^2 \\]

\n

So when we see an expression of the form $x^2 + 2ax$, we can rewrite it as $(x+a)^2-a^2$.

\n

a)

\n

Rewrite $x^2+\\var{sml}x$ as $\\simplify[basic]{ (x+{sml/2})^2 - {sml/2}^2}$.

\n

\\begin{align}
\\simplify[basic]{x^2+{sml}x+{big}} &= \\simplify[basic]{(x+{sml/2})^2-{(sml/2)}^2+{big}} \\\\
&= \\simplify[basic]{(x+{sml/2})^2+{-(sml/2)^2+big}} \\text{.}
\\end{align}

\n

b)

\n

We showed above that

\n

\\[ \\simplify[basic]{x^2+{sml}x+{big}} = 0 \\]

\n

is equivalent to

\n

\\[ \\simplify[basic]{(x+{bits[0]})^2-{bits[1]^2}} = 0 \\text{.} \\]

\n

We can then rearrange this equation to solve for $x$.

\n

\\begin{align}
\\simplify{(x+{bits[0]})^2-{(bits[1])^2} } &= 0 \\\\
(x+\\var{bits[0]})^2 &= \\var{bits[1]^2} \\\\
x+\\var{bits[0]} &= \\pm \\var{bits[1]} \\\\
x &= -\\var{bits[0]} \\pm \\var{bits[1]} \\\\[2em]

x_1 &= \\var{-bits[0]-bits[1]} \\text{,}\\\\
x_2 &= \\var{-bits[0]+bits[1]} \\text{.}
\\end{align}

", "tags": ["taxonomy"], "preamble": {"css": "", "js": ""}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["big", "sml", "bits"], "statement": "

We can rewrite quadratic equations given in the form $ax^2+bx+c$ as a square plus another term - this is called \"completing the square\".

\n

This can be useful when it isn't obvious how to fully factorise a quadratic equation.

", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Solve a quadratic equation by completing the square. The roots are not pretty!

"}, "variablesTest": {"condition": "", "maxRuns": 100}}, {"name": "Using the Quadratic Formula to Solve Equations of the Form $ax^2 +bx+c=0$", "extensions": [], "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": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}], "metadata": {"description": "

Apply the quadratic formula to find the roots of a given equation. The quadratic formula is given in the steps if the student requires it.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "ungrouped_variables": ["a1", "a2", "a3", "a4", "b1", "b2", "b3", "b4", "x1", "p1", "p2", "x2", "a", "m"], "rulesets": {}, "advice": "

The quadratic formula is 

\n

\\[x={\\frac {-b\\pm\\sqrt{b^2-4\\times a\\times c}}{2a}}\\text{.}\\]

\n

a)

\n

From the equation, we can read off values for $a$, $b$ and $c$:

\n

\\[\\begin{align}
a&=1\\text{,}\\\\
b&=\\var{a+m}\\text{,}\\\\
c&=\\var{a*m} \\text{.}
\\end{align}\\]

\n

Substituting these values into the quadratic formula,

\n

\\[x = \\frac {-\\var{a+m}\\pm\\sqrt{\\var{a+m}^2-4\\times \\var{a*m}}}{2}\\text{.}\\]

\n

Note the $\\pm$ symbol in the formula. This means there are two solutions: one using $+$, the other using $-$.

\n

The two solutions are

\n

\\[\\begin{align}
x_1&=\\var{m}\\text{,}\\\\
x_2&=\\var{a}\\text{.}
\\end{align}\\]

\n

b)

\n

Note that the right-hand side of the given equation is not zero. We need to rewrite it in the form $ax^2+bx+c=0$:

\n

\\[\\begin{align}
\\simplify{{a1}x^2+{a2}x+{a3}}&=\\var{a4}\\\\
\\simplify{{a1}x^2+{a2}x+{a3-a4}}&=0\\text{.}
\\end{align}\\]

\n

Then we can read off values for $a$, $b$ and $c$:

\n

\\[\\begin{align}
a&=\\var{a1}\\\\
b&=\\var{a2}\\\\
c&=\\var{a3-a4} \\text{.}
\\end{align}\\]

\n

We can now substitute these values into the quadratic formula:

\n

\\[x = {\\frac {-\\var{a2}\\pm\\sqrt{\\var{a2}^2-4\\times \\var{a1}\\times \\var{a3-a4}}}{2\\times\\var{a1}}}\\text{.}\\]

\n

So the two solutions are

\n

\\[\\begin{align}
x_1&=\\var{dpformat(x1,2)}\\\\
x_2&=\\var{dpformat(x2,2)}\\text{.}
\\end{align}\\]

\n

c)

\n

We first rearrange our equation into the form $ax^2+bx+c=0$:

\n

\\[\\begin{align}
\\simplify{{b1}x^2+{b2}x+{b3}}&=0=\\var{b4}x\\\\
\\simplify{{b1}x^2+{b2-b4}x+{b3}}&=0\\text{.}
\\end{align}\\]

\n

We can then read off the values for $a, b$ and $c$, which are

\n

\\[\\begin{align}
a&=\\var{b1}\\text{,}\\\\
b&=\\var{b2-b4}\\text{,}\\\\
c&=\\var{b3}\\text{.}
\\end{align}\\]

\n

Substituting these values into the quadratic formula,

\n

\\[x = {\\frac {-\\var{b2-b4}\\pm\\sqrt{\\var{b2-b4}^2-4\\times \\var{b1}\\times \\var{b3}}}{2\\times\\var{b1}}},\\]

\n

we obtain solutions

\n

\\[\\begin{align}
x_1&=\\var{dpformat(p1,2)}\\text{,}\\\\
x_2&=\\var{dpformat(p2,2)}\\text{.}
\\end{align}\\]

", "variable_groups": [{"name": "part 2", "variables": ["b", "c"]}], "statement": "

When quadratic equations can't be factorised, or if equations are difficult to factorise (perhaps if the coefficients are large), we need to use the quadratic formula to solve the equations.

\n

Use the quadratic formula to calculate values for $x$ in these equations. Input the possible values as $x_1$ and $x_2$, where $x_1<x_2$.

", "parts": [{"scripts": {}, "variableReplacements": [], "type": "gapfill", "prompt": "

$\\simplify{x^2+{a+m}x+{a*m}=0}$

\n

$x_1=$ [[0]]

\n

$x_2=$ [[1]]

", "stepsPenalty": 0, "steps": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "information", "showCorrectAnswer": true, "marks": 0, "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

An equation of the form

\n

\\[ax^2+bx+c=0\\text{,}\\]

\n

\n

can be solved using the quadratic formula

\n

\\[x={\\frac {-b\\pm\\sqrt{b^2-4\\times a\\times c}}{2a}}\\text{.}\\]

\n

"}], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "-a", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "-a", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}, {"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "-m", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "-m", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}], "showFeedbackIcon": true, "marks": 0, "showCorrectAnswer": true}, {"scripts": {}, "variableReplacements": [], "type": "gapfill", "prompt": "

\n

$\\simplify{{a1}x^2+{a2}x+{a3}={a4}}$

\n

$x_1=$ [[0]]

\n

$x_2=$ [[1]]

\n

", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "x1", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "x1", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}, {"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "x2", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "x2", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}], "showFeedbackIcon": true, "marks": 0}, {"scripts": {}, "variableReplacements": [], "type": "gapfill", "prompt": "

$\\simplify{{b1}x^2+{b2}x+{b3}={b4}x}$

\n

$x_1=$ [[0]]

\n

$x_2=$ [[1]]

", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "p1", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "p1", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}, {"allowFractions": false, "correctAnswerFraction": false, "precision": "2", "precisionPartialCredit": 0, "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "precisionType": "dp", "minValue": "p2", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "p2", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "strictPrecision": false, "showPrecisionHint": true}], "showFeedbackIcon": true, "marks": 0}], "tags": ["Quadratic formula", "quadratic formula", "solve quadratic equations", "taxonomy", "Using the quadratic formula", "using the quadratic formula"], "preamble": {"css": "", "js": ""}, "functions": {}, "variables": {"a3": {"description": "", "definition": "random(-30..4 except 0)", "group": "Ungrouped variables", "name": "a3", "templateType": "anything"}, "a": {"description": "", "definition": "random(15..20)", "group": "Ungrouped variables", "name": "a", "templateType": "anything"}, "a1": {"description": "", "definition": "random(2..9)", "group": "Ungrouped variables", "name": "a1", "templateType": "anything"}, "m": {"description": "", "definition": "random(9..a-1)", "group": "Ungrouped variables", "name": "m", "templateType": "anything"}, "b1": {"description": "", "definition": "random(2..10 except a1)", "group": "Ungrouped variables", "name": "b1", "templateType": "anything"}, "c": {"description": "", "definition": "random(-10..4 except 0)^2", "group": "part 2", "name": "c", "templateType": "anything"}, "b4": {"description": "", "definition": "random(-5..5)", "group": "Ungrouped variables", "name": "b4", "templateType": "anything"}, "p2": {"description": "", "definition": "(-(b2-b4)+((b2-b4)^2-4*b1*b3)^(1/2))/(2*b1)", "group": "Ungrouped variables", "name": "p2", "templateType": "anything"}, "b3": {"description": "", "definition": "random(-30..6 except a3)", "group": "Ungrouped variables", "name": "b3", "templateType": "anything"}, "a4": {"description": "", "definition": "random(1..15)", "group": "Ungrouped variables", "name": "a4", "templateType": "anything"}, "x1": {"description": "", "definition": "(-(a2)-((a2)^2-4*a1*(a3-a4))^(1/2))/(2*a1)", "group": "Ungrouped variables", "name": "x1", "templateType": "anything"}, "p1": {"description": "", "definition": "(-(b2-b4)-((b2-b4)^2-4*b1*b3)^(1/2))/(2*b1)", "group": "Ungrouped variables", "name": "p1", "templateType": "anything"}, "b": {"description": "", "definition": "2c^0.5+a1^2", "group": "part 2", "name": "b", "templateType": "anything"}, "b2": {"description": "", "definition": "random(20..35 except a2)", "group": "Ungrouped variables", "name": "b2", "templateType": "anything"}, "a2": {"description": "", "definition": "random(9..30 except a1)", "group": "Ungrouped variables", "name": "a2", "templateType": "anything"}, "x2": {"description": "", "definition": "(-(a2)+((a2)^2-4*a1*(a3-a4))^(1/2))/(2*a1)", "group": "Ungrouped variables", "name": "x2", "templateType": "anything"}}, "variablesTest": {"maxRuns": 100, "condition": ""}}, {"name": "Use the quadratic formula to solve an equation in terms of an unknown variable", "extensions": [], "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": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}], "variable_groups": [{"variables": ["b", "c", "n2", "b_2", "c_2", "b_3"], "name": "part 2"}], "preamble": {"css": "", "js": ""}, "type": "question", "parts": [{"marks": 0, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "gaps": [{"checkingtype": "absdiff", "type": "jme", "vsetrangepoints": 5, "vsetrange": [0, 1], "showpreview": true, "answer": "({-b_3/2-sqrt(b_3^2-4*c_2)/2})k", "scripts": {}, "showFeedbackIcon": true, "checkvariablenames": false, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "marks": 1, "checkingaccuracy": 0.001, "variableReplacements": [], "expectedvariablenames": []}, {"checkingtype": "absdiff", "type": "jme", "vsetrangepoints": 5, "vsetrange": [0, 1], "showpreview": true, "answer": "({-b_3/2+sqrt(b_3^2-4*c_2)/2})k", "scripts": {}, "showFeedbackIcon": true, "checkvariablenames": false, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "marks": 1, "checkingaccuracy": 0.001, "variableReplacements": [], "expectedvariablenames": []}], "stepsPenalty": 0, "showFeedbackIcon": true, "prompt": "

Solve the equation $\\simplify {x^2+{b_3}*k*x+{c_2}k^2=0}$. Give your answer in terms of $k$. Assuming $k$ is positive, enter the lowest root first.

\n

$x_1=$ [[0]]

\n

$x_2=$ [[1]]

", "steps": [{"variableReplacementStrategy": "originalfirst", "type": "information", "showCorrectAnswer": true, "marks": 0, "variableReplacements": [], "scripts": {}, "showFeedbackIcon": true, "prompt": "

The quadratic formula is

\n

\\[{\\frac {-b\\pm\\sqrt{b^2-4\\times a\\times c}}{2a}}\\text{.}\\]

"}]}], "advice": "

The quadratic formula is

\n

\\[{\\frac {-b\\pm\\sqrt{b^2-4\\times a\\times c}}{2a}}\\text{.}\\]

\n

We can list our values for $a, b$ and $c$.

\n

\\[\\begin{align}
a&=1\\\\
b&=\\var{b_3}k\\\\
c&=\\var{c_2}k^2
\\end{align}\\]

\n

Then by substituting them into the quadratic formula, we obtain

\n

\\[x=\\frac {-\\var{b_3}k\\pm\\sqrt{\\var{b_3}^2k^2-4\\times \\var{c_2}k^2}}{2}\\]

\n

We can then simplify this equation to

\n

\\[\\begin{align}
x&=\\frac {-\\var{b_3}k\\pm k\\sqrt{\\var{b_3}^2-\\var{4c_2}}}{2}\\\\
\\end{align}\\]
\\[\\begin{align}
&=k\\left(\\frac{-\\var{b_3}}{2}\\pm \\frac {\\sqrt{\\var{b_3}^2-\\var{4c_2}}}{2}\\right)\\\\
\\end{align}\\]
\\[\\begin{align}
&=k\\left(-\\frac{\\var{b_3}}{2} \\pm\\frac{\\sqrt{\\var{(b_3^2-4c_2)}}}{2}\\right)\\\\
\\end{align}\\]

\n

This means our possible values for $x$ in terms of $k$ are,

\n

\\begin{align}
x_1 &= \\left( \\simplify[all,!noleadingminus,!collectnumbers,!simplifyfractions]{-{b_3}/2 - {sqrt(b_3^2-4c_2)}/2} \\right) k = \\var[fractionnumbers]{-b_3/2 - sqrt(b_3^2-4*c_2)/2}k \\\\
x_2 &= \\left( \\simplify[all,!noleadingminus,!collectnumbers,!simplifyfractions]{-{b_3}/2 + {sqrt(b_3^2-4c_2)}/2} \\right) k = \\var[fractionnumbers]{-b_3/2 + sqrt(b_3^2-4*c_2)/2}k
\\end{align}

", "tags": ["Quadratic equations", "Quadratic Equations", "quadratic equations", "quadratic formula", "Quadratic formula", "solving quadratic equations", "Solving quadratic equations", "Solving quadratic equations using the quadratic formula", "taxonomy", "unknown variable", "Unknown variable"], "variables": {"b": {"templateType": "anything", "description": "", "definition": "2c^0.5+a1^2", "name": "b", "group": "part 2"}, "m": {"templateType": "anything", "description": "", "definition": "random(9..a)", "name": "m", "group": "Ungrouped variables"}, "n2": {"templateType": "anything", "description": "", "definition": "random(1..10)^2", "name": "n2", "group": "part 2"}, "b_2": {"templateType": "anything", "description": "", "definition": "random(n2^0.5..11 except n2^0.5)^2 ", "name": "b_2", "group": "part 2"}, "b1": {"templateType": "anything", "description": "", "definition": "random(1..10 except a1)", "name": "b1", "group": "Ungrouped variables"}, "p1": {"templateType": "anything", "description": "", "definition": "(-(b2-b4)-((b2-b4)^2-4*b1*b3)^(1/2))/(2*b1)", "name": "p1", "group": "Ungrouped variables"}, "a4": {"templateType": "anything", "description": "", "definition": "random(1..15)", "name": "a4", "group": "Ungrouped variables"}, "a1": {"templateType": "anything", "description": "", "definition": "random(1..9)", "name": "a1", "group": "Ungrouped variables"}, "c": {"templateType": "anything", "description": "", "definition": "random(-10..4 except 0)^2", "name": "c", "group": "part 2"}, "x1": {"templateType": "anything", "description": "", "definition": "(-(a2)-((a2)^2-4*a1*(a3-a4))^(1/2))/(2*a1)", "name": "x1", "group": "Ungrouped variables"}, "b_3": {"templateType": "anything", "description": "", "definition": "b_2^0.5", "name": "b_3", "group": "part 2"}, "c_2": {"templateType": "anything", "description": "", "definition": "(b_2-n2)/4", "name": "c_2", "group": "part 2"}, "a3": {"templateType": "anything", "description": "", "definition": "random(-30..4 except 0)", "name": "a3", "group": "Ungrouped variables"}, "p2": {"templateType": "anything", "description": "", "definition": "(-(b2-b4)+((b2-b4)^2-4*b1*b3)^(1/2))/(2*b1)", "name": "p2", "group": "Ungrouped variables"}, "b2": {"templateType": "anything", "description": "", "definition": "random(20..35 except a2)", "name": "b2", "group": "Ungrouped variables"}, "a": {"templateType": "anything", "description": "", "definition": "random(15..20)", "name": "a", "group": "Ungrouped variables"}, "a2": {"templateType": "anything", "description": "", "definition": "random(9..30 except a1)", "name": "a2", "group": "Ungrouped variables"}, "x2": {"templateType": "anything", "description": "", "definition": "(-(a2)+((a2)^2-4*a1*(a3-a4))^(1/2))/(2*a1)", "name": "x2", "group": "Ungrouped variables"}, "b4": {"templateType": "anything", "description": "", "definition": "random(-5..5)", "name": "b4", "group": "Ungrouped variables"}, "b3": {"templateType": "anything", "description": "", "definition": "random(-30..6 except a3)", "name": "b3", "group": "Ungrouped variables"}}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["a1", "a2", "a3", "a4", "b1", "b2", "b3", "b4", "x1", "p1", "p2", "x2", "a", "m"], "statement": "

The coefficients of the following equation involve the unknown value $k$. We can use the quadratic formula to find expressions for the values of $x$ in terms of $k$.

", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Factorise a quadratic expression of the form $x^2+akx+bk^2$ for $x$, in terms of $k$. $a$ and $b$ are constants.

"}, "variablesTest": {"condition": "", "maxRuns": 100}}]}], "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "showresultspage": "oncompletion", "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0, "intro": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": []}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Wan Mekwi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4058/"}], "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.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(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 )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\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_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "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 )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

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

", "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?

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

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

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": []}