// Numbas version: exam_results_page_options {"name": "Right-triangle trigonometry", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Right-triangle trigonometry", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

The following question refers to this right-angled triangle (not necessarily drawn to scale). The values and functions are randomised, so you should retry this question several times for practice. 

\n

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

", "advice": "

Use the definitions of the appropriate trigonometric functions to find the correct ratios. 

\n

For part (b), you need to know the exact value of the hypotenuse. 

\n

The hypotenuse can be found by using Pythagoras' Theorem: $c^2 = a^2 + b^2$, so here $c = \\sqrt{\\var{a}^2 + \\var{b}^2} = \\var{c}$. 

", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"ind": {"name": "ind", "group": "Ungrouped variables", "definition": "random(2,5)", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(1..m except filter(gcd(m,t)>1,t,1..m))", "description": "", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything"}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "min(k*(m^2-n^2),k*(2*m*n))", "description": "", "templateType": "anything"}, "angleA": {"name": "angleA", "group": "Ungrouped variables", "definition": "arcsin(a/c)/pi*180", "description": "", "templateType": "anything"}, "angleB": {"name": "angleB", "group": "Ungrouped variables", "definition": "arcsin(b/c)/pi*180", "description": "", "templateType": "anything"}, "f": {"name": "f", "group": "Ungrouped variables", "definition": "latex(\"\\\\\"+['sin','cos','tan','csc','sec','cot'][ind])", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "max(k*(m^2-n^2),k*(2*m*n))", "description": "", "templateType": "anything"}, "sol": {"name": "sol", "group": "Ungrouped variables", "definition": "[[a,c],[b,c],[a,b],[c,a],[c,b],[b,a]][ind]", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "k*(m^2+n^2)", "description": "", "templateType": "anything"}, "angleC": {"name": "angleC", "group": "Ungrouped variables", "definition": "90", "description": "", "templateType": "anything"}, "ind2": {"name": "ind2", "group": "Ungrouped variables", "definition": "random(0..5 except [2,5])", "description": "", "templateType": "anything"}, "f2": {"name": "f2", "group": "Ungrouped variables", "definition": "latex(\"\\\\\"+['sin','cos','tan','csc','sec','cot'][ind2])", "description": "", "templateType": "anything"}, "sol2": {"name": "sol2", "group": "Ungrouped variables", "definition": "[[a,c],[b,c],[a,b],[c,a],[c,b],[b,a]][ind2]", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "angleA<>90", "maxRuns": 100}, "ungrouped_variables": ["m", "n", "k", "a", "b", "c", "angleA", "angleB", "angleC", "ind", "f", "sol", "ind2", "f2", "sol2"], "variable_groups": [], "functions": {"plotgraph": {"parameters": [["a", "number"], ["b", "number"], ["c", "number"], ["angleA", "number"], ["angleB", "number"], ["angleC", "number"]], "type": "html", "language": "javascript", "definition": "// This functions plots a triangle based on two angles and a length\n\n//Function to convert angles to radians\nfunction toRadians (angle) {\n return angle * (Math.PI / 180);\n}\n\n//Calculate height of triangle\nvar a0=a;\nvar b0=b;\na=12\nb=9\nc=15\nvar h = b*Math.sin(toRadians(angleC));\n\n//Set text and graph offsets to appear uniform\nvar xOffset = Math.ceil(a/10)\nvar yOffset = Math.ceil(a/2+xOffset-h/2)\n//Consider removing scale once all adjusted correctly\nvar offset = 1;\nvar textHeight =15;\nvar scale = xOffset/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 = a+2*xOffset;\nvar y_min = 0;\nvar y_max = a+2*xOffset;\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 '500px',\n '500px',\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 manipulate elements\nvar board = div.board; \n\n/*\n//Dummy text for testing variables, remove after testing\ntempText = board.create('text',[(xOffset),(h+yOffset),\nfunction () {return 'A is ' + angleA + ' B is ' + angleB + ' C is ' + angleC}]);\ntempText2 = board.create('text',[(xOffset),(yOffset/2),\nfunction () {return 'a is ' + a + ' b is ' + b + ' c is ' + c}]);\n*/\n\n//Draw three points \nvar pA = board.create('point', [(b*Math.cos(toRadians(angleC))+xOffset), (b*Math.sin(toRadians(angleC))+yOffset)], \n//Make fixed:true after testing\n {size:0, fixed:true,\n label:{offset: [0,10]}});\nvar pB = board.create('point', [(a+xOffset), (yOffset)],\n {size:0, fixed:true,\n label:{offset: [10,-10]}});\nvar pC = board.create('point', [(xOffset), (yOffset)],\n {size:0, fixed:true,\n label:{offset: [-10,-10]}});\n\n\n//Draw a line between them\nvar AB = board.create('line',[pA,pB],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar BC = board.create('line',[pC,pB],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar AC = board.create('line',[pC,pA],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\n\n//Draw angle and label\n//Used in other versions of this questions\n/*\nvar ABC = board.create('nonreflexangle', [pA,pB,pC], {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*/\n\nvar CAB = board.create('nonreflexangle', [pC,pA,pB], {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 '\\u03B8' + '\\u00B0';\n } else {\n return '';\n }\n});\nCABLabel.setAttribute({anchorX:'middle'});\n\n\nvar BCA = board.create('nonreflexangle', [pB,pC,pA], {type:'sector', orthoType:'square', orthoSensitivity:0.4, \nradius:function() { return scale;} \n});\nvar BCALabel = BCA.label.setText(function () {\n var angle = 180.0 * BCA.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(0) + '\\u00B0';\n } else {\n return '';\n }\n});\nBCALabel.setAttribute({anchorX:'middle'});\n\n\n//Not used in this version\n/*\ntextAB = board.create('text', \n [function () {return (pA.X() + pB.X())/2},\n function () {return ((pA.Y() + pB.Y())/2)+(scaleOffset/2)},\n function () {return +pA.Dist(pB).toFixed(2) + ' '}],\n {fontSize:15, anchorX:'middle'});\n*/\n\n//Set up dimension labels to be properly aligned\ntextBC = board.create('text', \n [function () {return (pB.X() + pC.X())/2},\n function () {return ((pB.Y() + pC.Y())/2)-scaleOffset},\n function () {return +a0.toFixed(0) + ' '}],\n {fontSize:15, anchorX:'middle'});\n\n\n//Not used in this version\ntextAC = board.create('text', \n [function () {return (pA.X() + pC.X())/2},\n function () {return ((pA.Y() + pC.Y())/2)+(scaleOffset/2)},\n function () {return +b0.toFixed(2) + ' '}],\n {fontSize:15, anchorX:'middle'});\n\n/*\nvar tABRot = board.create('transform', \n [function () {return AB.getAngle()}, \n function () {return (pA.X() + pB.X())/2}, \n function () {return (pA.Y() + pB.Y())/2}],\n {type:'rotate'});\n*/\n\n//Set up rotation transform for label\n\nvar tBCRot = board.create('transform', \n [function () {return BC.getAngle()}, \n function () {return (pB.X() + pC.X())/2}, \n function () {return (pB.Y() + pC.Y())/2}],\n {type:'rotate'});\n\n\n//Hide this for final version\nvar tACRot = board.create('transform', \n [function () {return AC.getAngle()}, \n function () {return (pA.X() + pC.X())/2}, \n function () {return (pA.Y() + pC.Y())/2}],\n {type:'rotate'});\n\n\n//Perform text rotations and update\n//tABRot.bindTo(textAB);\n//Hide this for final version\ntBCRot.bindTo(textBC); \n//Hide this for final version\ntACRot.bindTo(textAC);\nboard.update();\n\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"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, "prompt": "

What is $\\var{f}(\\theta)$? 

", "answer": "{sol[0]}/{sol[1]}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"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, "prompt": "

What is $\\var{f2}(\\theta)$? 

", "answer": "{sol2[0]}/{sol2[1]}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Angharad Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/315/"}, {"name": "Mark Hodds", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/510/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}]}], "contributors": [{"name": "Angharad Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/315/"}, {"name": "Mark Hodds", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/510/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}