// Numbas version: exam_results_page_options {"name": "Trigonometry to Find Missing Length (Right Angled Triangle)", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "

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

", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"unitList": {"definition": "[ \"mm\", \"cm\", \"m\", \"km\" ]", "description": "

Units that are to be used for the question.

", "group": "Ungrouped variables", "templateType": "list of strings", "name": "unitList"}, "units": {"definition": "random(unitList)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "units"}, "c": {"definition": "precround(a*tan(radians(angleB)),5)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "c"}, "b": {"definition": "precround(sqrt(a^2+c^2),2)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "b"}, "angleC": {"definition": "90-angleB", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "angleC"}, "angleB": {"definition": "random(30..60)", "description": "

angle

", "group": "Ungrouped variables", "templateType": "anything", "name": "angleB"}, "a": {"definition": "random(5..50)", "description": "", "group": "Ungrouped variables", "templateType": "anything", "name": "a"}}, "advice": "

Use SOHCAHTOA to relate the sides and angles.

", "ungrouped_variables": ["unitList", "units", "a", "angleB", "c", "b", "angleC"], "name": "Trigonometry to Find Missing Length (Right Angled Triangle)", "rulesets": {}, "preamble": {"css": "", "js": ""}, "tags": [], "variable_groups": [{"variables": [], "name": "Unnamed group"}], "statement": "

Referring to the triangle below.

", "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"type": "gapfill", "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "precision": "2", "scripts": {}, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{c}", "marks": "2", "showFeedbackIcon": true, "mustBeReducedPC": 0, "minValue": "{c}", "mustBeReduced": false, "showCorrectAnswer": true, "precisionType": "dp", "correctAnswerStyle": "plain", "type": "numberentry", "precisionMessage": "You have not given your answer to the correct precision.", "showPrecisionHint": false, "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "precisionPartialCredit": "50"}, {"correctAnswerFraction": false, "precision": "2", "scripts": {}, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{b}", "marks": "2", "showFeedbackIcon": true, "mustBeReducedPC": 0, "minValue": "{b}", "mustBeReduced": false, "showCorrectAnswer": true, "precisionType": "dp", "correctAnswerStyle": "plain", "type": "numberentry", "precisionMessage": "You have not given your answer to the correct precision.", "showPrecisionHint": false, "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "precisionPartialCredit": "50"}, {"correctAnswerFraction": false, "precision": "0", "scripts": {}, "strictPrecision": false, "variableReplacementStrategy": "originalfirst", "maxValue": "{angleC}", "marks": 1, "showFeedbackIcon": true, "mustBeReducedPC": 0, "minValue": "{angleC}", "mustBeReduced": false, "showCorrectAnswer": true, "precisionType": "dp", "correctAnswerStyle": "plain", "type": "numberentry", "precisionMessage": "You have not given your answer to the correct precision.", "showPrecisionHint": false, "variableReplacements": [], "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "precisionPartialCredit": 0}], "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "variableReplacements": [], "scripts": {}, "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}$

"}], "extensions": ["jsxgraph"], "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;", "type": "html", "parameters": [["units", "string"], ["a", "number"], ["b", "number"], ["c", "number"], ["angleB", "number"], ["angleC", "number"]], "language": "javascript"}}, "type": "question", "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}]}], "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "Gareth Woods", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/978/"}]}