// Numbas version: exam_results_page_options {"name": "Quadratic functions: Working with the Formula - Fitness of Population", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Quadratic functions: Working with the Formula - Fitness of Population", "tags": [], "metadata": {"description": "

The relationship between the frequency of an allele A, $x$, at a genetic locus in a diploid population and the fitness of a population with this frequency of allele A, $w$, is described by the function $w=ax^2+x(b-x)+c(b-x)^2$ . The aims are (a) ti simplify the algebraic expression, (b) calculate the fitness of a population with a given allele A frequency, and (c) calculate the allele A frequency when the fitness of the population is given.

", "licence": "None specified"}, "statement": "

Let $x$ represent the frequency of an allele A at a genetic locus in a diploid population. The fitness, $w$, of a population with this frequency of allele A is given by:

\n

\\[ \\simplify{w={a}x^2+x({b}-x)+{c}({b}-x)^2} \\]

", "advice": "

a) We need to open the brackets and collect like terms:

\n

\\[ \\begin{split} w &= \\simplify{{a}x^2+x({b}-x)+{c}({b}-x)^2} \\\\ \\implies w &= \\simplify[!basic]{{a}x^2+x({b}-x)+{c}({b}-x)({b}-x)}\\\\ \\implies w &= \\simplify [unitFactor, !basic] {{a}x^2+x({b}-x)+{c}({b}^2-{b}x-{b}x+x^2)} \\\\ \\implies w &= \\simplify {{a}x^2+x({b}-x)+{c}({b}^2-{b}x-{b}x+x^2)} \\\\ \\implies w &= \\simplify[unitFactor, !collectNumbers] {{a}x^2+{b}*x-x^2+{c}*{b^2}-{c}*{2*b}x+{c}x^2} \\\\ \\implies w &=\\simplify[all, !noLeadingMinus] {{a}x^2+{b}*x-x^2+{c}*{b}^2-2*{c}*{b}x+{c}x^2} \\end{split}\\]

\n

b) We substitute $x=\\var{x_1}$ in the simplified formula:

\n

\\[w=\\simplify[unitfactor, !basic]{{coef_a}*{x_1}^2+{coef_b}*{x_1}+{coef_c}} \\\\ \\implies w=\\simplify [unitfactor, !basic]{{coef_a}*{x_1^2}+{coef_b}*{x_1}+{coef_c}} \\\\ \\implies w=\\var{w_ans_rounded} \\text{  (2 d.p.)}\\]

\n

Note: we get the same result regardless of which version of the formula we use. Using the simplified formula however is quicker.

\n

c) We need to substitute $w=\\var{w_1}$ and solve the quadratic equation:

\n

\\[ \\simplify[!noLeadingMinus]{{w_1}={coef_a}*x^2+{coef_b}*x+{coef_c}} \\\\ \\implies \\simplify[!noLeadingMinus]{{w_1}-{coef_a}*x^2-{coef_b}*x-{coef_c}=0} \\\\ \\implies \\simplify{{w_1}-{coef_a}*x^2-{coef_b}*x-{coef_c}=0}\\]

\n

Using the quadratic formula

\n

\\[ x=\\frac{-b\\pm \\sqrt{b^2-4ac}}{2a}\\]

\n

We get the solutions:

\n

\\[ \\begin{split} x_1 &\\,= \\frac{\\simplify{-{co_b}+sqrt({co_b}^2-4*{co_a}*{co_c})}}{\\simplify{{2*co_a}}} \\qquad \\text{and} \\qquad  x_2 &\\,= \\frac{\\simplify{-{co_b}-sqrt({co_b}^2-4*{co_a}*{co_c})}}{\\simplify{{2*co_a}}} \\\\\\\\ &\\,= \\var{ansx_1_rounded},\\quad &\\,=\\var{ansx_2_rounded}. \\end{split}\\]

\n

Taking into consideration the context of the problem, we need to reject one of the two answers if it is negative. Thus, the final answer is $x=\\var{ans_c}$.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "problem posing variables", "definition": "random (0 .. 0.5 # 0.1 except 0)", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "problem posing variables", "definition": "random([1,2])", "description": "", "templateType": "anything", "can_override": false}, "x_1": {"name": "x_1", "group": "problem posing variables", "definition": "random (0..1 #0.05 except [0,1]) ", "description": "", "templateType": "anything", "can_override": false}, "w_1": {"name": "w_1", "group": "problem posing variables", "definition": "random (0..1 #0.1 except [0,1]) ", "description": "", "templateType": "anything", "can_override": false}, "coef_a": {"name": "coef_a", "group": "answer variables", "definition": "{a}+{c}-1", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "problem posing variables", "definition": "random (0 .. 0.5 # 0.1 except 0)", "description": "", "templateType": "anything", "can_override": false}, "coef_b": {"name": "coef_b", "group": "answer variables", "definition": "{b}-2*{c}*{b}", "description": "", "templateType": "anything", "can_override": false}, "coef_c": {"name": "coef_c", "group": "answer variables", "definition": "{c}*{b}^2", "description": "", "templateType": "anything", "can_override": false}, "w_ans": {"name": "w_ans", "group": "answer variables", "definition": "coef_a*x_1^2+coef_b*x_1+coef_c", "description": "", "templateType": "anything", "can_override": false}, "disc": {"name": "disc", "group": "answer variables", "definition": "(-coef_b)^2 - 4*coef_a*(coef_c-w_1)", "description": "", "templateType": "anything", "can_override": false}, "ansx_1": {"name": "ansx_1", "group": "Final part coefficients", "definition": "(-co_b+sqrt(co_b^2-4*co_a*co_c))/(2*co_a)", "description": "", "templateType": "anything", "can_override": false}, "ansx_2": {"name": "ansx_2", "group": "Final part coefficients", "definition": "(-co_b-sqrt(co_b^2-4*co_a*co_c))/(2*co_a)", "description": "", "templateType": "anything", "can_override": false}, "w_ans_rounded": {"name": "w_ans_rounded", "group": "answer variables", "definition": "precround(w_ans,2)", "description": "", "templateType": "anything", "can_override": false}, "ansx_1_rounded": {"name": "ansx_1_rounded", "group": "Final part coefficients", "definition": "precround(ansx_1,2)", "description": "", "templateType": "anything", "can_override": false}, "ansx_2_rounded": {"name": "ansx_2_rounded", "group": "Final part coefficients", "definition": "precround(ansx_2,2)", "description": "", "templateType": "anything", "can_override": false}, "ans_c": {"name": "ans_c", "group": "Final part coefficients", "definition": "if(ansx_1_rounded>0, ansx_1_rounded,ansx_2_rounded)", "description": "", "templateType": "anything", "can_override": false}, "co_a": {"name": "co_a", "group": "Final part coefficients", "definition": "-coef_a", "description": "", "templateType": "anything", "can_override": false}, "co_b": {"name": "co_b", "group": "Final part coefficients", "definition": "-coef_b", "description": "", "templateType": "anything", "can_override": false}, "co_c": {"name": "co_c", "group": "Final part coefficients", "definition": "w_1-coef_c", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "(coef_a<0)and(0<=w_ans<=1)and(disc>0)and(coef_c-w_1>0)", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "problem posing variables", "variables": ["a", "b", "x_1", "w_1", "c"]}, {"name": "answer variables", "variables": ["coef_a", "coef_b", "coef_c", "w_ans", "w_ans_rounded", "disc"]}, {"name": "Final part coefficients", "variables": ["co_a", "co_b", "co_c", "ansx_1", "ansx_2", "ansx_1_rounded", "ansx_2_rounded", "ans_c"]}], "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": "

Write $w$ in the form $ax^2+bx+c$.

\n

$w=$[[0]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{coef_a}*x^2+{coef_b}*x+{coef_c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}], "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": "

Calculate the fitness of a population with allele frequency $x=\\var{x_1}$.

\n

$w=$[[0]]

\n

Give your answer rounded to 2 decimal places.

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{w_ans_rounded}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "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 allele frequency, $x$, of a population with fitness $\\var{w_1}$.

\n

$x=$[[0]]

\n

Give your answer rounded to 2 decimal places, if needed.

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ans_c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}, {"name": "Evi Papadaki", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18113/"}]}]}], "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}, {"name": "Evi Papadaki", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18113/"}]}