// Numbas version: finer_feedback_settings {"showQuestionGroupNames": true, "duration": 3600, "timing": {"timeout": {"message": "", "action": "none"}, "allowPause": true, "timedwarning": {"message": "", "action": "none"}}, "percentPass": "50", "navigation": {"showresultspage": "oncompletion", "browse": true, "preventleave": true, "onleave": {"message": "", "action": "none"}, "allowregen": true, "reverse": true, "showfrontpage": true}, "metadata": {"licence": "None specified", "description": "

Tests Algebra, Graphing Straight Lines, Probability, Statistics

"}, "feedback": {"showanswerstate": true, "allowrevealanswer": true, "showtotalmark": true, "showactualmark": true, "intro": "", "advicethreshold": 0, "feedbackmessages": [], "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 1, "name": "Glenaeon 5.1 Year 10", "questions": [{"name": "Complete a frequency table and find the measures of central tendency", "extensions": ["stats"], "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": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}], "tags": ["Frequency Table", "frequency table", "Frequency table", "taxonomy"], "metadata": {"description": "

Given a table of data, calculate the mean, mode and median, and complete a frequency table.

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

30 random students were asked about the number of siblings they have. These are their responses:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{a[0]}$$\\var{a[1]}$$\\var{a[2]}$$\\var{a[3]}$$\\var{a[4]}$$\\var{a[5]}$$\\var{a[6]}$$\\var{a[7]}$$\\var{a[8]}$$\\var{a[9]}$
$\\var{a[10]}$$\\var{a[11]}$$\\var{a[12]}$$\\var{a[13]}$$\\var{a[14]}$$\\var{a[15]}$$\\var{a[16]}$$\\var{a[17]}$$\\var{a[18]}$$\\var{a[19]}$
$\\var{a[20]}$$\\var{a[21]}$$\\var{a[22]}$$\\var{a[23]}$$\\var{a[24]}$$\\var{a[25]}$$\\var{a[26]}$$\\var{a[27]}$$\\var{a[28]}$$\\var{a[29]}$
\n

", "advice": "

a)

\n

Organising the data in a frequency table helps to make mistakes less likely when calculating statistics from our data, summarising the responses all in one place with fewer numbers.

\n

Each row of the frequency column gives the number of students with the corresponding number of siblings.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Number of siblingsFrequency
$0$$\\var{freq[0]}$
$1$$\\var{freq[1]}$
$2$$\\var{freq[2]}$
$3$$\\var{freq[3]}$
$4$$\\var{freq[4]}$
$5$$\\var{freq[5]}$
$6$$\\var{freq[6]}$
Total$30$
\n

Always remember to check whether your frequency column adds up to the total (here, it is $30$) to make sure you have not left out any responses.

\n

b)

\n

Mean

\n

The mean number of siblings is the total number of siblings, $\\sum x$, divided by the number of students in the sample, $n$.

\n

\\begin{align}  
\\sum x &= 0 \\times \\var{freq[0]} + 1 \\times \\var{freq[1]} + 2 \\times \\var{freq[2]} + 3 \\times \\var{freq[3]} + 4 \\times \\var{freq[4]} + 5 \\times \\var{freq[5]} + 6 \\times \\var{freq[6]}
\\\\
&= 0 + \\var{1*freq[1]} + \\var{2*freq[2]} + \\var{3*freq[3]} + \\var{4*freq[4]} + \\var{5*freq[5]} + \\var{6*freq[6]} \\\\&= \\var{sum(a)} \\text{.}
\\end{align}

\n

The total number of students $n$ is $30$.

\n

Therefore the mean is

\n

\\begin{align}
\\bar{x} &= \\frac{\\sum x}{n} \\\\
&= \\frac{\\var{sum(a)}}{30} \\\\
&= \\var{mean} \\text{.}
\\end{align}

\n

Rounding the answer to 2 decimal places, we get $\\var{precround(mean, 2)}$.

\n

Mode

\n

The mode is the value with the highest frequency. Here, the mode is $\\var{mode}$ siblings, with frequency $\\var{freq[mode]}$.

\n

Median

\n

The median is the \"middle\" value in the sample, when arranged in numerical order.

\n

Since $n = 30$, we have two middle values in this data (15th and 16th place). We can count from the top of the table until we locate rows where these middle values lie, as the numbers in the table are already sorted by order.

\n

Here, both $15$th and $16$th value lie in the row $\\var{asa[14]}$.Here, the $15$th value lies in the row $\\var{asa[14]}$ while the $16$th value lies in the row $\\var{asa[15]}$.

\n

As $15$th value $= 16$th value $= \\var{asa[14]}$, the median is $\\var{asa[14]}$.As $15$th value $= \\var{asa[14]}$ and $16$th value $= \\var{asa[15]}$, we need to find their mean.

\n

\\[ \\displaystyle \\begin{align} \\frac{\\var{asa[14]} + \\var{asa[15]}}{2} &=  \\frac{\\var{asa[14] + asa[15]}}{2} \\\\&= \\var{median} \\text{.} \\end{align}\\]

\n

This is the median for this data.

\n

", "rulesets": {}, "variables": {"m": {"name": "m", "group": "Final data", "definition": "mode(a)", "description": "", "templateType": "anything"}, "a2": {"name": "a2", "group": "Ungrouped variables", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "description": "", "templateType": "anything"}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "shuffle(repeat(random(0..1), 13) + 0 + 2 + 2 + repeat(random(2..3), 10) + repeat(random(4..5), 3) + random(0..6))", "description": "", "templateType": "anything"}, "modea1": {"name": "modea1", "group": "Ungrouped variables", "definition": "mode(a1)", "description": "", "templateType": "anything"}, "mode": {"name": "mode", "group": "Final data", "definition": "m[0]", "description": "", "templateType": "anything"}, "mean": {"name": "mean", "group": "Final data", "definition": "mean(a)", "description": "", "templateType": "anything"}, "modea2": {"name": "modea2", "group": "Ungrouped variables", "definition": "mode(a2)", "description": "", "templateType": "anything"}, "a3": {"name": "a3", "group": "Ungrouped variables", "definition": "shuffle(repeat(0, 7) + repeat(1, 10) + repeat(2, 5) + repeat(3, 4) + repeat(4, 2) + repeat(5,1) + repeat(6,1))", "description": "", "templateType": "anything"}, "freq": {"name": "freq", "group": "Final data", "definition": "map(\nlen(filter(x=j,x,a)),\nj, 0..6)", "description": "", "templateType": "anything"}, "median": {"name": "median", "group": "Final data", "definition": "median(a)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Final data", "definition": "if(len(modea1) = 1, a1, if(len(modea2) = 1, a2, a3))", "description": "", "templateType": "anything"}, "modea3": {"name": "modea3", "group": "Ungrouped variables", "definition": "mode(a3)", "description": "", "templateType": "anything"}, "asa": {"name": "asa", "group": "Final data", "definition": "sort(a)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": "1000"}, "ungrouped_variables": ["a1", "modea1", "a2", "modea2", "a3", "modea3"], "variable_groups": [{"name": "Final data", "variables": ["a", "mean", "median", "m", "mode", "freq", "asa"]}], "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": "

Complete the following frequency table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Number of siblingsFrequency
$0$[[0]]
$1$[[1]]
$2$[[2]]
$3$[[3]]
$4$[[4]]
$5$[[5]]
$6$[[6]]
Total$30$
\n

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "0 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[0]", "maxValue": "freq[0]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "1 sibling", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[1]", "maxValue": "freq[1]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "2 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[2]", "maxValue": "freq[2]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "3 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[3]", "maxValue": "freq[3]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "4 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[4]", "maxValue": "freq[4]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "5 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[5]", "maxValue": "freq[5]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "6 siblings", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "freq[6]", "maxValue": "freq[6]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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": "

Find the mean, mode and median for this data.

\n

Mean = [[0]]

\n

Mode =  [[1]]

\n

Median =  [[2]]

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Mean", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "mean", "maxValue": "mean", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Mode", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "mode", "maxValue": "mode", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Median", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "median", "maxValue": "median", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Drag points to given Cartesian coordinates", "extensions": ["jsxgraph"], "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": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}], "type": "question", "tags": ["cartesian coordinates", "drag points on a graph", "graphs", "taxonomy"], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"c2": {"description": "", "name": "c2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..-1)"}, "a2": {"description": "", "name": "a2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..-1)"}, "f1": {"description": "", "name": "f1", "group": "Ungrouped variables", "templateType": "anything", "definition": "0"}, "c1": {"description": "", "name": "c1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..10)"}, "f2": {"description": "", "name": "f2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..10 except 0)"}, "d1": {"description": "", "name": "d1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..-1)"}, "e1": {"description": "", "name": "e1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..10 except 0)"}, "a1": {"description": "", "name": "a1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..-1)"}, "b1": {"description": "", "name": "b1", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)"}, "d2": {"description": "", "name": "d2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..10)"}, "e2": {"description": "", "name": "e2", "group": "Ungrouped variables", "templateType": "anything", "definition": "0"}, "x": {"description": "", "name": "x", "group": "Ungrouped variables", "templateType": "anything", "definition": "1"}, "y": {"description": "", "name": "y", "group": "Ungrouped variables", "templateType": "anything", "definition": "2"}, "b2": {"description": "", "name": "b2", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..10)"}, "e3": {"description": "", "name": "e3", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(-10..10 except 0)"}}, "statement": "

Move the points to the required coordinates on the graph.

", "variable_groups": [], "parts": [{"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.a.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});\n", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{a1}", "showFeedbackIcon": true, "minValue": "{a1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{a2}", "showFeedbackIcon": true, "minValue": "{a2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

{dragpoints()}

\n

Move the points as follows:

\n

A to $(\\var{a1},\\var{a2})$.

", "type": "gapfill"}, {"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.b.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});\n", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{b1}", "showFeedbackIcon": true, "minValue": "{b1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{b2}", "showFeedbackIcon": true, "minValue": "{b2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

B to $(\\var{b1},\\var{b2})$.

\n

", "type": "gapfill"}, {"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.c.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});\n", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{c1}", "showFeedbackIcon": true, "minValue": "{c1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{c2}", "showFeedbackIcon": true, "minValue": "{c2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

C to $(\\var{c1},\\var{c2})$.

\n

", "type": "gapfill"}, {"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.d.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});\n", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{d1}", "showFeedbackIcon": true, "minValue": "{d1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{d2}", "showFeedbackIcon": true, "minValue": "{d2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

D to $(\\var{d1},\\var{d2})$.

\n

", "type": "gapfill"}, {"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.e.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{e1}", "showFeedbackIcon": true, "minValue": "{e1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{e2}", "showFeedbackIcon": true, "minValue": "{e2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

E to $(\\var{e1},\\var{e2})$.

", "type": "gapfill"}, {"scripts": {"mark": {"script": "console.log(this.question.points);\nthis.question.points.f.setAttribute({fillColor: this.credit==1 ? 'green' : 'red'});", "order": "after"}}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{f1}", "showFeedbackIcon": true, "minValue": "{f1}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "{f2}", "showFeedbackIcon": true, "minValue": "{f2}", "correctAnswerStyle": "plain", "allowFractions": false, "mustBeReduced": false, "scripts": {}, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

F to $(\\var{f1},\\var{f2})$.

\n

", "type": "gapfill"}], "ungrouped_variables": ["x", "y", "a1", "a2", "b1", "b2", "c1", "c2", "d1", "d2", "e1", "e2", "e3", "f1", "f2"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Drag points on a graph to the given Cartesian coordinates. There are points in each of the four quadrants and on each axis.

"}, "preamble": {"css": "", "js": ""}, "functions": {"correctPoints": {"parameters": [], "type": "html", "language": "javascript", "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-11,11,11,-11],grid: true});\nvar board = div.board;\nquestion.board = board;\n\nvar a1 = Numbas.jme.unwrapValue(scope.variables.a1);\nvar a2 = Numbas.jme.unwrapValue(scope.variables.a2);\nvar b1 = Numbas.jme.unwrapValue(scope.variables.b1);\nvar b2 = Numbas.jme.unwrapValue(scope.variables.b2);\nvar c1 = Numbas.jme.unwrapValue(scope.variables.c1);\nvar c2 = Numbas.jme.unwrapValue(scope.variables.c2);\nvar d1 = Numbas.jme.unwrapValue(scope.variables.d1);\nvar d2 = Numbas.jme.unwrapValue(scope.variables.d2);\nvar e1 = Numbas.jme.unwrapValue(scope.variables.e1);\nvar e2 = Numbas.jme.unwrapValue(scope.variables.e2);\nvar f1 = Numbas.jme.unwrapValue(scope.variables.f1);\nvar f2 = Numbas.jme.unwrapValue(scope.variables.f2);\n\n\nvar a = board.create('point',[a1,a2],{name: 'A', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\nvar b = board.create('point',[b1,b2],{name: 'B', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\nvar c = board.create('point',[c1,c2],{name: 'C', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\nvar d = board.create('point',[d1,d2],{name: 'D', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\nvar e = board.create('point',[e1,e2],{name: 'E', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\nvar f = board.create('point',[f1,f2],{name: 'F', size: 7, fillColor: 'limegreen' , strokeColor: 'yellow' , highlightFillColor: 'green', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: true});\n\n/*\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n var x = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\n var y = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\n if(!(isNaN(x) || isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x,y],100);\n }\n });\n});\n*/\n\nreturn div;"}, "dragpoints": {"parameters": [], "type": "html", "language": "javascript", "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-11,11,11,-11],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n//var x = Numbas.jme.unwrapValue(scope.variables.x);\n//var y = Numbas.jme.unwrapValue(scope.variables.y);\n\nvar a = board.create('point',[10,10],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: false});\nvar b = board.create('point',[10,9],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',snapToGrid: true, showInfobox: false});\nvar c = board.create('point',[10,8],{name: 'C', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',snapToGrid: true, showInfobox: false});\nvar d = board.create('point',[10,7],{name: 'D', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',snapToGrid: true, showInfobox: false});\nvar e = board.create('point',[10,6],{name: 'E', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',snapToGrid: true, showInfobox: false});\nvar f = board.create('point',[10,5],{name: 'F', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',snapToGrid: true, showInfobox: false});\n\nquestion.points = {\n a:a,b:b,c:c,d:d,e:e,f:f\n}\n\na.on('drag',function(){\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a.X());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(a.Y());\n});\nb.on('drag',function(){\n Numbas.exam.currentQuestion.parts[1].gaps[0].display.studentAnswer(b.X());\n Numbas.exam.currentQuestion.parts[1].gaps[1].display.studentAnswer(b.Y());\n});\nc.on('drag',function(){\n Numbas.exam.currentQuestion.parts[2].gaps[0].display.studentAnswer(c.X());\n Numbas.exam.currentQuestion.parts[2].gaps[1].display.studentAnswer(c.Y());\n});\nd.on('drag',function(){\n Numbas.exam.currentQuestion.parts[3].gaps[0].display.studentAnswer(d.X());\n Numbas.exam.currentQuestion.parts[3].gaps[1].display.studentAnswer(d.Y());\n});\ne.on('drag',function(){\n Numbas.exam.currentQuestion.parts[4].gaps[0].display.studentAnswer(e.X());\n Numbas.exam.currentQuestion.parts[4].gaps[1].display.studentAnswer(e.Y());\n});\nf.on('drag',function(){\n Numbas.exam.currentQuestion.parts[5].gaps[0].display.studentAnswer(f.X());\n Numbas.exam.currentQuestion.parts[5].gaps[1].display.studentAnswer(f.Y());\n});\n\n/*\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n var x = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\n var y = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\n if(!(isNaN(x) || isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x,y],100);\n }\n });\n});\n*/\n\nreturn div;\n\n"}}, "advice": "

Coordinates are given as $(x\\text{-coordinate},y\\text{-coordinate})$. So, for example $(2,5)$ has $x$-coordinate $= 2$ and $y$-coordinate$= 5$.

\n

Plot the first coordinate ($x$-coordinate) against the horizontal axis and then plot the second coordinate ($y$-coordinate) against the vertical axis.

\n

{correctPoints()}

"}, {"name": "Expand brackets and collect like terms", "extensions": ["stats"], "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": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Aiden McCall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1592/"}], "variable_groups": [{"variables": ["a1", "b1", "c1"], "name": "B group"}, {"variables": ["a", "b", "c", "d", "f", "g", "h", "j"], "name": "Part a"}], "variables": {"c": {"templateType": "anything", "description": "", "definition": "repeat(random(2..10),5)", "name": "c", "group": "Part a"}, "c1": {"templateType": "anything", "description": "", "definition": "random(2..5)*2", "name": "c1", "group": "B group"}, "b1": {"templateType": "anything", "description": "", "definition": "random(2..10 except a1)", "name": "b1", "group": "B group"}, "d": {"templateType": "anything", "description": "", "definition": "repeat(random(2..33),6)", "name": "d", "group": "Part a"}, "f": {"templateType": "anything", "description": "", "definition": "repeat(random(2..20),7)", "name": "f", "group": "Part a"}, "j": {"templateType": "anything", "description": "", "definition": "repeat(random(2..20),9)", "name": "j", "group": "Part a"}, "h": {"templateType": "anything", "description": "", "definition": "repeat(random(2..20),7)", "name": "h", "group": "Part a"}, "a1": {"templateType": "anything", "description": "", "definition": "random(5..10)", "name": "a1", "group": "B group"}, "a": {"templateType": "anything", "description": "

random variables for part 1

", "definition": "repeat(random(5..15),5)", "name": "a", "group": "Part a"}, "b": {"templateType": "anything", "description": "", "definition": "repeat(random(2..10),5)", "name": "b", "group": "Part a"}, "g": {"templateType": "anything", "description": "", "definition": "repeat(random(2..15),7)", "name": "g", "group": "Part a"}}, "type": "question", "parts": [{"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*x", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must collect like terms to fully simplify.

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "x"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({c[1]}+{c[0]}+{c[2]})x", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{c[0]}x+\\var{c[1]}x+\\var{c[2]}x=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*x^2 + $n*x + $n", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "vsetRange": [0, 1], "variableReplacements": [], "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "x"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({a[1]}+{a[2]})x^2+({a[3]}+{a[4]})x+{a[0]}", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "


$\\var{a[1]}x^2+\\var{a[2]}x^2+\\var{a[3]}x+\\var{a[4]}x +\\var{a[0]}=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*y^5", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify.

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "y"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({b[1]}+{b[2]}+{b[3]}+{b[4]}+{b[0]})y^5", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{b[0]}y^5+\\var{b[1]}y^5+\\var{b[2]}y^5+\\var{b[4]}y^5+\\var{b[3]}y^5=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": true, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*a*b*c + $n*a*b + $n*a + $n*b + $n*c", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify. 

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "a"}, {"value": "", "name": "b"}, {"value": "", "name": "c"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "{d[0]}a*b+{d[1]+d[5]}*a*b*c+{d[2]}a+{d[3]}b+{d[4]}c", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{d[0]}ab+\\var{d[1]}abc+\\var{d[2]}a+\\var{d[3]}b+\\var{d[4]}c+\\var{d[5]}abc=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": true, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*a^2*b + $n*a*b^2 + $n*a*b", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify. 

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "a"}, {"value": "", "name": "b"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({f[0]}+{f[3]})a^2b+({f[1]}+{f[4]})a*b^2+({f[2]})a*b", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{f[0]}a^2b+\\var{f[1]}ab^2+\\var{f[2]}ab+\\var{f[3]}a^2b+\\var{f[4]}ab^2=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*x+$n*y", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify. *'s are not needed to indicate multiplication here.

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "x"}, {"value": "", "name": "y"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({g[0]}{g[1]}+{g[4]})x+({g[0]}{g[2]}+{g[5]})y", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{g[0]}(\\var{g[1]}x+\\var{g[2]}y)+\\var{g[4]}x+\\var{g[5]}y=$ [[0]]

\n

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": true, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*x*z + $n*x^2 + $n*x + $n*z + $n*z^2", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "musthave": {"partialCredit": 0, "message": "", "strings": ["*"], "showStrings": false}, "variableReplacementStrategy": "originalfirst", "failureRate": 1, "notallowed": {"partialCredit": 0, "message": "

9You should not have brackets in your answer.

", "strings": ["(", ")"], "showStrings": true}, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify. 

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "x"}, {"value": "", "name": "z"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({h[0]}{h[1]}+{h[4]})x^2+({h[0]}{h[2]})z*x+{h[3]}x+{h[5]}z^2+{h[6]}z", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{h[0]}x(\\var{h[1]}x+\\var{h[2]}z)+\\var{h[3]}x+\\var{h[6]}z+\\var{h[4]}x^2+\\var{h[5]}z^2=$ [[0]]

", "unitTests": [], "customName": ""}, {"extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "useCustomName": false, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "checkVariableNames": true, "useCustomName": false, "mustmatchpattern": {"nameToCompare": "", "partialCredit": 0, "pattern": "$n*x + `+-$n*y", "message": "You haven't simplified: you still have two or more like terms that should be collected together."}, "unitTests": [], "answerSimplification": "all", "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "failureRate": 1, "variableReplacements": [], "vsetRange": [0, 1], "maxlength": {"partialCredit": 0, "message": "

You must condense your answer to fully simplify. 

", "length": "0"}, "customMarkingAlgorithm": "", "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "x"}, {"value": "", "name": "y"}], "customName": "", "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "answer": "({j[0]}{j[1]}+{j[4]}{j[3]}+{j[6]}{j[7]})x-({j[0]}{j[2]}+{j[5]}{j[3]}+{j[6]}{j[8]})y", "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "prompt": "

$\\var{j[0]}(\\var{j[1]}x-\\var{j[2]}y)+\\var{j[3]}(\\var{j[4]}x-\\var{j[5]}y)+\\var{j[6]}(\\var{j[7]}x-\\var{j[8]}y)=$ [[0]]

", "unitTests": [], "customName": ""}], "advice": "

When simplifying expressions, only terms of the same type or like terms can be added together.

\n

Algebraic symbols or letters can be added together provided that they are raised to the same power. For example, we can add $x^2+x^2=2x^2$, but we cannot collect both $x^2$ and $x$ into one term.

\n

a)

\n

\\[ 
\\begin{align}
\\var{c[0]}x+\\var{c[1]}x+\\var{c[2]}x&=(\\var{c[0]}+\\var{c[1]}+\\var{c[2]})x\\\\
&=\\simplify{({c[0]}+{c[1]}+{c[2]})}x
\\end{align}
\\]

\n

b)

\n

\\[ 
\\begin{align}
\\var{a[1]}x^2+\\var{a[2]}x^2+\\var{a[3]}x+\\var{a[4]}x +\\var{a[0]}&=(\\var{a[1]}+\\var{a[2]})x^2+(\\var{a[3]}+\\var{a[4]})x +\\var{a[0]}\\\\
&=\\simplify{({a[1]}+{a[2]})}x^2+\\simplify{({a[3]}+{a[4]})}x+\\var{a[0]}
\\end{align}
\\]

\n

c)

\n

\\[ 
\\begin{align}
\\var{b[0]}y^5+\\var{b[1]}y^5+\\var{b[2]}y^5+\\var{b[4]}y^5+\\var{b[3]}y^5&=(\\var{b[0]}+\\var{b[1]}+\\var{b[2]}+\\var{b[4]}+\\var{b[3]})y^5\\\\
&=\\simplify{({b[1]}+{b[2]}+{b[3]}+{b[4]}+{b[0]})}y^5
\\end{align}
\\]

\n

d)

\n

\\[ 
\\begin{align}
\\var{d[0]}ab+\\var{d[1]}abc+\\var{d[2]}a+\\var{d[3]}b+\\var{d[4]}c+\\var{d[5]}abc
&=(\\var{d[1]}+\\var{d[5]})abc+\\var{d[0]}ab+\\var{d[2]}a+\\var{d[3]}b+\\var{d[4]}c\\\\
&=\\simplify{{d[1]}+{d[5]}}abc+\\var{d[0]}ab+\\var{d[2]}a+\\var{d[3]}b+\\var{d[4]}c
\\end{align}
\\]

\n

e)

\n

\\[ 
\\begin{align}
\\var{f[0]}a^2b+\\var{f[1]}ab^2+\\var{f[2]}ab+\\var{f[3]}a^2b+\\var{f[4]}ab^2
&=(\\var{f[0]}+\\var{f[3]})a^2b+(\\var{f[1]}+\\var{f[4]})ab^2+\\var{f[2]}ab\\\\
&=\\simplify{{f[0]}+{f[3]}}a^2b+\\simplify{{f[1]}+{f[4]}}ab^2+\\var{f[2]}ab
\\end{align}
\\]

\n

f)

\n

\\[
\\begin{align}
\\var{g[0]}(\\var{g[1]}x+\\var{g[2]}y)+\\var{g[4]}x+\\var{g[5]}y
&=(\\var{g[0]}\\times \\var{g[1]}+\\var{g[4]})x+(\\var{g[0]} \\times\\var{g[2]}+\\var{g[5]})y\\\\
&=(\\simplify{{g[0]}*{g[1]}}+\\var{g[4]})x+(\\simplify{{g[0]}*{g[2]}}+\\var{g[5]})y\\\\
&=\\simplify{{g[0]}*{g[1]}+{g[4]}}x+\\simplify{{g[0]}*{g[2]}+{g[5]}}y
\\end{align}
\\]

\n

g)

\n

\\[ 
\\begin{align}
\\var{h[0]}x(\\var{h[1]}x+\\var{h[2]}z)+\\var{h[3]}x+\\var{h[6]}z+\\var{h[4]}x^2+\\var{h[5]}z^2
&=(\\simplify[]{{h[0]}{h[1]}}+\\var{h[4]})x^2+(\\simplify[]{{h[0]}{h[2]}})zx+\\var{h[3]}x+\\var{h[5]}z^2+\\var{h[6]}z\\\\
&=(\\simplify{{h[0]}{h[1]}}+\\var{h[4]})x^2+(\\simplify[]{{h[0]}{h[2]}})zx+\\var{h[3]}x+\\var{h[5]}z^2+\\var{h[6]}z\\\\
&=\\simplify{{h[0]}*{h[1]}+{h[4]}}x^2+\\simplify{{h[0]}*{h[2]}}zx+\\simplify{{h[3]}x+{h[5]}}z^2+\\var{h[6]}z
\\end{align}
\\]

\n

h)

\n

\\[ 
\\begin{align}
\\var{j[0]}(\\var{j[1]}x-\\var{j[2]}y)+\\var{j[3]}(\\var{j[4]}x-\\var{j[5]}y)+\\var{j[6]}(\\var{j[7]}x-\\var{j[8]}y)
&= (\\simplify[]{{j[0]}{j[1]}}+\\simplify[]{{j[3]}{j[4]}}+\\simplify[]{{j[6]}{j[7]}})x-(\\simplify[]{{j[0]}{j[2]}}+\\simplify[]{{j[3]}{j[5]}}+\\simplify[]{{j[6]}{j[8]}})y\\\\
&= (\\simplify{{j[0]}{j[1]}}+\\simplify{{j[3]}{j[4]}}+\\simplify{{j[6]}{j[7]}})x-(\\simplify{{j[0]}{j[2]}}+\\simplify{{j[3]}{j[5]}}+\\simplify{{j[6]}{j[8]}})y\\\\
&= \\simplify{({j[0]}*{j[1]}+{j[4]*j[3]}+{j[6]}*{j[7]})x}-\\simplify{({j[0]}*{j[2]}+{j[5]}{j[3]}+{j[6]}*{j[8]})y}
\\end{align}
\\]

\n

", "tags": ["collecting terms", "expanding brackets", "simplifying algebraic expressions", "simplifying expressions", "taxonomy"], "preamble": {"js": "", "css": ""}, "rulesets": {}, "functions": {}, "ungrouped_variables": [], "statement": "

For each expression below, collect like terms and expand brackets.

\n

The * symbol is required between algebraic symbols, e.g. $5ab^2$ should be written 5*a*b^2.

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

Eight expressions, of increasing complexity. The student must simplify them by expanding brackets and collecting like terms.

"}, "variablesTest": {"condition": "", "maxRuns": 100}}, {"name": "Find the equation of a line through two points - negative gradient", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Aiden McCall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1592/"}], "variable_groups": [], "rulesets": {}, "functions": {"correctPoints": {"parameters": [], "language": "javascript", "type": "html", "definition": "//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[math.min(xa-4,-2),math.max(ya+4,2),math.max(xb+4,2),math.min(yb-4,-2)],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n\nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-22,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\n\n\nquestion.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\n//define ans as this \ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;"}, "plotPoints": {"parameters": [], "language": "javascript", "type": "html", "definition": "\n//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[math.min(xa-4,-2),math.max(ya+4,2),math.max(xb+4,2),math.min(yb-4,-2)],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n var ans;\n var nscope = new Numbas.jme.Scope([scope,{variables:{x:new Numbas.jme.types.TNum(0)}}]);\n//this is the beating heart of whatever plots the function,\n//I've changed this from being curve to functiongraph\n var line = board.create('functiongraph',[function(x){\nif(ans) {\n try {\nnscope.variables.x.value = x;\n var val = Numbas.jme.evaluate(ans,nscope).value;\n return val;\n }\n catch(e) {\nreturn 13;\n }\n}\nelse\n return 13;\n },-12,12]\n , {strokeColor:\"blue\",strokeWidth: 4} );\n \nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-22,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: false, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\nquestion.lines = {\n l:line, c:correct_line\n}\n\n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\n\n//define ans as this \ntry {\n ans = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n ans = null;\n}\nline.updateCurve();\ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;"}}, "ungrouped_variables": ["xa", "xb", "ya", "yb", "m", "c", "twos", "twos2"], "metadata": {"description": "

Use two points on a line graph to calculate the gradient and $y$-intercept and hence the equation of the straight line running through both points.

\n

The answer box for the third part plots the function which allows the student to check their answer against the graph before submitting.

\n

This particular example has a negative gradient.

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

a)

\n

We find the equation of a straight line passing through two points by finding the gradient and the $y$-intercept of the line.
We can find the gradient ($m$) using the points $A$ and $B$, $(x_1,y_1)=(\\var{xa},\\var{ya})$ and $(x_2,y_2)=(\\var{xb},\\var{yb})$ respectively.

\n

The definition of gradient is the ratio of vertical change ($y_2-y_1$) to horizontal change ($x_2-x_1$):

\n

\\[
\\begin{align}
m &= \\frac{y_2-y_1}{x_2-x_1} \\\\ 
&= \\frac{\\simplify[!collectNumbers]{{yb}-{ya}}}{\\simplify[!collectNumbers]{{xb}-{xa}}} \\\\ 
&= \\frac{\\simplify{{yb}-{ya}}}{\\simplify{{xb}-{xa}}} \\\\ 
&= \\simplify[simplifyFractions,unitDenominator]{({yb-ya})/({xb-xa})}\\text{.}
\\end{align}
\\]

\n

b)

\n

Rearranging the equation $y=mx+c$ and substituting either of the points gives two equations for the $y$-intercept $c$:

\n

\\[c = y_1-mx_1 \\quad \\mathrm{or} \\quad c = y_2-mx_2 \\,\\text{,} \\]

\n

Let's use point $B$:

\n

\\[
\\begin{align}
c &= y_2-mx_2 \\\\
&= \\var{ya}-(\\var{m}\\times\\var{xa}) \\\\
&= \\simplify{{ya-m*xa}}\\text{.}
\\end{align}
\\]

\n

We then check this against point $A$:

\n

\\[
\\begin{align}
y_1 &= mx_1 + c \\\\
&= \\simplify[fractionNumbers]{{m}{xb}+{c}} \\\\
&= \\simplify{{m}*{xb}+{c}}\\text{.}
\\end{align}
\\]

\n

c)

\n

Substituting our values for $m$ and $c$ into the equation for a straight line, $y=mx+c$, gives

\n

\\[y=\\simplify[all,!noLeadingMinus]{{m} x+ {c}}\\text{.}\\]

\n

This is plotted below:

\n

{correctPoints()}

", "statement": "

In this question we will identify the equation of the straight line passing through the points  $A=(\\var{xa},\\var{ya})$ and  $B=(\\var{xb},\\var{yb})$, in the form $y = mx + c$.

\n

{plotPoints()}

", "preamble": {"js": "", "css": ""}, "tags": ["gradient", "graphs", "line equation", "negative gradient", "Straight Line", "straight line", "taxonomy", "y-intercept"], "parts": [{"variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "variableReplacements": [], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "prompt": "

Calculate the gradient, $m$, of the line between these two points.

\n

 $ m=$ [[0]]

\n

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

Use this gradient and the points to calculate the $y$-intercept, $c$.

\n

$c=$ [[0]]

", "customName": "", "gaps": [{"extendBaseMarkingAlgorithm": true, "useCustomName": false, "correctAnswerStyle": "plain", "maxValue": "c", "customName": "", "showFractionHint": true, "variableReplacements": [], "unitTests": [], "customMarkingAlgorithm": "", "correctAnswerFraction": false, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "marks": 1, "allowFractions": false, "minValue": "c", "mustBeReduced": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "notationStyles": ["plain", "en", "si-en"], "scripts": {}}], "useCustomName": false, "adaptiveMarkingPenalty": 0, "unitTests": [], "showFeedbackIcon": true, "customMarkingAlgorithm": "", "marks": 0, "showCorrectAnswer": true}, {"variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {"mark": {"script": "console.log(this.question.lines.c)\nthis.question.lines.l.setAttribute({strokeColor: this.credit==1 ? 'green' : 'red'});\nthis.question.lines.c.setAttribute({visible: this.credit==1 ? false : true});\n", "order": "after"}}, "variableReplacements": [], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "prompt": "

Using your values for $m$ and $c$, write down the equation of the straight line which passes through the two points A and B, in the form $y = mx +c$ 

\n

$\\displaystyle y=$ [[0]]

\n

Use the graph to plot your answer and check that it goes through these points.

", "customName": "", "gaps": [{"answer": "{m}*x+{c}", "failureRate": 1, "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "valuegenerators": [{"name": "x", "value": ""}], "notallowed": {"message": "

You must input your answer in the form y = mx +c where m and c are numbers.

", "showStrings": false, "partialCredit": 0, "strings": ["c", "m"]}, "checkingType": "absdiff", "unitTests": [], "customName": "", "variableReplacements": [], "vsetRange": [0, 1], "checkVariableNames": true, "customMarkingAlgorithm": "", "variableReplacementStrategy": "alwaysreplace", "type": "jme", "showPreview": true, "vsetRangePoints": 5, "useCustomName": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "marks": 1, "adaptiveMarkingPenalty": 0}], "useCustomName": false, "adaptiveMarkingPenalty": 0, "unitTests": [], "showFeedbackIcon": true, "customMarkingAlgorithm": "", "marks": 0, "showCorrectAnswer": true}], "variables": {"c": {"name": "c", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "ya-m*xa"}, "yb": {"name": "yb", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "ya-twos2"}, "twos2": {"name": "twos2", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4 except 3)"}, "m": {"name": "m", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "(ya-yb)/(xa-xb)"}, "xb": {"name": "xb", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "xa+twos"}, "twos": {"name": "twos", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4 except 3 )"}, "ya": {"name": "ya", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..5)"}, "xa": {"name": "xa", "description": "", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(-5..2 except[0,-2,-4])"}}, "variablesTest": {"maxRuns": 100, "condition": "\n"}, "type": "question"}, {"name": "Find the equation of a line through two points - positive gradient", "extensions": ["jsxgraph"], "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": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Aiden McCall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1592/"}], "statement": "

In this question we will identify the equation of the straight line passing through points  $A=(\\var{xa},\\var{ya})$ and  $B=(\\var{xb},\\var{yb})$ in the form $y = mx + c$.

\n

{plotPoints()}

", "variables": {"m": {"name": "m", "description": "", "definition": "(ya-yb)/(xa-xb)", "templateType": "anything", "group": "Ungrouped variables"}, "yb": {"name": "yb", "description": "", "definition": "ya+random([2,4])", "templateType": "anything", "group": "Ungrouped variables"}, "xa": {"name": "xa", "description": "", "definition": "random(-4..-1)", "templateType": "anything", "group": "Ungrouped variables"}, "ya": {"name": "ya", "description": "", "definition": "random(-4..2)", "templateType": "anything", "group": "Ungrouped variables"}, "xb": {"name": "xb", "description": "", "definition": "xa+random([2,4] except -xa)", "templateType": "anything", "group": "Ungrouped variables"}, "c": {"name": "c", "description": "", "definition": "ya-m*xa", "templateType": "anything", "group": "Ungrouped variables"}}, "metadata": {"description": "

Use two points on a line graph to calculate the gradient and $y$-intercept and hence the equation of the straight line running through both points.

\n

The answer box for the third part plots the function which allows the student to check their answer against the graph before submitting.

\n

This particular example has a positive gradient.

", "licence": "Creative Commons Attribution 4.0 International"}, "tags": ["gradient", "graphs", "line equation", "Straight Line", "straight line", "taxonomy", "y-intercept"], "variablesTest": {"maxRuns": 100, "condition": "\n"}, "variable_groups": [], "ungrouped_variables": ["xa", "xb", "ya", "yb", "m", "c"], "advice": "

We find the equation of a straight line passing through two points by finding the gradient and the $y$-intercept of the line.

\n

a)

\n

We can find the gradient ($m$) using the points $A = (x_1,y_1)=(\\var{xa},\\var{ya})$ and $B = (x_2,y_2)=(\\var{xb},\\var{yb})$.

\n

As the definition of gradient is the ratio of vertical change ($y_2-y_1$) to horizontal change ($x_2-x_1$).
The equation for gradient is,

\n

\\begin{align}
m &= \\frac{y_2-y_1}{x_2-x_1} \\\\[0.5em]
&= \\frac{\\simplify[!collectNumbers]{{yb}-{ya}}}{\\simplify[!collectNumbers]{{xb}-{xa}}} \\\\[0.5em]
&= \\frac{\\simplify[]{{yb}-{ya}}}{\\simplify{{xb}-{xa}}} \\\\[0.5em]
&= \\simplify[simplifyFractions,unitDenominator]{({yb-ya})/({xb-xa})}\\text{.}
\\end{align}

\n

b)

\n

Rearranging the equation $y=mx+c$ and substituting either of the points gives

\n

\\[c = y_1-mx_1 \\quad \\mathrm{or} \\quad c = y_2-mx_2 \\,\\text{.} \\]

\n

We can then also use this equation with the other point's coordinates to check our answer.

\n

Let's use point $A$ first:

\n

\\[
\\begin{align}
c &= y_1-mx_1 \\\\
&= \\var{ya}-\\var[fractionnumbers]{m}\\times\\var{xa} \\\\
& = \\simplify[fractionnumbers]{{ya-m*xa}}\\text{.}
\\end{align}
\\]

\n

We then check this against point $B$:

\n

\\[
\\begin{align}
y_2 &= mx_2 + c \\\\[0.5em]
&= \\simplify[fractionNumbers]{{m}{xb}+{c}} \\\\[0.5em]
&= \\var[fractionnumbers]{m*xb+c}\\text{.}
\\end{align}
\\]

\n

c)

\n

We can now substitute these values for $m$ and $c$ into $y=mx+c$  to get:

\n

\\[y=\\simplify[!noLeadingMinus,fractionNumbers,unitFactor]{{m} x+ {c}}\\text{.}\\]

\n

The green line drawn on the graph represents the above line equation.

\n

{correctPoints()}

", "preamble": {"css": "", "js": ""}, "parts": [{"showCorrectAnswer": true, "customMarkingAlgorithm": "", "prompt": "

Calculate the gradient, $m$, of the straight line between these two points.

\n

$m=$ [[0]]

\n

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

Use this gradient and the coordinates of the points to calculate the $y$-intercept, $c$.

\n

$c=$ [[0]]

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

Give the equation of the straight line through these points in the form $y=mx+c$. 

\n

$\\displaystyle y=$ [[0]]

\n

Use the graph to plot your answer and check that it goes through these points.

", "unitTests": [], "scripts": {"mark": {"order": "after", "script": "this.question.lines.l.setAttribute({strokeColor: this.credit==1 ? 'green' : 'red'});\nthis.question.lines.c.setAttribute({visible: this.credit==1});\n"}}, "adaptiveMarkingPenalty": 0, "showFeedbackIcon": true, "type": "gapfill", "marks": 0, "gaps": [{"showPreview": true, "vsetRangePoints": 5, "scripts": {}, "unitTests": [], "checkingType": "absdiff", "vsetRange": [0, 1], "failureRate": 1, "answerSimplification": "fractionNumbers", "useCustomName": false, "answer": "{m}*x+{c}", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "notallowed": {"message": "

You must input your answer in the form y = mx +c where m and c are numbers.

", "showStrings": false, "partialCredit": 0, "strings": ["c", "m"]}, "checkVariableNames": true, "checkingAccuracy": 0.001, "adaptiveMarkingPenalty": 0, "showFeedbackIcon": true, "type": "jme", "valuegenerators": [{"name": "x", "value": ""}], "customName": "", "marks": 1, "variableReplacementStrategy": "originalfirst"}], "useCustomName": false, "customName": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": false}], "functions": {"correctPoints": {"type": "html", "definition": "//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[Math.min(-1,xa-2),Math.max(2,yb+2,c+1),Math.max(2,xb+2),Math.min(-1,ya-2,c-1)],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n\nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-22,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\n\n\nquestion.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\n//define ans as this \ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;", "parameters": [], "language": "javascript"}, "plotPoints": {"type": "html", "definition": "//point coordinate variables\nvar xa = Numbas.jme.unwrapValue(scope.variables.xa);\nvar xb = Numbas.jme.unwrapValue(scope.variables.xb);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ya);\nvar yb = Numbas.jme.unwrapValue(scope.variables.yb);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[Math.min(-1,xa-2),Math.max(2,yb+2,c+1),Math.max(2,xb+2),Math.min(-1,ya-2,c-1)],grid: true});\nvar board = div.board;\nquestion.board = board;\n\n//points (with nice colors)\nvar a = board.create('point',[xa,ya],{name: 'A', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', fixed: true, showInfobox: true});\nvar b = board.create('point',[xb,yb],{name: 'B', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow',fixed: true, showInfobox: true});\n\n\n//ans(was tree) is defined at the end and nscope looks important\n//but they're both variables\n var ans;\n var nscope = new Numbas.jme.Scope([scope,{variables:{x:new Numbas.jme.types.TNum(0)}}]);\n//this is the beating heart of whatever plots the function,\n//I've changed this from being curve to functiongraph\n var line = board.create('functiongraph',[function(x){\nif(ans) {\n try {\nnscope.variables.x.value = x;\n var val = Numbas.jme.evaluate(ans,nscope).value;\n return val;\n }\n catch(e) {\nreturn 13;\n }\n}\nelse\n return 13;\n },-12,12]\n , {strokeColor:\"blue\",strokeWidth: 4} );\n \nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-22,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: false, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\nquestion.lines = {\n l:line, c:correct_line\n}\n\n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\n\n//define ans as this \ntry {\n ans = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n ans = null;\n}\nline.updateCurve();\ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;", "parameters": [], "language": "javascript"}}, "rulesets": {}, "type": "question"}, {"name": "Percentages and ratios - box of chocolates", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Lauren Richards", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1589/"}], "type": "question", "statement": "

A family receive a box of chocolates as a gift. There are five different kinds of chocolate inside: plain, nut, caramel, dark and coconut.

\n

The box contains equal numbers of each kind of chocolate..

", "advice": "

a)

\n

100% represents the whole box of chocolates. As there are 5 different kinds of chocolate in the box and they are all represented equally, to calculate the percentage chocolates which are caramel, divide 100 by 5.

\n

Caramel chocolate = $\\displaystyle\\frac{100}{5}$ = $20$% of the box.

\n

\n

\n

b) 

\n

The original number of chocolates in the box is stated. We worked out above that each type of chocolate makes up 20% of the box, so we need to work out 20% of {chocs}.

\n

To do this, either divide {chocs} by 100 and mulitply by 20, OR multiply {chocs} by 0.2. The two methods will give the same result.

\n

Method 1: $\\displaystyle\\frac{\\var{chocs}}{100}$ x $20$ = $\\var{type}$;

\n

OR

\n

Method 2: $\\var{chocs}$ x $0.2$ = $\\var{type}$.

\n

\n

\n

c)

\n

There are now {type} fewer chocolates in the box, but the remaining chocolates now represent 100% of the box. There are now only 4 types of chocolate in it and there is still equal representation inside the box.

\n

Use the method from part a) to find out the equal share of each chocolate type.

\n

Each type = $\\displaystyle\\frac{100}{4}$ = $25$% of the box.

\n

\n

\n

d) 

\n

i)

\n

The first section asks you to compare plain chocolate and dark chocolate. It states that there are {p} plain chocolates and {d} dark chocolates left in the box.

\n

Insert the numbers of each into the gaps.

\n

Plain $\\var{p}$ : $\\var{d}$ Dark

\n

From this, we should look to see if this answer can be simplified down. To do this, we need to find the greatest common divisor of $\\var{p}$ and $\\var{d}$. 

\n

The greatest common divisor is $\\var{gcd}$.

\n

Using this value to simplify down the ratio by dividing each term by the value, the final answer is

\n

Plain $\\var{ratio_plain}$ : $\\var{ratio_dark}$ Dark.

\n

This states that for every {ratio_plain} plain {if(ratio_plain=1,\"chocolate\",\"chocolates\")}, there {if(ratio_dark=1,\"is\",\"are\")} {ratio_dark} dark {if(ratio_dark=1,\"chocolate\",\"chocolates\")}.

\n

Therefore, it is not possible to simplify further and the final answer is

\n

Plain $\\var{p}$ : $\\var{d}$ Dark.

\n

This states that for every {p} plain {if(p=1,\"chocolate\",\"chocolates\")}, there {if(d=1,\"is\",\"are\")}{d} dark {if(d=1,\"chocolate\",\"chocolates\")}.

\n

\n

ii)

\n

The second section asks you to compare coconut chocolates and the rest of the box. It states that there are {c} coconut chocolates. To calculate the number of chocolates in the rest of the box, add together the stated amounts of plain, dark and nutty chocolates:

\n

$\\var{p}+\\var{d}+\\var{n}$ = $\\var{rob}$.

\n

Insert these two figures into the gaps.

\n

Coconut $\\var{c}$ : $\\var{rob}$ Other chocolates

\n

From this, we should look to see if this answer can be simplified down. To do this, we need to find the greatest common divisor of $\\var{c}$ and $\\var{rob}$. 

\n

The greatest common divisor is $\\var{gcd2}$.

\n

Using this value to simplify down the ratio by dividing each term by the value, the final answer is

\n

Coconut $\\var{ratio_coconut}$ : $\\var{ratio_rest}$ Other chocolates.

\n

This states that for every {ratio_coconut} coconut {if(ratio_coconut=1,\"chocolate\",\"chocolates\")}, there {if(ratio_rest=1,\"is\",\"are\")} {ratio_rest} other {if(ratio_rest=1,\"chocolate\",\"chocolates\")} in the box.

\n

Therefore, it is not possible to simplify further and the final answer is 

\n

Coconut $\\var{c}$ : $\\var{rob}$ Other chocolates.

\n

This states that for every {c} coconut {if(c=1,\"chocolate\",\"chocolates\")}, there {if(rob=1,\"is\",\"are\")} {rob} other {if(rob=1,\"chocolate\",\"chocolates\")} in the box.

", "variables": {"ratio_dark": {"templateType": "anything", "name": "ratio_dark", "definition": "d/gcd(p,d)", "description": "

Number of dark chocolates in ratio of plain to dark.

", "group": "Ungrouped variables"}, "ratio_rest": {"templateType": "anything", "name": "ratio_rest", "definition": "rob/gcd(c, rob)", "description": "

Number of 'rest of box' chocolates in ratio of coconut to rest of box.

", "group": "Ungrouped variables"}, "d": {"templateType": "anything", "name": "d", "definition": "random(1..3)*p", "description": "

Number of dark chocolates on day 3.

", "group": "Ungrouped variables"}, "gcd2": {"templateType": "anything", "name": "gcd2", "definition": "gcd(c,rob)", "description": "", "group": "Ungrouped variables"}, "type": {"templateType": "anything", "name": "type", "definition": "chocs/5", "description": "

Number of each type of chocolate in the box.

", "group": "Ungrouped variables"}, "c": {"templateType": "anything", "name": "c", "definition": "random(1..14 except 7 except 11 except 13)", "description": "

Number of coconut chocolates on day 3.

", "group": "Ungrouped variables"}, "chocs": {"templateType": "randrange", "name": "chocs", "definition": "random(70..95#5)", "description": "

Total number of chocolates in the box before eating.

", "group": "Ungrouped variables"}, "rob": {"templateType": "anything", "name": "rob", "definition": "p+n+d", "description": "

Sum of the rest of the box excluding coconut.

", "group": "Ungrouped variables"}, "p": {"templateType": "anything", "name": "p", "definition": "random(2..5)", "description": "

Number of plain chocolates on day 3.

", "group": "Ungrouped variables"}, "ratio_plain": {"templateType": "anything", "name": "ratio_plain", "definition": "p/gcd(p,d)", "description": "

Number of plain chocolates in ratio of plain to dark.

", "group": "Ungrouped variables"}, "prob": {"templateType": "anything", "name": "prob", "definition": "precround({n/{a},2)", "description": "

Probability that a nutty chocolate is selected from the box on day 3.

", "group": "Ungrouped variables"}, "gcd": {"templateType": "anything", "name": "gcd", "definition": "gcd(p,d)", "description": "", "group": "Ungrouped variables"}, "n": {"templateType": "anything", "name": "n", "definition": "random(1..14 except 7 except 11 except 13)", "description": "

Number of nutty chocolates on day 3.

", "group": "Ungrouped variables"}, "a": {"templateType": "anything", "name": "a", "definition": "p+n+d+c", "description": "

Number of chocolates in the box on day 3.

", "group": "Ungrouped variables"}, "perc": {"templateType": "anything", "name": "perc", "definition": "100*(prob)", "description": "

Percentage version of probability.

", "group": "Ungrouped variables"}, "minusc": {"templateType": "anything", "name": "minusc", "definition": "{chocs-type}", "description": "

Number of chocolates in the box minus caramel.

", "group": "Ungrouped variables"}, "ratio_coconut": {"templateType": "anything", "name": "ratio_coconut", "definition": "c/gcd(c, rob)", "description": "

Number of coconut chocolates in ratio of coconut to rest of box.

", "group": "Ungrouped variables"}}, "functions": {}, "tags": ["percentages", "ratios", "Ratios", "taxonomy"], "variable_groups": [], "parts": [{"scripts": {}, "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "maxValue": "20", "showFeedbackIcon": true, "minValue": "20", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

What percentage of the box of chocolates is represented by the caramel chocolates?

\n

Caramel chocolate = [[0]] % of the box.

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

If there were $\\var{chocs}$ chocolates in the box originally, how many of each kind were there?

\n

There are [[0]] of each type of chocolate in the box.

\n

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

Caramel flavoured chocolate is the family favourite, and so all of these chocolates are eaten first, and none of the other kinds are touched.

\n

What percentage of the remaining chocolates are plain?

\n

Plain chocolates = [[0]]% of the box.

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

Over the next few days, the remaining chocolates in the box are slowly devoured so that by day three, all that remain are:

\n

$\\var{p}$ plain chocolates, $\\var{n}$ nutty chocolates, $\\var{c}$ coconut chocolates and $\\var{d}$ dark chocolates.

\n

\n

i) What is the ratio of plain to dark chocolates? Give your answer in its simplest form.

\n

Plain [[0]] : [[1]] Dark

\n

\n

ii) What is the ratio of coconut chocolates to the rest of the box? Give your answer in its simplest form.

\n

Coconut [[2]] : [[3]] Rest of the box

\n

", "type": "gapfill"}], "ungrouped_variables": ["chocs", "type", "p", "n", "d", "c", "rob", "prob", "a", "perc", "minusc", "ratio_plain", "ratio_dark", "ratio_coconut", "ratio_rest", "gcd", "gcd2"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

A simple situational question about a box of chocolates, asking how many of each type there are, what percentage of the box they represent, the probability of picking one and ratios of different types.

"}, "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "", "maxRuns": 100}}, {"name": "Substitute values into formulas", "extensions": ["geogebra"], "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": "Aiden McCall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1592/"}], "metadata": {"description": "

Substitute given values into formulas.

", "licence": "Creative Commons Attribution 4.0 International"}, "ungrouped_variables": ["r", "x1", "n", "x2", "const", "sales"], "type": "question", "advice": "

When inserting numbers into your calculator make sure you place brackets correctly.

\n

a) 

\n

As $x = \\var{n+2}$,

\n

substitute $\\var{n+2}$ into $\\var{x2}x^2 + \\var{x1}x + \\var{const}$.

\n

\\begin{align}
\\var{x2}x^2 + \\var{x1}x + \\var{const} &= \\var{x2} (\\var{n+2})^2 + \\var{x1}(\\var{n+2}) + \\var{const} \\\\
&=  \\simplify{{x2} ({n+2})^2 + {x1}({n+2}) + {const}}\\,.
\\end{align}

\n

b)

\n

As $y =  \\var{n}$,

\n

substitute $\\var{n}$ into $\\var{n+1}y^2-\\var{x2}y$.

\n

\\begin{align}
\\var{n+1}y^2-\\var{x2}y &=  \\var{n+1}(\\var{n})^2-\\var{x2}(\\var{n}) \\\\
&=  \\simplify{{n+1}({n})^2-{x2}({n})}\\,.
\\end{align}

\n

c)

\n

As we are given a temperature in degrees Celcius, $T_C = \\var{T_C}°C.$

\n

Substituting $T_C$ into $T_C = 1.8\\,T_C + 32$.

\n

\\begin{align}
T_F &=1.8\\, T_C+32 \\\\
&=1.8 (\\var{T_C}) + 32 \\\\
&= \\var{dpformat(1.8 {T_C} +32, 1)}\\,°F\\,.
\\end{align}

\n

\n

\n

", "variable_groups": [{"name": "Name variables", "variables": ["name", "name2", "pronoun"]}, {"name": "Temperature conversion", "variables": ["T_F", "T_C"]}], "rulesets": {}, "statement": "

Substitute the given values in the equations below.

", "parts": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "gapfill", "variableReplacements": [], "showCorrectAnswer": true, "marks": 0, "gaps": [{"correctAnswerFraction": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "allowFractions": false, "minValue": "{x2}{n+2}^2+{x1}{n+2}+{const}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "maxValue": "{x2}{n+2}^2+{x1}{n+2}+{const}", "mustBeReduced": false, "marks": 1, "variableReplacements": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true}], "showFeedbackIcon": true, "prompt": "

A curve is defined by a function $y=\\simplify{{x2}x^2 + {x1}x + {const}}$.

\n

What is the $y$ coordinate value of the point on the curve at $x=\\var{n+2}$?

\n

$y =$ [[0]]

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

{name[n]} sells luxury yachts.

\n

The predicted sales of the luxury yachts are defined by

\n

\\[S=\\simplify{{n+1}y^2-{x2}y},\\]

\n

where
$S$ is the number of sales predicted this year;
$y$ is the number of luxury yachts sold in the previous year.

\n

{pronoun} sold {n} yachts in the previous year.

\n

Calculate $S$, the number of sales predicted this year.

\n

$S =$ [[0]]

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

You can convert temperatures from degrees celsius to degrees fahrenheit by using the formula

\n

\\[T_F=1.8\\, T_C+32,\\]

\n

where
$T_F$ = Temperature in $°F$
$T_C$ = Temperature in $°C$.

\n

Convert $\\var{T_C}°C$ into degrees fahrenheit.

\n

$T_F =$ [[0]] $°F$  

"}], "tags": ["predicted value", "substitution", "Substitution", "taxonomy"], "preamble": {"css": "", "js": ""}, "functions": {}, "variables": {"pronoun": {"description": "

Defines the pronoun in the question.

", "definition": "if(mod(n,2)=0,\"He\",\"She\")", "group": "Name variables", "name": "pronoun", "templateType": "anything"}, "T_C": {"description": "

Creates a random integer value for the temperature in degrees celcius.

", "definition": "random(5..30#1)", "group": "Temperature conversion", "name": "T_C", "templateType": "anything"}, "name": {"description": "

List of names to randomise. Can change to any name inserted

", "definition": "[\"Andrew\",\"Susan\",\"Tom\",\"Geraldine\",\"Joshua\",\"Chantel\"]", "group": "Name variables", "name": "name", "templateType": "anything"}, "n": {"description": "

n is a random number between 0 and 4 that picks a name from {name} and then picks the next in the list for the other name such that there is always a male and a female in the question. 

", "definition": "random(0..4#1)", "group": "Ungrouped variables", "name": "n", "templateType": "anything"}, "sales": {"description": "", "definition": "(n+1)n^2-x2*n", "group": "Ungrouped variables", "name": "sales", "templateType": "anything"}, "const": {"description": "

The constant coefficient

", "definition": "random(1..100#1)", "group": "Ungrouped variables", "name": "const", "templateType": "anything"}, "T_F": {"description": "

Creates a value for Temperature in fahrenheit.

", "definition": "T_C*1.8+32", "group": "Temperature conversion", "name": "T_F", "templateType": "anything"}, "r": {"description": "

A random variable which will be inputted by the student.

", "definition": "random(1..50#0.1)", "group": "Ungrouped variables", "name": "r", "templateType": "anything"}, "x2": {"description": "

The x^2 coefficient

", "definition": "random(1..(n+1)*n)", "group": "Ungrouped variables", "name": "x2", "templateType": "anything"}, "name2": {"description": "

List of names to randomise. Can change to any name inserted

", "definition": "[\"Andrew\",\"Susan\",\"Tom\",\"Geraldine\",\"Joshua\",\"Chantel\"]", "group": "Name variables", "name": "name2", "templateType": "anything"}, "x1": {"description": "

The x coefficient

", "definition": "random(1..50)", "group": "Ungrouped variables", "name": "x1", "templateType": "anything"}}, "variablesTest": {"maxRuns": 100, "condition": ""}}]}], "showstudentname": true, "name": "Year 10 Practice Exam 1", "type": "exam", "contributors": [{"name": "Neil Anderson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2916/"}], "extensions": ["geogebra", "jsxgraph", "stats"], "custom_part_types": [], "resources": []}