// Numbas version: exam_results_page_options {"metadata": {"description": "

Questions on the subtleties and pitfalls of methods of data collection.

", "licence": "Creative Commons Attribution 4.0 International"}, "timing": {"timeout": {"action": "none", "message": ""}, "allowPause": true, "timedwarning": {"action": "none", "message": ""}}, "name": "Data collection", "feedback": {"allowrevealanswer": true, "advicethreshold": 0, "intro": "", "showanswerstate": true, "feedbackmessages": [], "showtotalmark": true, "showactualmark": true}, "showQuestionGroupNames": false, "navigation": {"browse": true, "allowregen": true, "preventleave": true, "showfrontpage": true, "onleave": {"action": "none", "message": ""}, "reverse": true, "showresultspage": "oncompletion"}, "question_groups": [{"pickQuestions": 1, "pickingStrategy": "all-ordered", "name": "Group", "questions": [{"name": "Relative Frequency ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "advice": "

The relative frequency of an outcome is the frequency of the outcome divided by the number of trials.

\n

#### a)

\n

We are told that $\\var{no_people}$ people were asked whether they preferred to buy free-range eggs or caged eggs in supermarkets and that $\\var{free_range}$ of these people said that they preferred to buy free-range eggs.

\n

To calculate the relative frequency of people who prefer buying free-range eggs we need the number of trials and the frequency of people who said that they preferred buying free-range eggs.

\n

So, the number of trials in this situation is the number of people who were asked the question, which is $\\var{no_people}$.

\n

The frequency of people who said that they preferred to buy free-range eggs is $\\var{free_range}$.

\n

Therefore, the relative frequency of people who prefer buying free-range eggs is

\n

\$\\frac{\\var{free_range}}{\\var{no_people}} = \\var{dpformat({free_range/no_people}, 2)} \\; (\\text{rounded to 2 decimal places}). \$

\n

#### b)

\n

We are told that the relative frequency of a student being taller than $150$ cm is $\\var{rel_freq}$.

\n

Here, we must use the formula for relative frequency in reverse in order to estimate the number of students in the class who are taller than $150$ cm.

\n

As we are using relative frequency to calculate this number, our answer may not be completely accurate, therefore our answer will be an estimate of the actual number.

\n

If we let $n$ denote the number of students in the class who are taller than $150$ cm and if there are $\\var{no_students}$ students in the class then

\n

\\\begin{align} \\frac{n}{\\var{no_students}} &= \\var{rel_freq}\\\\ n &= \\var{rel_freq} \\times \\var{no_students}\\\\ &= \\var{{rel_freq}*{no_students}}. \\end{align} \

\n

As $n$ represents a number of people we must round our value of $n$ to the nearest integer.

\n

So, the estimated number of students in the class who are taller than $150$ cm is $\\var{dpformat({rel_freq}*{no_students},0)}$.

\n

#### c)

\n

\n

i)

\n

Using the frequency table given in the question, we can calculate the sample size of the survey by adding together the frequencies of each of the different types of pets.

\n

So, the sample size of the survey is

\n

\$\\var{dog}+\\var{cat}+\\var{hamster}+\\var{parrot} = \\var{{dog}+{cat}+{hamster}+{parrot}}. \$

\n

ii)

\n

To calculate the relative frequency of a person having a dog as a pet, we divide the frequency of people in the survey who had a dog as a pet by the sample size of the survey.

\n

So, the relative frequency is

\n

\$\\frac{\\var{dog}}{\\var{n}} = \\var{dpformat({dog/n}, 2)} \\; (\\text{rounded to 2 decimal places}). \$

\n

", "statement": "

The relative frequency of an outcome is the frequency of the outcome divided by the number of trials.

", "variables": {"dog": {"name": "dog", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of dog in part c

", "definition": "random(10..50)"}, "free_range": {"name": "free_range", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of people who prefer free-range eggs in part a)

", "definition": "random(10..40)"}, "cat": {"name": "cat", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of cat in part c.

", "definition": "random(10..50 except dog)"}, "parrot": {"name": "parrot", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of guinea pig in part c.

", "definition": "random(10..50 except dog except cat except hamster)"}, "rel_freq": {"name": "rel_freq", "group": "Ungrouped variables", "templateType": "anything", "description": "

Relative frequency for part b

", "definition": "random(0.1..0.9 # 0.01)"}, "n": {"name": "n", "group": "Ungrouped variables", "templateType": "anything", "description": "

Sample size for part c

", "definition": "dog+cat+hamster+parrot"}, "no_students": {"name": "no_students", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of students in the class for part b

", "definition": "random(20..40 #10)"}, "no_people": {"name": "no_people", "group": "Ungrouped variables", "templateType": "anything", "description": "

Number of people asked in part a)

", "definition": "random(50..150 #10)"}, "hamster": {"name": "hamster", "group": "Ungrouped variables", "templateType": "anything", "description": "

Frequency of hamster in part c

", "definition": "random(10..40 except dog except cat) "}}, "tags": ["Experimental Probability", "Relative Frequency", "taxonomy"], "ungrouped_variables": ["no_people", "free_range", "no_students", "rel_freq", "dog", "cat", "hamster", "parrot", "n"], "functions": {}, "preamble": {"js": "", "css": ""}, "type": "question", "variable_groups": [], "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"description": "

Calculate relative frequencies in a variety of scenarios.

", "licence": "Creative Commons Attribution 4.0 International"}, "parts": [{"notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerStyle": "plain", "precision": "2", "scripts": {}, "maxValue": "{free_range}/{no_people}", "prompt": "

$\\var{no_people}$ people were asked whether they preferred to buy free-range eggs or caged eggs in supermarkets. $\\var{free_range}$ people said that they preferred to buy free-range eggs. What is the relative frequency of people who prefer buying free-range eggs? Give your answer as a decimal, to $2$ decimal places.

\n

", "marks": 1, "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "{free_range}/{no_people}", "precisionType": "dp", "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": true, "showFeedbackIcon": true, "precisionMessage": "

You must give your answer as a decimal to 2 decimal places.

"}, {"notationStyles": ["plain", "en", "si-en"], "precisionPartialCredit": 0, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerStyle": "plain", "precision": 0, "scripts": {}, "maxValue": "{no_students}*{rel_freq}", "prompt": "

The heights of a class of students were measured. The relative frequency of a student being taller than $150$ cm is known to be $\\var{rel_freq}$. If there are $\\var{no_students}$ students in the class, estimate the number of students who are taller than $150$ cm.

", "marks": 1, "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "{no_students}*{rel_freq}", "precisionType": "dp", "showCorrectAnswer": true, "type": "numberentry", "showPrecisionHint": true, "showFeedbackIcon": true, "precisionMessage": "

"}, {"scripts": {}, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "minValue": "{dog}+{cat}+{hamster}+{parrot}", "correctAnswerFraction": false, "allowFractions": false, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "scripts": {}, "maxValue": "{dog}+{cat}+{hamster}+{parrot}", "showCorrectAnswer": true, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst"}, {"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "mustBeReducedPC": 0, "precisionPartialCredit": 0, "strictPrecision": true, "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "minValue": "{dog}/({dog}+{cat}+{hamster}+{parrot})", "allowFractions": false, "correctAnswerStyle": "plain", "precisionType": "dp", "scripts": {}, "maxValue": "{dog}/({dog}+{cat}+{hamster}+{parrot})", "showCorrectAnswer": true, "precision": "2", "type": "numberentry", "showPrecisionHint": true, "marks": 1, "showFeedbackIcon": true, "precisionMessage": "

"}], "type": "gapfill", "prompt": "

A survey was conducted to find out what type of pet is the most common. The results are given in the table below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Type of Pet Frequency Dog $\\var{dog}$ Cat $\\var{cat}$ Hamster $\\var{hamster}$ Parrot \n$\\var{parrot}$\n
\n

\n

i)

\n

What was the sample size for the survey?

\n

[]

\n

ii)

\n

What is the relative frequency of a person having a dog as a pet? Give your answer as a decimal, to $2$ decimal places.

\n

[]

\n

", "variableReplacementStrategy": "originalfirst", "marks": 0, "variableReplacements": [], "showFeedbackIcon": true}]}, {"name": "Theoretical Probability vs Experimental Probability ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "type": "question", "statement": "

Two unbiased, 6-sided dice were rolled together and the total of the numbers shown on the faces was recorded.

\n

The experiment was repeated $\\var{no_rolls}$ times.

\n

This table gives the frequency of each outcome.

\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
 Total Frequency 2 3 4 5 6 7 8 9 10 11 12 $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$ $\\var{Freq}$
", "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"Freq2": {"group": "Ungrouped variables", "name": "Freq2", "description": "

List of Frequencies for theoretical probability.

", "templateType": "anything", "definition": "[1,2,3,4,5,6,5,4,3,2,1]"}, "sum": {"group": "Ungrouped variables", "name": "sum", "description": "

Sums obtained from no_rolls of two dice part a)

", "templateType": "anything", "definition": "repeat(random(2..12), no_rolls)"}, "gcd2": {"group": "Ungrouped variables", "name": "gcd2", "description": "

Gcd for answer in part a) ii)

", "templateType": "anything", "definition": "gcd(Freq2[x],36)"}, "gcd1": {"group": "Ungrouped variables", "name": "gcd1", "description": "

Gcd of numerator and denominator for advice for part a) i).

", "templateType": "anything", "definition": "gcd(Freq[sum-2], no_rolls)"}, "die": {"group": "Ungrouped variables", "name": "die", "description": "

number the die lands on in part a)

", "templateType": "anything", "definition": "[2,3,4,5,6,7,8,9,10,11,12]"}, "Freq": {"group": "Ungrouped variables", "name": "Freq", "description": "

Frequencies of each possible sum of numbers from rolling 2 die. part a

", "templateType": "anything", "definition": "map(\nlen(filter(x=j,x,sum)),\nj, 2..12)"}, "add": {"group": "Ungrouped variables", "name": "add", "description": "", "templateType": "anything", "definition": "random(-5..5 except -1 except 1 except 0)"}, "no_rolls": {"group": "Ungrouped variables", "name": "no_rolls", "description": "

Number of rolls of the die in part a.

Index for part a.

", "templateType": "anything", "definition": "indices(die, sum)"}}, "functions": {}, "tags": ["dice", "Dice", "Experimental probability", "Experimental Probability", "experimental probability", "Probability", "probability", "sum of two dice", "taxonomy", "theoretical probability", "Theoretical Probability"], "variable_groups": [], "parts": [{"scripts": {}, "variableReplacements": [], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"correctAnswerFraction": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": true, "maxValue": "{Freq[{sum}-2]}/{no_rolls}", "showFeedbackIcon": true, "minValue": "{Freq[{sum}-2]}/{no_rolls}", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showCorrectAnswer": true, "prompt": "

Find the experimental probability of rolling a total of $\\var{sum}$.

\n

\n

[]

", "marks": 0}, {"correctAnswerFraction": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": true, "maxValue": "{Freq2[{x}]}/36", "showFeedbackIcon": true, "prompt": "

Now calculate the theoretical probability that the sum of the scores of the two dice is $\\var{sum}$.

\n

", "minValue": "{Freq2[{x}]}/36", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"scripts": {}, "variableReplacements": [], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"scripts": {}, "minMarks": 0, "distractors": ["", ""], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "choices": ["

gets closer to the theoretical probability

", "

gets further away from the theoretical probability

"], "showFeedbackIcon": true, "shuffleChoices": true, "matrix": ["1", 0], "variableReplacements": [], "marks": 0, "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "type": "1_n_2"}], "showCorrectAnswer": true, "prompt": "

As the number of rolls of the two dice increases, the experimental probability []

\n

", "marks": 0}], "ungrouped_variables": ["die", "no_rolls", "sum", "Freq", "Freq2", "x", "gcd1", "gcd2", "add", "remainder"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Compute the experimental probability of a particular score on a die given a sample of throws, and compare it with the theoretical probability.

\n

The last part asks what you expect to happen to the experimental probability as the sample size increases.

"}, "preamble": {"css": "", "js": ""}, "advice": "

There are two ways of assigning probability:

\n
\n
• Experimental Probability is where you do an experiment, observe the outcome and record the relative frequency results.
• \n
• Theoretical Probability is where the probability is calculated based on fairness and symmetrical properties of the results.
• \n
\n

#### a)

\n

To calculate the experimental probability (relative frequency) of an outcome we divide the frequency of the outcome in the experiment by the number of trials.

\n

We are given that the experiment was repeated $\\var{no_rolls}$ times.

\n

We then need the number of times that the sum of the faces of the dice was equal to $\\var{sum}$. From the frequency table, we can see that the frequency of rolling a $\\var{sum}$ in the experiment was $\\var{Freq[sum-2]}$.

\n

Therefore, the experimental probability of rolling a $\\var{sum}$ is

\n

\\\begin{align} P(\\text{total}=\\var{sum}) &= \\displaystyle\\frac{\\text{number of times a total of \\var{sum} was rolled}}{\\text{total number of rolls}}\\\\&= \\displaystyle\\frac{\\var{Freq[sum-2]}}{\\var{no_rolls}}.\\end{align}\

\n

\\\begin{align} P(\\text{total}=\\var{sum}) &= \\displaystyle\\frac{\\text{number of times a total of \\var{sum} was rolled}}{\\text{total number of rolls}}\\\\&= \\displaystyle\\frac{\\var{Freq[sum-2]}}{\\var{no_rolls}}\\\\&= \\displaystyle\\var[fractionNumbers, simplifyFractions]{{Freq[sum-2]/no_rolls}}.\\end{align}\

\n

#### b)

\n

When two unbiased 6-sided dice are rolled and their scores are added, there are $11$ possible outcomes: the total must be between $2$ and $12$ inclusive.

\n

To work out the probabilities of each outcome occurring, we must be very careful about how the experiment is performed.

\n

There are a total of $36$ different outcomes when rolling two dice one after the other; these are shown in Table $1$.

\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\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
Table 1
123456
1(1,1)(1,2)(1,3)(1,4)(1,5)(1,6)
2(2,1)(2,2)(2,3)(2,4)(2,5)(2,6)
3(3,1)(3,2)(3,3)(3,4)(3,5)(3,6)
4(4,1)(4,2)(4,3)(4,4)(4,5)(4,6)
5(5,1)(5,2)(5,3)(5,4)(5,5)(5,6)
6(6,1)(6,2)(6,3)(6,4)(6,5)(6,6)
\n

Note that these outcomes are all different. For example, the outcomes (2,1) and (1,2) are not the same because we know the order in which the dice were thrown so we can distinguish between these two outcomes; when the first die lands on $2$ and the second die lands on $1$ the outcome is (2,1), however when the first die lands on $1$ and the second die lands on $2$ the outcome is (1,2).

\n

The sum of the numbers in these outcomes is the same, we just count them as different outcomes.

\n

Any one of these $36$ outcomes is equally likely to occur, so the probability of each of these outcomes is $\\displaystyle\\frac{1}{36}$.

\n

However, if you roll two indistinguishable dice at the same time, you can't differentiate (a 1 and a 2) from (a 2 and a 1). From your point of view, they are the same outcome. The probabilities of the underlying events (each die's score) haven't changed, but the outcomes you observe have.

\n

In this case you have a total of $21$ outcomes; these outcomes are not all equally likely. There's only one way of obtaining two 1s, while there are two ways of obtaining a 1 and a 2, corresponding to two squares in Table $1$. Hence the probability of obtaining two 1s would be $\\displaystyle\\frac{1}{36}$, whereas the probability of obtaining a 1 and a 2 would be

\n

\$\\displaystyle\\frac{2}{36}=\\displaystyle\\frac{1}{18}.\$

\n

You can do the experiment this way, but it's easier when you can tell the dice apart.

\n

Table $2$ shows the corresponding total of the faces of the dice for each of the outcomes in Table $1$.

\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\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
Table 2
+123456
1234567
2345678
3456789
45678910
567891011
6789101112
\n

\n

For equally likely outcomes you can calculate the probability using the formula

\n

\$\\text{Probability of an event} = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}}.\$

\n

Table $3$ gives the theoretical probabilities of each of the possible totals of the two dice occurring:

\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
 Total 2 3 4 5 6 7 8 9 10 11 12 Probability $\\displaystyle\\frac{1}{36}$ $\\displaystyle\\frac{2}{36}$ $\\displaystyle\\frac{3}{36}$ $\\displaystyle\\frac{4}{36}$ $\\displaystyle\\frac{5}{36}$ $\\displaystyle\\frac{6}{36}$ $\\displaystyle\\frac{5}{36}$ $\\displaystyle\\frac{4}{36}$ $\\displaystyle\\frac{3}{36}$ $\\displaystyle\\frac{2}{36}$ $\\displaystyle\\frac{1}{36}$
\n

\$P(\\text{total}=\\var{sum}) = \\displaystyle\\frac{\\var{Freq2[x]}}{36}.\$

\n

\\\begin{align} P(\\text{total}=\\var{sum}) &= \\displaystyle\\frac{\\var{Freq2[x]}}{36}\\\\ &= \\displaystyle\\var[fractionNumbers,simplifyFractions]{Freq2[x]/36}. \\end{align}\

\n

#### c)

\n

For any experiment, as we make the number of trials very large the experimental probability tends towards the theoretical probability.

\n

For this experiment, for example, the theoretical probability of the sum of the faces of the two dice being $3$ is

\n

\$\\displaystyle\\frac{2}{36} = \\var{sigformat(1/18,3)} \\text{ (rounded to 3 significant figures)}.\$

\n

If we were to roll the two dice a very large number of times, for example $10000$ times, the frequencies of each outcome would be different.

\n

The table below was produced by the recording the frequency of each outcome after rolling the two dice 10,000 times.

\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
 Total 2 3 4 5 6 7 8 9 10 11 12 \nFrequency\n $\\var{ceil(10000/36)+{add}}$ $\\var{ceil(10000/18)+{add}}$ $\\var{ceil(2500/3)+{add}}$ $\\var{ceil(10000/9)+{add}}$ $\\var{ceil(12500/9)+{add}}$ $\\var{10000-{remainder}}$ $\\var{ceil(12500/9)-{add}}$ $\\var{ceil(10000/9)-{add}}$ $\\var{ceil(2500/3)-{add}}$ $\\var{ceil(5000/9)-{add}}$ $\\var{ceil(2500/9)-{add}}$
\n

This means that the new experimental probability of the sum of the faces of the two dice being $3$ is

\n

\$\\displaystyle\\frac{\\var{ceil(10000/18) + {add}}}{10000} = \\var{sigformat((ceil(10000/18)+{add})/10000,3)} \\text{ (rounded to 3 significant figures)}.\$

\n

This is very close to the theoretical probability, so we can see how the experimental probability changes as we increases the number of trials.

"}, {"name": "Straight line equation application: measuring sunflower height", "extensions": ["jsxgraph", "random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": 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": "Vicky Hall", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/659/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}], "metadata": {"description": "

An applied example of the use of two points on a graph to develop a straight line function, then use the t estimate and predict. MCQ's are also used to develop student understanding of the uses of gradient and intercepts as well as the limitations of prediction.

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

{person['name']} is given a sunflower seedling for {person['pronouns']['their']} 30th birthday (day $0$) and observes its height. {capitalise(person['pronouns']['they'])} make{s} the following observations later that week:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Observation A B Day $\\var{xa}$ $\\var{xb}$ height (cm) $\\var{ya}$ $\\var{yb}$
\n

{person['name']} plots the 2 points:

\n

{plotPoints()}

", "variables": {"m": {"group": "Ungrouped variables", "name": "m", "description": "

", "templateType": "anything", "definition": "random(2..3)"}, "yb": {"group": "point coordinates", "name": "yb", "description": "

y coordinate of point B

", "templateType": "anything", "definition": "m*xb+c"}, "d": {"group": "Ungrouped variables", "name": "d", "description": "

A number of days after receiving the seedling, on which the height is estimated

", "templateType": "anything", "definition": "random([10,14,20])"}, "ya": {"group": "point coordinates", "name": "ya", "description": "

y coordinate of point A

", "templateType": "anything", "definition": "m*xa+c"}, "c": {"group": "Ungrouped variables", "name": "c", "description": "

The intercept

", "templateType": "anything", "definition": "random(2..4)"}, "s": {"group": "Random person", "name": "s", "description": "

He makes, they make.

", "templateType": "anything", "definition": "if(person['gender']='neutral','','s')"}, "xb": {"group": "point coordinates", "name": "xb", "description": "

x coordinate of point B

", "templateType": "anything", "definition": "xa+1"}, "person": {"group": "Random person", "name": "person", "description": "

A random person

", "templateType": "anything", "definition": "random_person()"}, "xa": {"group": "point coordinates", "name": "xa", "description": "

x coordinate of point a

", "templateType": "anything", "definition": "random(3..5)"}}, "tags": ["assessing the accuracy of a graph", "estimations", "gradient", "interpreting graphs", "interpreting the gradient", "limitations of a line equation based on data used to create the equation", "line equation", "Straight Line", "straight line", "taxonomy", "using graphs to estimate a y value", "y-intercept"], "ungrouped_variables": ["m", "c", "d"], "functions": {"advicePoints": {"language": "javascript", "type": "html", "parameters": [], "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:[-1,yb+5,xb+3,-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},-2,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\n\n\n$('body').on('question-html-attached',function(e,question,qd) {\nko.computed(function(){\nvar expr = question.parts.gaps.display.studentAnswer();\n//define ans as this \ncorrect_line.updateCurve();\nboard.update();\n});\n });\n\n\nreturn div;"}, "plotPoints": {"language": "javascript", "type": "html", "parameters": [], "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:[-1,yb+5,xb+3,-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 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 163;\n }\n}\nelse\n return 163;\n },-2,22]\n , {strokeColor:\"blue\",strokeWidth: 4} );\n \nvar correct_line = board.create('functiongraph',[function(x){ return m*x+c},-2,22], {strokeColor:\"green\",setLabelText:'mx+c',visible: false, strokeWidth: 4, highlightStrokeColor: 'green'} )\n\nquestion.lines = {\n l:line, c:correct_line\n}\n\n$('body').on('question-html-attached',function(e,question,qd) {\nko.computed(function(){\nvar expr = question.parts.gaps.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;"}}, "preamble": {"js": "", "css": ""}, "advice": "

#### a)

\n

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

\n

\$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{.}\$

\n

#### b)

\n

Rearranging the equation $y=mx+c$ for $c$ and using point A:

\n

\$c = y_1-mx_1 = \\var{ya}-\\var{m}\\times\\var{xa}=\\simplify{{ya-m*xa}}\\text{.}\$

\n

We then check this against point $B$:

\n

\$y_2 = mx_2 + c = \\simplify[fractionNumbers]{{m}{xb}+{c}}=\\simplify{{m}*{xb}+{c}}\\text{.}\$

\n

#### b)

\n

We now substitute the values for $m$ and $c$ into the equation of a straight line, $y=mx+c$,

\n

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

\n

\n

#### c)

\n

The gradient represents the vertical change (height in cm) per unit of the horizontal axis (days): the change in height of the sunflower per day.

\n

#### d)

\n

Substituting $x=\\var{d}$ into the straight line equation, the height $y$ after $\\var{d}$ days is

\n

\\begin{align}
y&=\\simplify{{m}}x+\\var{c}\\\\
&=\\simplify[]{{m}{d}}+\\var{c}\\\\
&=\\var{m*d+c}\\text{cm.}
\\end{align}

\n

#### e)

\n

Substituting $x=\\var{1826}$ into the straight line equation, the height $y$ after $1826$ days is

\n

\\begin{align}
y&=\\simplify{{m}}x+\\var{c}\\\\
&=\\simplify[]{{m}1826} + \\var{c}\\\\
&=\\var{m*1826+c}\\text{cm.}
\\end{align}

\n

Note that this is $\\var{(m*1826+c)/100}$ metres. In 2014, a sunflower of $9.17$ metres was entered into the Guinness World Records as tallest sunflower.

\n

#### f)

\n

Possible reasons that the prediction will not be accurate are:

\n
\n
• from everyday observations and basic biology that a sunflower cannot keep growing forever, but our straight line equation would predict otherwise.
• \n
• the set of observations are limited in their time frame. In particular another relationship could easily fit the 2 data points.
• \n
\n

Invalid reasons that the prediction will not be accurate are:

\n
\n
• There can only be one straight line between two points; only one equation describes this.
• \n
• Based on common sense, we know that sunflowers do grow over time.
• \n
", "variable_groups": [{"variables": ["xa", "xb", "ya", "yb"], "name": "point coordinates"}, {"variables": ["person", "s"], "name": "Random person"}], "rulesets": {}, "variablesTest": {"condition": "\n", "maxRuns": 100}, "parts": [{"scripts": {}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "unitTests": [], "useCustomName": false, "minValue": "m", "correctAnswerFraction": true, "customName": "", "allowFractions": true, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxValue": "m", "showCorrectAnswer": true, "type": "numberentry", "showFractionHint": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "marks": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true}], "type": "gapfill", "prompt": "

What is the gradient, $m$, of the straight line between the two points?

\n

$m =$ []

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

Use the gradient and the coordinates of the two points to find the height of the sunflower when {person['name']} received it.

\n

[] cm.

", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"scripts": {"mark": {"order": "after", "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"}}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"valuegenerators": [{"name": "x", "value": ""}], "variableReplacements": [], "unitTests": [], "useCustomName": false, "showPreview": true, "variableReplacementStrategy": "originalfirst", "customName": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "scripts": {}, "showCorrectAnswer": true, "failureRate": 1, "type": "jme", "checkVariableNames": false, "marks": 1, "customMarkingAlgorithm": "", "answer": "{m}*x+{c}", "vsetRange": [0, 1], "showFeedbackIcon": true, "vsetRangePoints": 5}], "type": "gapfill", "prompt": "

Let $y$ be the sunflower height and $x$ the time, in days, since {person['name']} received the sunflower. What is the equation of the straight line between the points?

\n

$y(x) =$ []

\n

", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"marks": 0, "displayType": "radiogroup", "unitTests": [], "choices": ["

The length of time taken in days for the sunflower to grow $1$ cm

", "

The change in height (in cm) of the sunflower over $1$ day

", "

The width of the ruler used to measure the sunflower

", "

All of the above

"], "scripts": {}, "distractors": ["", "", "", ""], "shuffleChoices": false, "prompt": "

", "showCellAnswerState": true, "useCustomName": false, "minMarks": 0, "variableReplacements": [], "maxMarks": 0, "customName": "", "extendBaseMarkingAlgorithm": true, "matrix": [0, "1", 0, 0], "displayColumns": "1", "showCorrectAnswer": true, "type": "1_n_2", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"scripts": {}, "variableReplacements": [], "unitTests": [], "useCustomName": false, "customName": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "variableReplacements": [], "unitTests": [], "useCustomName": false, "minValue": "d*m+c", "correctAnswerFraction": false, "customName": "", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "scripts": {}, "maxValue": "d*m+c", "showCorrectAnswer": true, "type": "numberentry", "showFractionHint": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "marks": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true}], "type": "gapfill", "prompt": "

{person['name']} uses the straight line equation to predict the future height of the sunflower. What will the height be on day $\\var{d}$?

\n

[] cm

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

{person['name']} wonders if {person['pronouns']['they']} can guess what the height of the sunflower will be on {person['pronouns']['their']} 35th birthday. {capitalise(person['pronouns']['they'])} work{s} out that this is day 1826. Using the straight line equation, what would the height be on day 1826?

\n

[] cm

", "customMarkingAlgorithm": "", "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"variableReplacementStrategy": "originalfirst", "displayType": "checkbox", "unitTests": [], "choices": ["

Sunflower height as a function of time may not have a straight linear relationship.

", "

The observations only span a very limited time range.

", "

There are multiple straight linear relationships that could be obtained using the same $2$ data points.

", "

Sunflower height never actually increases over time.

"], "scripts": {}, "distractors": ["", "", "", ""], "shuffleChoices": false, "marks": 0, "showCellAnswerState": true, "useCustomName": false, "minMarks": 0, "variableReplacements": [], "maxMarks": "1", "prompt": "

{person['name']} doubts {person['pronouns']['their']} result. Which of the following reason(s) may mean that the height on {person['pronouns']['their']} 35th birthday is not accurate?

", "customName": "", "warningType": "none", "extendBaseMarkingAlgorithm": true, "matrix": ["0.5", "0.5", "-0.5", "-0.5"], "displayColumns": "1", "showCorrectAnswer": true, "type": "m_n_2", "maxAnswers": 0, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "minAnswers": 0}]}]}], "duration": 0, "type": "exam", "showstudentname": true, "percentPass": 0, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "extensions": ["jsxgraph", "random_person"], "custom_part_types": [], "resources": []}