// Numbas version: exam_results_page_options {"name": "Numbas demo: Images, videos and interactive diagrams", "extensions": ["eukleides", "geogebra", "jsxgraph"], "custom_part_types": [], "resources": [["question-resources/Numbat_Face_U5OjlWd.jpg", "/srv/numbas/media/question-resources/Numbat_Face_U5OjlWd.jpg"], ["question-resources/random-numbers_1yehVZF.svg", "/srv/numbas/media/question-resources/random-numbers_1yehVZF.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Numbas demo: Images, videos and interactive diagrams", "tags": [], "metadata": {"description": "

A demonstration of embedding various kinds of media in a question.

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

You can include all sorts of images, videos and interactive diagrams in Numbas questions.

\n

See this question in the public editor.

", "advice": "", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "extensions": ["eukleides", "geogebra", "jsxgraph"], "variables": {"mh": {"name": "mh", "group": "JSXGraph part", "definition": "precround(V^2/(2*g),2)", "description": "", "templateType": "anything"}, "t1": {"name": "t1", "group": "JSXGraph part", "definition": "precround(t,2)", "description": "", "templateType": "anything"}, "t": {"name": "t", "group": "JSXGraph part", "definition": "V/g", "description": "", "templateType": "anything"}, "v": {"name": "v", "group": "JSXGraph part", "definition": "random(50..100)", "description": "", "templateType": "anything"}, "g": {"name": "g", "group": "JSXGraph part", "definition": "9.81", "description": "", "templateType": "anything"}, "n1": {"name": "n1", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything"}, "n2": {"name": "n2", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything"}, "n3": {"name": "n3", "group": "SVG part", "definition": "random(1..99)", "description": "", "templateType": "anything"}, "point_a": {"name": "point_a", "group": "GeoGebra part", "definition": "vector(random(0..2#0.1),random(0..2#0.1))", "description": "", "templateType": "anything"}, "point_b": {"name": "point_b", "group": "GeoGebra part", "definition": "vector(random(2..4#0.1),random(2..4#0.1))", "description": "", "templateType": "anything"}, "euk_diagram": {"name": "euk_diagram", "group": "Eukleides part", "definition": "eukleides(\"An angle in a circle\",let(\n a, point(0,0),\n r, 2,\n b, point(r*cos(turn), r*sin(turn)),\n c, point(r*cos(angle+turn), r*sin(angle+turn)),\n [\n circle(a,r) dashed,\n b..a..c open,\n angle(b,a,c),\n center(c..b) label(dpformat(degrees(angle),0)+\"\u00b0\",rad(angle/2+turn),0.15),\n a,\n b color1 draggable(\"B\"),\n c color2 draggable(\"C\",[\"angle\"])\n ]\n),[\"angle\":pi/6,\"turn\":0])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": "100"}, "ungrouped_variables": [], "variable_groups": [{"name": "SVG part", "variables": ["n1", "n2", "n3"]}, {"name": "JSXGraph part", "variables": ["g", "mh", "t", "t1", "v"]}, {"name": "GeoGebra part", "variables": ["point_a", "point_b"]}, {"name": "Eukleides part", "variables": ["euk_diagram"]}], "functions": {"graphsolution": {"parameters": [], "type": "html", "language": "javascript", "definition": "var variables = question.unwrappedVariables;\nvar v = variables.v;\nvar mh = variables.mh;\nvar t = variables.t;\nvar g = variables.g;\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-3,mh+10,2*t+2,-50],\n axis:false,\n showNavigation:false,\n grid:false});\nvar brd = div.board; \n\nbrd.create('axis',[[0,0],[1,0]], {\n ticks: {\n drawLabels: true,\n label: {offset: [-5, -10]},\n minorTicks: 0\n }\n});\nbrd.create('axis',[[0,0],[0,1]], {\n ticks: {\n drawLabels: true,\n label: {offset: [-30, 0]},\n minorTicks: 0\n }\n});\nvar origin = brd.create('point',[0,0],{fixed:true,name:'',size:1});\nvar tangent = brd.create('line',[origin,[1,v]],{fixed:true,name:'',dash:2});\n\nvar student_formula;\n//create a functiongraph from the student input\nfunction userf(t){\n if(student_formula) {\n try {\n //the user input is evaluated at x=t\n var val = scope.evaluate(student_formula,{t:t});\n if(!jme.isType(val,'number')) {\n return 0;\n } else {\n return jme.castToType(val,'number').value;\n }\n }\n catch(e) {\n return 0;\n }\n }\n else\n return 0;\n}\nvar student_curve = brd.create('functiongraph',[userf,0,2*t],{strokeColor:'red',strokeWidth:2});\n\n//pick up the student answer and parse it\nquestion.signals.on('HTMLAttached',function() {\n var part = question.parts[2].gaps[0];\n \n ko.computed(function(){\n var expr = part.display.studentAnswer();\n try {\n student_formula = Numbas.jme.compile(expr);\n }\n catch(e) {\n student_formula = null;\n }\n student_curve.updateCurve();\n\n brd.update();\n });\n}); \n\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": true, "customName": "Images", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

It's easy to include an image to illustrate your question, or just liven it up.

\n

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

Diagrams in SVG format are drawn using vectors, so don't become blurry when scaled up.

\n

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

JSXGraph is a package for creating geometric diagrams and charts. You create diagrams using JavaScript code. Question variables can be used to randomise elements of the diagram, and answers to question parts can be linked to elements of the diagram.

\n

{graphsolution()}

\n

Write a formula for the height \$y\$ at time \$t\$ of a projectile launched upwards with a speed of {v} m/s.

\n

\$y=\$ [[0]]

\n

Your formula is plotted in the graph above. The vertical axis represents \$y\$ and the horizontal axis represents \$t\$.

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "jme", "useCustomName": true, "customName": "Raw value of g", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": true, "answer": "{v}t-1/2{g}*t^2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "t", "value": ""}]}], "answer": "{v}t-1/2g*t^2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": true, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "g", "value": ""}, {"name": "t", "value": ""}]}], "sortAnswers": false}, {"type": "information", "useCustomName": true, "customName": "GeoGebra", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

GeoGebra is an easy-to-use dynamic geometry package. You create diagrams using a graphical interface. Question variables can be used to randomise the elements of a diagram.

\n

{geogebra_applet(\"dw4n67kf\")}

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

The Eukleides extension provides a way of creating diagrams inside Numbas. Diagrams can be drawn based on question variables, and elements can be made draggable or animated.

\n

{max_width(30,euk_diagram)}

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

You can easily embed videos.

\n

"}], "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/"}]}