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

Write a loop in,e.g., Matlab or Python to determine terms in a sequence.

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

Determine the terms in a sequence, e.g., by writing a loop in Python or Matlab.

", "advice": "

In Python, for example, the answer might look something like this:

\n
x_0 = {x0}
x_1 = {x1}
x_2 = {x2}
N = {N}
for n in range(3, N+1):
    x_n = ({a})*x_0 + ({b})*x_1 + ({c})*x_2
    x_0 = x_1
    x_1 = x_2
    x_2 = x_n
print(x_n)
", "rulesets": {}, "extensions": [], "variables": {"x0": {"name": "x0", "group": "Ungrouped variables", "definition": "random([-3,-2,-1,1,2,3])", "description": "", "templateType": "anything"}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "random([-3,-2,-1,1,2,3])", "description": "", "templateType": "anything"}, "x2": {"name": "x2", "group": "Ungrouped variables", "definition": "random([-3,-2,-1,1,2,3])", "description": "", "templateType": "anything"}, "N": {"name": "N", "group": "Ungrouped variables", "definition": "random(16..20)", "description": "", "templateType": "anything"}, "xN": {"name": "xN", "group": "Ungrouped variables", "definition": "sequencer(x0,x1,x2,a,b,c,N)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random([-1,1])", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random([1,2])", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random([-2,-1])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["x0", "x1", "x2", "N", "a", "b", "c", "xN"], "variable_groups": [], "functions": {"sequencer": {"parameters": [["x0", "number"], ["x1", "number"], ["x2", "number"], ["a", "number"], ["b", "number"], ["c", "number"], ["N", "number"]], "type": "number", "language": "javascript", "definition": "for (var n = 3; n <= N; n++) {\n x3 = a * x0 + b * x1 + c * x2;\n x0 = x1;\n x1 = x2;\n x2 = x3;\n}\nreturn x3;"}}, "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": "

The sequence is defined as:

\n

$x_{n} = \\var{a}x_{n-3} + \\var{b}x_{n-2} \\var{c}x_{n-1}$

\n

and starts $x_0=\\var{x0}$, $x_1=\\var{x1}$, $x_2=\\var{x2}$.

\n

Determine $x_{\\var{N}}$: [[0]]

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "xN", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "xN", "maxValue": "xN", "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/"}]}