// Numbas version: exam_results_page_options {"name": "Further Graphs - Addition", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "preamble": {"js": "function dragpoint_board() {\n var scope = question.scope;\n \n // var a = scope.variables.a.value;\n// var c = scope.variables.c.value;\n\n var yo0 = scope.variables.yo0.value;\n var yo1 = scope.variables.yo1.value;\n var yo2 = scope.variables.yo2.value;\n var yo3 = scope.variables.yo3.value; \n var yo4 = scope.variables.yo4.value;\n var go0 = scope.variables.go0.value;\n var go1 = scope.variables.go1.value;\n var go2 = scope.variables.go2.value;\n var go3 = scope.variables.go3.value; \n var go4 = scope.variables.go4.value;\n \n \n var maxx = scope.variables.maxx.value;\n var maxy = scope.variables.maxy.value;\n \n var div = Numbas.extensions.jsxgraph.makeBoard('500px','500px',{boundingBox:[-maxx,maxy,maxx,-maxy],grid:true});\n $(question.display.html).find('#dragpoint').append(div);\n \n var board = div.board;\n \n \n //create stationary points\n \n var op0 = board.create('point',[-2,yo0],{name:'',fixed:true,size:2,color:'black'});\n var op1 = board.create('point',[-1,yo1],{name:'',fixed:true,size:2,color:'black'});\n var op2 = board.create('point',[0,yo2],{name:'',fixed:true,size:2,color:'black'});\n var op3 = board.create('point',[1,yo3],{name:'',fixed:true,size:2,color:'black'});\n var op4 = board.create('point',[2,yo4],{name:'',fixed:true,size:2,color:'black'});\n \n var op5 = board.create('point',[-2,go0],{name:'',fixed:true,size:2,color:'blue'});\n var op6 = board.create('point',[-1,go1],{name:'',fixed:true,size:2,color:'blue'});\n var op7 = board.create('point',[0,go2],{name:'',fixed:true,size:2,color:'blue'});\n var op8 = board.create('point',[1,go3],{name:'',fixed:true,size:2,color:'blue'});\n var op9 = board.create('point',[2,go4],{name:'',fixed:true,size:2,color:'blue'});\n \n \n //create draggable points\n //why are there are a cloine under each one?\n //var np0 = board.create('point',[-2,yo0],{name:'A',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n //var np1 = board.create('point',[-1,yo1],{name:'B',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n //var np2 = board.create('point',[0,yo2],{name:'C',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n //var np3 = board.create('point',[1,yo3],{name:'D',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n //var np4 = board.create('point',[2,yo4],{name:'E',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n \n var np0 = board.create('point',[-2,0],{name:'A',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n var np1 = board.create('point',[-1,0],{name:'B',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n var np2 = board.create('point',[0,0],{name:'C',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n var np3 = board.create('point',[1,0],{name:'D',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n var np4 = board.create('point',[2,0],{name:'E',size:2,snapSizeX: 0.25,snapSizeY: 0.25,snapToGrid: true});\n \n \n \n //shorthand to evaluate a mathematical expression to a number\n function evaluate(expression) {\n try {\n var val = Numbas.jme.evaluate(expression,question.scope);\n return Numbas.jme.unwrapValue(val);\n }\n catch(e) {\n // if there's an error, return no number\n return NaN;\n }\n }\n \n // set up points array\n var num_points = 5;\n var points = [np0, np1, np2, np3, np4];\n \n \n // this function sets up the i^th point\n function make_point(i) {\n \n // calculate initial coordinates\n // var x = i-(num_points-1)/2;\n \n // create an invisible vertical line for the point to slide along\n // var line = board.create('line',[[x,0],[x,1]],{visible: false});\n \n // create the point\n // var point = points[i] = board.create(\n // 'point',\n // [i-(num_points-1)/2,0],\n // {\n // name:'',\n // size:2,\n // snapSizeY: 0.25, // the point will snap to y-coordinates which are multiples of 0.1\n // snapSizeX: 0.25,\n // snapToGrid: true\n // }\n // );\n \n var point = points[i];\n \n var x=point[0];\n var y=point[1];\n \n // the contents of the input box for this point\n var xstudentAnswer = question.parts[0].gaps[2*i].display.studentAnswer;\n var ystudentAnswer = question.parts[0].gaps[2*i+1].display.studentAnswer;\n \n // watch the student's input and reposition the point when it changes. \n ko.computed(function() {\n x = evaluate(xstudentAnswer());\n y = evaluate(ystudentAnswer());\n if(!(isNaN(x)) && !(isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n point.moveTo([x,y],100);\n }\n });\n \n // when the student drags the point, update the gapfill input\n point.on('drag',function(){\n var x = Numbas.math.niceNumber(point.X());\n var y = Numbas.math.niceNumber(point.Y());\n xstudentAnswer(x);\n ystudentAnswer(y);\n });\n \n }\n \n // create each point\n for(var i=0;ihorizontal shift

", "group": "Ungrouped variables", "name": "hsh"}, "vsc": {"templateType": "anything", "definition": "if(selector[2]=1,random(-2,-1,-0.5,0.5,2),1)", "description": "", "group": "Ungrouped variables", "name": "vsc"}, "go1": {"templateType": "anything", "definition": "go[1]", "description": "", "group": "Ungrouped variables", "name": "go1"}, "xo": {"templateType": "anything", "definition": "list(-2..2)", "description": "

original x values

", "group": "Ungrouped variables", "name": "xo"}, "yo": {"templateType": "anything", "definition": "repeat(random(-5..5),5)", "description": "

the (random) original y values which relate to the x values

", "group": "Ungrouped variables", "name": "yo"}, "yn": {"templateType": "anything", "definition": "map(vsc*y+vsh,y,yo)", "description": "

new y values after the transformation

", "group": "Ungrouped variables", "name": "yn"}, "go2": {"templateType": "anything", "definition": "go[2]", "description": "", "group": "Ungrouped variables", "name": "go2"}, "vsh": {"templateType": "anything", "definition": "if(selector[0]=1,random(-3..3#0.5 except 0),0)\n", "description": "

vertical shift

", "group": "Ungrouped variables", "name": "vsh"}, "xn": {"templateType": "anything", "definition": "xo", "description": "

new transformed x values

", "group": "Ungrouped variables", "name": "xn"}, "yo2": {"templateType": "anything", "definition": "yo[2]", "description": "", "group": "Ungrouped variables", "name": "yo2"}, "go3": {"templateType": "anything", "definition": "go[3]", "description": "", "group": "Ungrouped variables", "name": "go3"}, "maxx": {"templateType": "anything", "definition": "max(map(abs(a),a,xn)+5)+1", "description": "", "group": "Ungrouped variables", "name": "maxx"}, "yo1": {"templateType": "anything", "definition": "yo[1]", "description": "", "group": "Ungrouped variables", "name": "yo1"}, "selector": {"templateType": "anything", "definition": "shuffle([0,0,1,1])", "description": "

order is ['vsh','hsh','vsc','hsc'] 1 is on 0 is off

", "group": "Ungrouped variables", "name": "selector"}, "go": {"templateType": "anything", "definition": "repeat(random(-5..5),5)", "description": "", "group": "Ungrouped variables", "name": "go"}, "hsc": {"templateType": "anything", "definition": "if(selector[3]=1,random(-2,-1,-0.5,0.5,2),1)", "description": "", "group": "Ungrouped variables", "name": "hsc"}, "gn": {"templateType": "anything", "definition": "[yo[0]+go[0],yo[1]+go[1],yo[2]+go[2],yo[3]+go[3],yo[4]+go[4]]", "description": "", "group": "Ungrouped variables", "name": "gn"}, "yo4": {"templateType": "anything", "definition": "yo[4]", "description": "", "group": "Ungrouped variables", "name": "yo4"}, "yo3": {"templateType": "anything", "definition": "yo[3]", "description": "", "group": "Ungrouped variables", "name": "yo3"}, "go4": {"templateType": "anything", "definition": "go[4]", "description": "", "group": "Ungrouped variables", "name": "go4"}, "maxy": {"templateType": "anything", "definition": "max(map(abs(a),a,yn)+5)+1", "description": "", "group": "Ungrouped variables", "name": "maxy"}}, "name": "Further Graphs - Addition", "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "", "statement": "

The graphs of the functions $y=f(x)$  and $y=g(x)$ are shown below in black and blue respectively. Move the red points so the red curve represents $y=f(x)+g(x)$.

\n

\n

(Note: If one of the red points happens to be in the correct place, move it and then return it to automatically update the coordinates in the table below, otherwise manually type in the correct coordiantes).

", "variable_groups": [], "parts": [{"customMarkingAlgorithm": "", "gaps": [{"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "xn[0]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "xn[0]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "gn[0]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "gn[0]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "xn[1]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "xn[1]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "gn[1]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "gn[1]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "xn[2]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "xn[2]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "gn[2]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "gn[2]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "xn[3]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "xn[3]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "gn[3]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "gn[3]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "xn[4]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "xn[4]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}, {"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "correctAnswerFraction": false, "minValue": "gn[4]", "scripts": {}, "mustBeReducedPC": 0, "showFractionHint": true, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "mustBeReduced": false, "type": "numberentry", "useCustomName": false, "unitTests": [], "maxValue": "gn[4]", "allowFractions": true, "correctAnswerStyle": "plain", "marks": 1}], "prompt": "
\n

The point $A$ was $(-2,\\var{yo0})$ but it is now $\\big($[[0]],[[1]]$\\big)$.
The point $B$ was $(-1,\\var{yo1})$ but it is now $\\big($[[2]],[[3]]$\\big)$.
The point $C$ was $(0,\\var{yo2})$ but it is now $\\big($[[4]],[[5]]$\\big)$.
The point $D$ was $(1,\\var{yo3})$ but it is now $\\big($[[6]],[[7]]$\\big)$.
The point $E$ was $(2,\\var{yo4})$ but it is now $\\big($[[8]],[[9]]$\\big)$.

\n", "stepsPenalty": "10", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "scripts": {}, "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill", "useCustomName": false, "unitTests": [], "steps": [{"customMarkingAlgorithm": "", "variableReplacements": [], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "customName": "", "scripts": {}, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "information", "useCustomName": false, "unitTests": [], "marks": 0}], "marks": 0}], "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

Given the graphs of two functions $f$ and $g$ can you sketch the graph of $f+g$?

"}, "functions": {}, "rulesets": {"std": ["all", "fractionNumbers"]}, "extensions": ["jsxgraph"], "ungrouped_variables": ["selector", "vsh", "hsh", "vsc", "hsc", "yo", "yn", "xo", "xn", "yo0", "yo1", "yo2", "yo3", "yo4", "maxx", "maxy", "recip", "go", "go0", "go1", "go2", "go3", "go4", "gn"], "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Paul Hancock", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1738/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Paul Hancock", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1738/"}]}