// Numbas version: exam_results_page_options {"name": "Crossing the x-Axis", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Crossing the x-Axis", "tags": [], "metadata": {"description": "

Use Matlab (or Python) to fit a cubic polynomial to data, and determine where the x-axis is crossed.

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

This question tests polynomial curve fitting and root solving.

", "advice": "

By fitting a cubic polynomial to the following data:

\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
t0123456789
Y$\\var{Y0}$$\\var{Y1}$$\\var{Y2}$$\\var{Y3}$$\\var{Y4}$$\\var{Y5}$$\\var{Y6}$$\\var{Y7}$$\\var{Y8}$$\\var{Y9}$
\n
    \n
  1. The value of Y when t=10 is:
  2. \n
  3. When Y=0, the value of x is:
  4. \n
\n

In Matlab, for example:

\n
t = 0:9;
Y = [{Y0},{Y1},{Y2},{Y3},{Y4},{Y5},{Y6},{Y7},{Y8},{Y9}];
coeffs = polyfit(t, Y, 3);   % fit a cubic polynomial to the data; in Python, use NumPy and np.polyfit(), etc.
y = @(t) polyval(coeffs, t); % define a function based on our curve fit
\n

Q1. y(10) = $\\var{Y10}$

\n
roots(coeffs); % find where the polynomial is zero... here there is only one real solution
\n

Q2. y($\\var{c}$) = 0

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"c": {"name": "c", "group": "Ungrouped variables", "definition": "(random(1..49)*2-1)/10", "description": "

The one real root of the polymonial.

", "templateType": "anything", "can_override": false}, "Y0": {"name": "Y0", "group": "Ungrouped variables", "definition": "0.1 * (0^2 - 14*0 + 50) * (0 - c)", "description": "

Value of Y when t=0.

", "templateType": "anything", "can_override": false}, "Y1": {"name": "Y1", "group": "Ungrouped variables", "definition": "0.1 * (1^2 - 14*1 + 50) * (1 - c)", "description": "

Value of Y when t=1.

", "templateType": "anything", "can_override": false}, "Y2": {"name": "Y2", "group": "Ungrouped variables", "definition": "0.1 * (2^2 - 14*2 + 50) * (2 - c)", "description": "

Value of Y when t=2.

", "templateType": "anything", "can_override": false}, "Y3": {"name": "Y3", "group": "Ungrouped variables", "definition": "0.1 * (3^2 - 14*3 + 50) * (3 - c)", "description": "

Value of Y when t=3.

", "templateType": "anything", "can_override": false}, "Y4": {"name": "Y4", "group": "Ungrouped variables", "definition": "0.1 * (4^2 - 14*4 + 50) * (4 - c)", "description": "

Value of Y when t=4.

", "templateType": "anything", "can_override": false}, "Y5": {"name": "Y5", "group": "Ungrouped variables", "definition": "0.1 * (5^2 - 14*5 + 50) * (5 - c)", "description": "

Value of Y when t=5.

", "templateType": "anything", "can_override": false}, "Y6": {"name": "Y6", "group": "Ungrouped variables", "definition": "0.1 * (6^2 - 14*6 + 50) * (6 - c)", "description": "

Value of Y when t=6.

", "templateType": "anything", "can_override": false}, "Y7": {"name": "Y7", "group": "Ungrouped variables", "definition": "0.1 * (7^2 - 14*7 + 50) * (7 - c)", "description": "

Value of Y when t=7.

", "templateType": "anything", "can_override": false}, "Y8": {"name": "Y8", "group": "Ungrouped variables", "definition": "0.1 * (8^2 - 14*8 + 50) * (8 - c)", "description": "

Value of Y when t=8.

", "templateType": "anything", "can_override": false}, "Y9": {"name": "Y9", "group": "Ungrouped variables", "definition": "0.1 * (9^2 - 14*9 + 50) * (9 - c)", "description": "

Value of Y when t=9.

", "templateType": "anything", "can_override": false}, "Y10": {"name": "Y10", "group": "Ungrouped variables", "definition": "0.1 * (10^2 - 14*10 + 50) * (10 - c)", "description": "

Value of Y when t=10.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["c", "Y0", "Y1", "Y2", "Y3", "Y4", "Y5", "Y6", "Y7", "Y8", "Y9", "Y10"], "variable_groups": [], "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": "

By fitting a cubic polynomial to the following data:

\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
t0123456789
Y$\\var{Y0}$$\\var{Y1}$$\\var{Y2}$$\\var{Y3}$$\\var{Y4}$$\\var{Y5}$$\\var{Y6}$$\\var{Y7}$$\\var{Y8}$$\\var{Y9}$
\n
    \n
  1. The value of Y when t=10 is: [[0]]
  2. \n
  3. When Y=0, the value of t is: [[1]]
  4. \n
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Y10", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "Y10", "maxValue": "Y10", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "c", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "c", "maxValue": "c", "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", "contributors": [{"name": "Francis Franklin", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1887/"}]}]}], "contributors": [{"name": "Francis Franklin", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1887/"}]}