// Numbas version: finer_feedback_settings {"name": "Ages problem", "extensions": ["written-number", "random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Ages problem", "tags": [], "metadata": {"description": "
Solve a problem using a linear equation.
", "licence": "All rights reserved"}, "statement": "{capitalise(written_number(n))} {pluralise(n, \"year\", \"years\")} ago, {nameB} was {written_number(p)} times older than {nameA}.
\nIn {written_number(m)} years' time, {nameC} will be {written_number(q)} times older than {nameB}.
\nToday, the sum of the ages of {nameA}, {nameB} and {nameC} is {total}.
\nCalculate the age of each person.
", "advice": "Let $\\var{xA}$ be {nameA}'s age, $\\var{xB}$ be {nameB}'s age and $\\var{xC}$ be {nameC}'s age.
\n{capitalise(written_number(n))} {pluralise(n, \"year\", \"years\")} ago, everyone was {n} {pluralise(n, \"year\", \"years\")} younger, so {nameB} was $\\var{xB}-\\var{n}$ and {nameA} was $\\var{xA}-\\var{n}$. At that time, {nameB} was {p} times older than {nameA}, i.e.
\n\\[\\var{xB}-\\var{n}=\\simplify{{p}*({xA}-{n})}\\]
\nExpand and simplify:
\n\\[\\var{xB}=\\simplify{{p}*{xA}-{(p-1)*n}}\\tag{1}\\]
\nIn {written_number(m)} years' time, everyone will be {m} {pluralise(m, \"year\", \"years\")} older, so {nameC} will be $\\var{xC}+\\var{m}$ and {nameB} will be $\\var{xB}+\\var{m}$. At that time, {nameC} will be {q} times older than {nameB}, i.e.
\n\\[\\var{xC}+\\var{m}=\\simplify{{q}*({xB}+{m})}\\]
\nExpanding and simplifying gives $\\var{xC}=\\simplify{{q}*{xB}+{(q-1)*m}}$. Now use (1) to write $\\var{xC}$ in terms of $\\var{xA}$:
\n\\[\\var{xC}=\\simplify{{q}*({p}*{xA}-{(p-1)*n})+{(q-1)*m}}=\\simplify{{q*p}*{xA}-{q*(p-1)*n-(q-1)*m}}\\tag{2}\\]
\nThe sum of their ages is {total}, i.e.
\n\\[\\var{xA}+\\var{xB}+\\var{xC}=\\var{total}\\]
\nFrom (1) and (2) above,
\n\\[\\var{xA}+\\simplify{{p}*{xA}-{(p-1)*n}}+\\simplify{{q*p}*{xA}-{q*(p-1)*n-(q-1)*m}}=\\var{total}\\]
\nwhich simplifies to
\n\\[\\simplify{{p+1+p*q}*{xA}-{n*(p-1)*(q+1)-m*(q-1)}}=\\var{total}\\]
\nSolving this gives $\\var{xA}=\\var{ageA}$. Substituting this into (1) gives $\\var{xB}=\\var{ageB}$, and substituting it into (2) gives $\\var{xC}=\\var{ageC}$.
\nTherefore {nameA} is {ageA}, {nameB} is {ageB} and {nameC} is {ageC}.
", "rulesets": {}, "extensions": ["random_person", "written-number"], "builtin_constants": {"e": false, "pi,\u03c0": true, "i": false, "j": false}, "constants": [], "variables": {"ageA": {"name": "ageA", "group": "Person A", "definition": "random(5..10)", "description": "", "templateType": "anything", "can_override": false}, "ageB": {"name": "ageB", "group": "Person B", "definition": "p*ageA-(p-1)*n", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2..6)", "description": "", "templateType": "anything", "can_override": false}, "ageC": {"name": "ageC", "group": "Person C", "definition": "p*q*ageA-q*(p-1)*n+(q-1)*m", "description": "", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything", "can_override": false}, "names": {"name": "names", "group": "Ungrouped variables", "definition": "random_people_with_different_initials(3)", "description": "", "templateType": "anything", "can_override": false}, "nameA": {"name": "nameA", "group": "Person A", "definition": "names[0]['name']", "description": "", "templateType": "anything", "can_override": false}, "nameB": {"name": "nameB", "group": "Person B", "definition": "names[1]['name']", "description": "", "templateType": "anything", "can_override": false}, "nameC": {"name": "nameC", "group": "Person C", "definition": "names[2]['name']", "description": "", "templateType": "anything", "can_override": false}, "total": {"name": "total", "group": "Ungrouped variables", "definition": "ageA+ageB+ageC", "description": "", "templateType": "anything", "can_override": false}, "xA": {"name": "xA", "group": "Person A", "definition": "expression(nameA[0])", "description": "", "templateType": "anything", "can_override": false}, "xB": {"name": "xB", "group": "Person B", "definition": "expression(nameB[0])", "description": "", "templateType": "anything", "can_override": false}, "xC": {"name": "xC", "group": "Person C", "definition": "expression(nameC[0])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["names", "n", "m", "p", "q", "total"], "variable_groups": [{"name": "Person A", "variables": ["nameA", "ageA", "xA"]}, {"name": "Person B", "variables": ["nameB", "ageB", "xB"]}, {"name": "Person C", "variables": ["nameC", "ageC", "xC"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "{nameA}: [[0]]
\n{nameB}: [[1]]
\n{nameC}: [[2]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ageA", "maxValue": "ageA", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ageB", "maxValue": "ageB", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ageC", "maxValue": "ageC", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Martin Jones", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/145/"}]}]}], "contributors": [{"name": "Martin Jones", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/145/"}]}