// Numbas version: exam_results_page_options {"name": "Trigonometry to Find Missing Length", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Trigonometry to Find Missing Length", "tags": [], "advice": "

Use SOHCAHTOA to relate the sides and angles.

", "ungrouped_variables": ["unitList", "units", "a", "angleB", "c", "b", "angleC"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "variables": {"b": {"templateType": "anything", "name": "b", "definition": "precround(sqrt(a^2+c^2),2)", "description": "", "group": "Ungrouped variables"}, "a": {"templateType": "anything", "name": "a", "definition": "random(5..50)", "description": "", "group": "Ungrouped variables"}, "c": {"templateType": "anything", "name": "c", "definition": "precround(a*tan(radians(angleB)),5)", "description": "", "group": "Ungrouped variables"}, "unitList": {"templateType": "list of strings", "name": "unitList", "definition": "[ \"mm\", \"cm\", \"m\", \"km\" ]", "description": "

Units that are to be used for the question.

", "group": "Ungrouped variables"}, "angleC": {"templateType": "anything", "name": "angleC", "definition": "90-angleB", "description": "", "group": "Ungrouped variables"}, "units": {"templateType": "anything", "name": "units", "definition": "random(unitList)", "description": "", "group": "Ungrouped variables"}, "angleB": {"templateType": "anything", "name": "angleB", "definition": "random(30..60)", "description": "

angle

", "group": "Ungrouped variables"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Draws a right angled triangle based on a length and an angle.

"}, "parts": [{"prompt": "

{plotgraph(units,a,b,c,angleB,angleC)}

\n

What is the length of sides AC and BC?

\n

Please give answer to 2 decimal places

\n

AC = [[0]] {units}

\n

BC = [[1]] {units}

\n

What is angle C?

\n

Please give answer to nearest whole degree

\n

C = [[2]] $^{\\circ}$

", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"precision": "2", "mustBeReduced": false, "maxValue": "{c}", "scripts": {}, "marks": "2", "correctAnswerFraction": false, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "minValue": "{c}", "type": "numberentry", "strictPrecision": false, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showPrecisionHint": false, "precisionPartialCredit": "50", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"]}, {"precision": "2", "mustBeReduced": false, "maxValue": "{b}", "scripts": {}, "marks": "2", "correctAnswerFraction": false, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "minValue": "{b}", "type": "numberentry", "strictPrecision": false, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showPrecisionHint": false, "precisionPartialCredit": "50", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"]}, {"precision": "0", "mustBeReduced": false, "maxValue": "{angleC}", "scripts": {}, "marks": 1, "correctAnswerFraction": false, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "minValue": "{angleC}", "type": "numberentry", "strictPrecision": false, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showPrecisionHint": false, "precisionPartialCredit": 0, "correctAnswerStyle": "plain", "showFeedbackIcon": true, "precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"]}], "type": "gapfill", "variableReplacements": []}], "functions": {"plotgraph": {"definition": "// This functions plots a right angled triangle based on a length and an angle\n\n//Set text and graph offsets to appear uniform\nvar yOffset = Math.ceil(a/10);\nvar xOffset = Math.ceil(a+2*yOffset-c/2)\n//Consider removing scale once all adjusted correctly\nvar offset = 1;\nvar textHeight =15;\nvar scale = yOffset/2;\nvar scaleOffset = offset*scale;\nvar scaleText = textHeight*scale;\n// This functions plots two dimensioned lines \n// Max and min x and y values for the axis.\nvar x_min = 0;\nvar x_max = 2*(a+2*yOffset);\nvar y_min = 0;\nvar y_max = a+2*yOffset;\n\n//Browser compatibility\nJXG.Options.text.display = 'internal';\n//Use MathJax for LaTeX display\nJXG.Options.text.useMathJax = true;\n\n// Make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '800px',\n '400px',\n {\n boundingBox: [0,y_max,x_max,0],\n//Change to false after testing\n axis: false,\n }\n);\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n//Draw three points \nvar A = board.create('point', [(c+xOffset), (a+yOffset)], \n {size:0, fixed:true,\n label:{offset: [10,10]}});\nvar B = board.create('point', [(c+xOffset), (yOffset)],\n {size:0, fixed:true,\n label:{offset: [10,-10]}});\nvar C = board.create('point', [(xOffset), (a+yOffset)],\n//Make fixed:true after testing\n {size:0, fixed:false,\n label:{offset: [-15,0]}});\n\n//Draw a line between them\nvar AB = board.create('line',[A,B],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar BC = board.create('line',[C,B],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar AC = board.create('line',[C,A],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\n\n//Draw angle and label\n\n//Used in other versions of this questions\nvar ABC = board.create('nonreflexangle', [A,B,C], {type:'sector', orthoType:'square', orthoSensitivity:0.4, \nradius:function() { return scale;}\n });\nvar ABCLabel = ABC.label.setText(function () {\n var angle = 180.0 * ABC.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(0) + '\\u00B0';\n } else {\n return '';\n }\n});\nABCLabel.setAttribute({anchorX:'middle'});\n\nvar CAB = board.create('nonreflexangle', [C,A,B], {type:'sector', orthoType:'square', orthoSensitivity:0.4, \nradius:function() { return scale;} \n});\nvar CABLabel = CAB.label.setText(function () {\n var angle = 180.0 * CAB.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(1) + '\\u00B0';\n } else {\n return '';\n }\n});\nCABLabel.setAttribute({anchorX:'middle'});\n\n/*\n//Dummy text for testing variables, remove after testing\ntempText = board.create('text',[(yOffset),(yOffset),\n// function () {return 'ABC = ' +(180.0*ABC.Value()/Math.PI).toFixed(2)+ ' degreeSymbol'}]);\nfunction () {return 'yOffset is ' + yOffset}]);\n*/\n\n//Set up dimension labels to be properly aligned\ntextAB = board.create('text', \n [function () {return (A.X() + B.X())/2},\n function () {return ((A.Y() + B.Y())/2)+(scaleOffset/2)},\n function () {return +A.Dist(B).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n\n/*\n//Hide this for final version\ntextBC = board.create('text', \n [function () {return (B.X() + C.X())/2},\n function () {return ((B.Y() + C.Y())/2)-scaleOffset},\n function () {return +B.Dist(C).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n\n//Hide this for final version\ntextAC = board.create('text', \n [function () {return (A.X() + C.X())/2},\n function () {return ((A.Y() + C.Y())/2)+(scaleOffset/2)},\n function () {return +A.Dist(C).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n*/\n\nvar tABRot = board.create('transform', \n [function () {return AB.getAngle()}, \n function () {return (A.X() + B.X())/2}, \n function () {return (A.Y() + B.Y())/2}],\n {type:'rotate'});\n\n/*\n//Hide this for final version\nvar tBCRot = board.create('transform', \n [function () {return BC.getAngle()}, \n function () {return (B.X() + C.X())/2}, \n function () {return (B.Y() + C.Y())/2}],\n {type:'rotate'});\n\n//Hide this for final version\nvar tACRot = board.create('transform', \n [function () {return AC.getAngle()}, \n function () {return (A.X() + C.X())/2}, \n function () {return (A.Y() + C.Y())/2}],\n {type:'rotate'});\n*/\n\n//Perform text rotations and update\ntABRot.bindTo(textAB);\n//Hide this for final version\n//tBCRot.bindTo(textBC); \n//Hide this for final version\n//tACRot.bindTo(textAC);\nboard.update();\n\nreturn div;", "language": "javascript", "type": "html", "parameters": [["units", "string"], ["a", "number"], ["b", "number"], ["c", "number"], ["angleB", "number"], ["angleC", "number"]]}}, "extensions": ["jsxgraph"], "variable_groups": [{"name": "Unnamed group", "variables": []}], "statement": "

Referring to the triangle below.

", "type": "question", "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}]}], "contributors": [{"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}