// 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:
\nt | \n0 | \n1 | \n2 | \n3 | \n4 | \n5 | \n6 | \n7 | \n8 | \n9 | \n
Y | \n$\\var{Y0}$ | \n$\\var{Y1}$ | \n$\\var{Y2}$ | \n$\\var{Y3}$ | \n$\\var{Y4}$ | \n$\\var{Y5}$ | \n$\\var{Y6}$ | \n$\\var{Y7}$ | \n$\\var{Y8}$ | \n$\\var{Y9}$ | \n
In Matlab, for example:
\nt = 0:9;\n
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
Q1. y(10) = $\\var{Y10}$
\nroots(coeffs); % find where the polynomial is zero... here there is only one real solution
\nQ2. 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:
\nt | \n0 | \n1 | \n2 | \n3 | \n4 | \n5 | \n6 | \n7 | \n8 | \n9 | \n
Y | \n$\\var{Y0}$ | \n$\\var{Y1}$ | \n$\\var{Y2}$ | \n$\\var{Y3}$ | \n$\\var{Y4}$ | \n$\\var{Y5}$ | \n$\\var{Y6}$ | \n$\\var{Y7}$ | \n$\\var{Y8}$ | \n$\\var{Y9}$ | \n