// Numbas version: finer_feedback_settings {"name": "Triangle in a grid", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"edge": {"definition": "\n var c = document.createElement('canvas');\n $(c).attr('width',300).attr('height',250);\n var context = c.getContext('2d');\n\n\nfunction canvas_edge(context, fromx, fromy, tox, toy, name){\n var dx = tox-fromx;\n var dy = toy-fromy;\n context.strokeStyle=\"#00F\";\n context.fillStyle=\"#00F\";\n context.font = '16px sans-serif';\n context.fillText(name,fromx, fromy);\n context.moveTo(fromx, fromy);\n context.lineTo(tox, toy);\n}\n\n\n context.beginPath();\n context.moveTo(0, 0); context.lineTo(300, 0); context.stroke();\n context.moveTo(0, 25); context.lineTo(300, 25); context.stroke();\n context.moveTo(0, 50); context.lineTo(300, 50); context.stroke();\n context.moveTo(0, 75); context.lineTo(300, 75); context.stroke();\n context.moveTo(0, 100); context.lineTo(300, 100); context.stroke();\n context.moveTo(0, 125); context.lineTo(300, 125); context.stroke();\n context.moveTo(0, 150); context.lineTo(300, 150); context.stroke();\n context.moveTo(0, 175); context.lineTo(300, 175); context.stroke();\n context.moveTo(0, 200); context.lineTo(300, 200); context.stroke();\n context.moveTo(0, 225); context.lineTo(300, 225); context.stroke();\n context.moveTo(0, 250); context.lineTo(300, 250); context.stroke();\n\n context.moveTo(0, 0); context.lineTo(0, 250); context.stroke();\n context.moveTo(25, 0); context.lineTo(25, 250); context.stroke(); \n context.moveTo(50, 0); context.lineTo(50, 250); context.stroke(); \n context.moveTo(75, 0); context.lineTo(75, 250); context.stroke();\n context.moveTo(100, 0); context.lineTo(100, 250); context.stroke();\n context.moveTo(125, 0); context.lineTo(125, 250); context.stroke(); \n context.moveTo(150, 0); context.lineTo(150, 250); context.stroke(); \n context.moveTo(175, 0); context.lineTo(175, 250); context.stroke();\n context.moveTo(200, 0); context.lineTo(200, 250); context.stroke();\n context.moveTo(225, 0); context.lineTo(225, 250); context.stroke(); \n context.moveTo(250, 0); context.lineTo(250, 250); context.stroke(); \n context.moveTo(275, 0); context.lineTo(275, 250); context.stroke();\n context.moveTo(300, 0); context.lineTo(300, 250); context.stroke();\n \ncontext.beginPath(); canvas_edge(context, ax, ay, bx, by, 'A'); context.stroke();\ncontext.beginPath(); canvas_edge(context, bx, by, cx, cy, 'B'); context.stroke();\ncontext.beginPath(); canvas_edge(context, cx, cy, ax, ay, 'C'); context.stroke();\n\n \n \n \n return c;", "type": "html", "language": "javascript", "parameters": [["ax", "number"], ["ay", "number"], ["bx", "number"], ["by", "number"], ["cx", "number"], ["cy", "number"]]}}, "ungrouped_variables": ["cy", "by", "cx", "ax", "bx", "ay", "bc", "ab", "ac", "omkrets", "v2", "v1", "vinkelC", "vinkelB", "vinkelA", "areal"], "name": "Triangle in a grid", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "
Sidelengder:
Bruk rutenettet og finn x- og y-komponentene for sidene. Beregn sidelengder med Pytagoras setning.
Areal:
Bruk Herons formel.
Vinkler:
Bruk arealsetningen A =1/2*AB*AC*sin(vinkelA)
Beregn trekantens omkrets:
", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "omkrets", "strictPrecision": true, "minValue": "omkrets", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "4", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "sigfig", "prompt": "Beregn trekantens areal:
", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "areal", "strictPrecision": true, "minValue": "areal", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "4", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"prompt": "Beregn trekantens vinkler,
\nVinkel A = [[0]] , Vinkel B = [[1]] , Vinkel C = [[2]]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"precisionType": "sigfig", "precisionMessage": "You have not given your answer to the correct precision.
", "allowFractions": false, "variableReplacements": [], "maxValue": "vinkelA", "strictPrecision": true, "minValue": "vinkelA", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "4", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "vinkelB", "minValue": "vinkelB", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "sigfig", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "maxValue": "vinkelC", "strictPrecision": true, "minValue": "vinkelC", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "4", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": [], "statement": "Trekanten ABC er tegnet inn i rutearket.
\n{edge(ax,ay, bx, by, cx, cy)}
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"areal": {"definition": "ab*ac*sin(vinkelA*pi/180)/2", "templateType": "anything", "group": "Ungrouped variables", "name": "areal", "description": ""}, "ac": {"definition": "sqrt((ax-cx)^2+(ay-cy)^2)/25", "templateType": "anything", "group": "Ungrouped variables", "name": "ac", "description": ""}, "ab": {"definition": "sqrt((ax-bx)^2+(ay-by)^2)/25", "templateType": "anything", "group": "Ungrouped variables", "name": "ab", "description": ""}, "bc": {"definition": "sqrt((bx-cx)^2+(by-cy)^2)/25", "templateType": "anything", "group": "Ungrouped variables", "name": "bc", "description": ""}, "v2": {"definition": "arctan((bx-cx)/(by-cy))", "templateType": "anything", "group": "Ungrouped variables", "name": "v2", "description": ""}, "by": {"definition": "random([175, 200, 225] except ay)", "templateType": "anything", "group": "Ungrouped variables", "name": "by", "description": ""}, "v1": {"definition": "arctan((ax-cx)/(cy-ay))", "templateType": "anything", "group": "Ungrouped variables", "name": "v1", "description": ""}, "cy": {"definition": "random(25, 50, 75, 100)", "templateType": "anything", "group": "Ungrouped variables", "name": "cy", "description": ""}, "cx": {"definition": "random(125, 150, 175, 200)", "templateType": "anything", "group": "Ungrouped variables", "name": "cx", "description": ""}, "omkrets": {"definition": "ab+bc+ac", "templateType": "anything", "group": "Ungrouped variables", "name": "omkrets", "description": ""}, "ay": {"definition": "random(125, 150, 175, 200, 225)", "templateType": "anything", "group": "Ungrouped variables", "name": "ay", "description": ""}, "ax": {"definition": "random(25, 50, 75, 100)", "templateType": "anything", "group": "Ungrouped variables", "name": "ax", "description": ""}, "bx": {"definition": "random(175, 200, 225, 250, 275)", "templateType": "anything", "group": "Ungrouped variables", "name": "bx", "description": ""}, "vinkelA": {"definition": "180-vinkelB-vinkelC", "templateType": "anything", "group": "Ungrouped variables", "name": "vinkelA", "description": ""}, "vinkelB": {"definition": "arcsin(ac*sin(vinkelC*pi/180)/ab)*180/pi", "templateType": "anything", "group": "Ungrouped variables", "name": "vinkelB", "description": ""}, "vinkelC": {"definition": "(v1+v2)*180/pi", "templateType": "anything", "group": "Ungrouped variables", "name": "vinkelC", "description": ""}}, "metadata": {"description": "The javascript function edge(...)
draws the edges of a triangle