// Numbas version: exam_results_page_options {"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}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Algebra: Solving quadratics by factorising", "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"]}, "extensions": [], "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}], "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}]}], "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}