// Numbas version: exam_results_page_options {"name": "Determine the formula for a mystery function", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Determine the formula for a mystery function", "tags": [], "metadata": {"description": "

The student is shown a plot of a mystery function. They can enter values of $x$ check, within the bounds of the plot.

\n

They're asked to give the formula for the function, and then asked for its value at a very large value of $x$.

\n

A plot of the student's function updates automatically as they type. Adaptive marking is used for the final part to award credit if the student gives the right value for their incorrect function.

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

This question demonstrates some of the most important features of Numbas: randomisation, marking mathematical expressions, interactive graphics, steps, and adaptive marking.

\n

See this question on the public editor.

\n

Here's a plot of a function $f(x)$:

\n

{static_plot}

", "advice": "

The function is periodic and looks like one of the functions $\\sin(x)$ or $\\cos(x)$, scaled in both the horizontal and vertical directions.

\n

So guess that it's either of the form $a\\sin(bx)$ or $a\\cos(bx)$.

\n

Remember that $\\sin(0)=0$, while $\\cos(x)=1$.

\n

Because the plot goes through the origin, we can say that $f(x) = 0$, so the form is $a\\sin(bx)$.

\n

{advice_plot_amplitude}

\n

The maximum value that $\\sin(bx)$ reaches is $1$, so the highest point reached by the function corresponds to $f(x) = a$.

\n

The peaks shown on the graph are at $y = \\var{amplitude}$, so $a = \\var{amplitude}$.

\n

$\\sin(bx) =0 $ at $x=n\\pi/b$, so look at the places that the plot crosses the $x$-axis.

\n

Setting $n=1$, the first crossing after the origin, we can find $b = \\dfrac{\\pi}{x}$.

\n

The plot first crosses the $x$-axis at $x = \\var[fractionnumbers]{frequency}$, so $b = \\simplify{pi/{frequency}}$.

", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"expr_plot": {"name": "expr_plot", "group": "Ungrouped variables", "definition": "jsxgraph(\n 480,300,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]],\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"student_fn\", \"strokeWidth\": 3, strokeColor: \"black\"]]\n ]\n)", "description": "

A dynamic plot showing the target function and the student's function in thick black.

", "templateType": "anything", "can_override": false}, "expr": {"name": "expr", "group": "Ungrouped variables", "definition": "expression(\"{amplitude}*sin(pi*x/{frequency})\")", "description": "

The mystery function.

", "templateType": "anything", "can_override": false}, "amplitude": {"name": "amplitude", "group": "Ungrouped variables", "definition": "random(3 .. 7#1)", "description": "

The amplitude of the function.

", "templateType": "randrange", "can_override": false}, "frequency": {"name": "frequency", "group": "Ungrouped variables", "definition": "random(1 .. 4#1)", "description": "

The frequency of the oscillation.

", "templateType": "randrange", "can_override": false}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "random(-4..4 except 0)", "description": "", "templateType": "anything", "can_override": false}, "x2": {"name": "x2", "group": "Ungrouped variables", "definition": "random(-99.5..99.5 except -20..20)*frequency", "description": "

A large value of $x$ that the student will have to evaluate $f(x)$ at.

", "templateType": "anything", "can_override": false}, "y1": {"name": "y1", "group": "Ungrouped variables", "definition": "precround(eval(expr,[\"x\":x1]),2)", "description": "", "templateType": "anything", "can_override": false}, "y2": {"name": "y2", "group": "Ungrouped variables", "definition": "precround(eval(expr,[\"x\":x2]),2)", "description": "", "templateType": "anything", "can_override": false}, "advice_plot_amplitude": {"name": "advice_plot_amplitude", "group": "Ungrouped variables", "definition": "jsxgraph(\n 800,500,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]],\n ['line',[[0,amplitude],[1,amplitude]], [\"dash\": 2, \"strokeColor\": \"black\"]]\n ]\n)", "description": "", "templateType": "anything", "can_override": false}, "x_bound": {"name": "x_bound", "group": "Ungrouped variables", "definition": "8", "description": "

The student is shown values of the function whose absolute value is at most this.

", "templateType": "anything", "can_override": false}, "static_plot": {"name": "static_plot", "group": "Ungrouped variables", "definition": "jsxgraph(\n 800,500,\n [-x_bound,10,x_bound,-10],\n [\n ['functiongraph',[expr,-x_bound,x_bound], [\"id\": \"target_fn\"]]\n ]\n)", "description": "

A static plot of the function to go in the statement.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["amplitude", "frequency", "expr", "x_bound", "static_plot", "expr_plot", "x1", "x2", "y1", "y2", "advice_plot_amplitude"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Check precise values", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "y: precround(eval(expr, [\"x\":studentNumber]),5)\n\nin_bounds:\n assert(abs(studentNumber)<=x_bound,\n warn(\"You can only ask for values of $x$ between {-x_bound} and {x_bound}.\");\n fail(\"You can only ask for values of $x$ between {-x_bound} and {x_bound}.\")\n )\n\nmark:\n apply(studentNumber);\n apply(in_bounds);\n feedback(\"$f(\"+studentNumber+\") = \"+y+\"$\")", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

If you'd like to check the value of the function more carefully, type in a value for $x$ and press Submit answer. You'll be shown the corresponding value $f(x)$.

", "minValue": "0", "maxValue": "0", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": true, "customName": "Write $f(x)$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Here's a plot of $f(x)$ again:

\n

{expr_plot}

\n

Write a definition of this function in the form $y = f(x)$.

\n

Your function will be plotted in black on top of the given plot above.

\n

$y = $ [[0]]

", "stepsPenalty": 0, "steps": [{"type": "information", "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": "

This function is periodic. It looks like it involves either $\\sin(x)$ or $\\cos(x)$.

\n

If you can't tell which one it is, try entering them and see which function looks like the closest match at $x=0$.

"}, {"type": "numberentry", "useCustomName": true, "customName": "Amplitude", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the highest value that this function reaches?

", "minValue": "amplitude", "maxValue": "amplitude", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Wavelength", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the distance between points where the function crosses the horizontal axis?

", "minValue": "frequency", "maxValue": "frequency", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "gaps": [{"type": "jme", "useCustomName": true, "customName": "$f(x)$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "studentVariables (Variables used in the student's answer):\n if(studentExpr<>nothing,\n scope_case_sensitive(set(findvars(studentExpr)),settings[\"caseSensitive\"]),\n set()\n )\n\n\nstudent_fn (The plot of the student's function in the diagram):\n expr_plot[\"student_fn\"]\n\njxg_input:\n if(studentExpr<>nothing and studentVariables=set(\"x\"),\n [ jxg_set_term(student_fn, studentExpr)\n , jxg_show(student_fn, true)\n ],\n [jxg_show(student_fn, false)]\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": true, "allowUnknownFunctions": false, "implicitFunctionComposition": true, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": true, "customName": "$f(\\var{x2})$", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "expr", "part": "p1g0", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": "1", "exploreObjective": null, "prompt": "

What is the value of the function at $x = \\var{x2}$?

", "minValue": "y2", "maxValue": "y2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": "100", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}