// Numbas version: finer_feedback_settings {"name": "Placing a point on a number line (10 bars non-integers)", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Placing a point on a number line (10 bars non-integers)", "tags": [], "metadata": {"description": "
This question asks you to place a point on a number line. The number is not an integer.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "This question asks you to place a point on a number line.
", "advice": "Since each bar represents $\\displaystyle \\dfrac{\\var{r}-(\\var{l})}{10}=\\var[fractionNumbers]{(r-l)/10}$ and since the number $\\displaystyle A=\\var[fractionNumbers]{l+a*((r-l)/10)}$ lies $\\displaystyle A-(\\var{l})=\\var[fractionNumbers]{l+a*((r-l)/10)}-(\\var{l})=\\var[fractionNumbers]{a*((r-l)/10)}=\\var{a}\\times \\var[fractionNumbers]{(r-l)/10}$ from $\\displaystyle \\var{l}$, the number $\\displaystyle A=\\var[fractionNumbers]{l+a*((r-l)/10)}$ lies $\\displaystyle \\var{a}$ bars from the left as shown below.
\n{dragpointafter()}
", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"r": {"name": "r", "group": "Ungrouped variables", "definition": "random(1,2,5,10)+l", "description": "This is the right hand endpoint of the numberline.
", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Ungrouped variables", "definition": "random(-9 .. 10#1)", "description": "This is the left hand endpoint of the numberline.
", "templateType": "randrange", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1..9)", "description": "This is the distance along the number line.
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "floor(l+a*((r-l)/10))<>(l+a*((r-l)/10))", "maxRuns": "100"}, "ungrouped_variables": ["l", "r", "a"], "variable_groups": [], "functions": {"dragpointafter": {"parameters": [], "type": "html", "language": "javascript", "definition": "// set up the board\n\nJXG.Options.text.fontSize = 15; \n\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','150px',{boundingBox:[-1,3,11,-3],axis:false,showNavigation:false});\nvar board = div.board;\n\nvar l1 = board.create('line',[[0,0],[10,0]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l2 = board.create('line',[[1,-1],[1,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l3 = board.create('line',[[2,-1],[2,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l4 = board.create('line',[[3,-1],[3,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l5 = board.create('line',[[4,-1],[4,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l6 = board.create('line',[[5,-1],[5,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l7 = board.create('line',[[6,-1],[6,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l8 = board.create('line',[[7,-1],[7,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l9 = board.create('line',[[8,-1],[8,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l10 = board.create('line',[[9,-1],[9,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\n\nvar a1 = board.create('line',[[0,0],[0.5,0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a2 = board.create('line',[[0,0],[0.5,-0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a3 = board.create('line',[[10,0],[9.5,0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a4 = board.create('line',[[10,0],[9.5,-0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\n\nvar l = Numbas.jme.unwrapValue(scope.variables.l);\nvar r = Numbas.jme.unwrapValue(scope.variables.r);\n\nvar b = board.create('point',[-0.7,-0.4],{size:-1,name:l});\nb.setProperty({fixed:true});\nvar c = board.create('point',[9.9,-0.4],{size:-1,name:r});\nc.setProperty({fixed:true});\n\n\nvar a = Numbas.jme.unwrapValue(scope.variables.a);\n\nvar a = board.create('point',[a,0],{size:5});\na.setProperty({fixed:true});\n\nreturn div;"}, "dragpoint": {"parameters": [], "type": "html", "language": "javascript", "definition": "// set up the board\n\nJXG.Options.text.fontSize = 15; \n\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','150px',{boundingBox:[-1,3,11,-3],axis:false,showNavigation:false});\nvar board = div.board;\n\nvar l1 = board.create('line',[[0,0],[10,0]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l2 = board.create('line',[[1,-1],[1,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l3 = board.create('line',[[2,-1],[2,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l4 = board.create('line',[[3,-1],[3,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l5 = board.create('line',[[4,-1],[4,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l6 = board.create('line',[[5,-1],[5,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l7 = board.create('line',[[6,-1],[6,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l8 = board.create('line',[[7,-1],[7,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l9 = board.create('line',[[8,-1],[8,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar l10 = board.create('line',[[9,-1],[9,1]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\n\nvar a1 = board.create('line',[[0,0],[0.5,0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a2 = board.create('line',[[0,0],[0.5,-0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a3 = board.create('line',[[10,0],[9.5,0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\nvar a4 = board.create('line',[[10,0],[9.5,-0.5]], \n {straightFirst:false, straightLast:false, strokeWidth:2,fixed:true});\n\nvar l = Numbas.jme.unwrapValue(scope.variables.l);\nvar r = Numbas.jme.unwrapValue(scope.variables.r);\n\nvar b = board.create('point',[-0.7,-0.4],{size:-1,name:l});\nb.setProperty({fixed:true});\nvar c = board.create('point',[9.9,-0.4],{size:-1,name:r});\nc.setProperty({fixed:true});\n\nvar a = board.create('point',[5,2],{size:5});\n\na.on('drag',function(){\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a.X()); \n});\n\nreturn div;"}}, "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": "Place the point $\\displaystyle A=\\var[fractionNumbers]{l+a*((r-l)/10)}$ on the number line below by dragging it.
\nNote that the line starts at the number $\\displaystyle \\var{l}$ and finishes at the number $\\displaystyle \\var{r}$. In addition please disregard the numbers that appear when you drag the point $A$, these refer to an invisible grid that enables the program to calculate where you drag the point to.
\nThe point should finish up on a vertical bar, the vertical position of the point does not matter and your answer will default to the nearest vertical bar.
\n{dragpoint()}
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "a-0.5", "maxValue": "a+0.5", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Anthony Brown", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/799/"}], "resources": []}]}], "contributors": [{"name": "Anthony Brown", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/799/"}]}