// Numbas version: exam_results_page_options {"name": "Maria's copy of Meetu's copy of Michael's copy of Trigonometry Q1", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"variableReplacementStrategy": "originalfirst", "useCustomName": false, "scripts": {}, "prompt": "

Calculate, to the nearest kilometre, the distance between towns W and Y

\n

WY = [[0]] km

", "showCorrectAnswer": true, "type": "gapfill", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "gaps": [{"useCustomName": false, "correctAnswerStyle": "plain", "precisionType": "dp", "maxValue": "{WY}", "extendBaseMarkingAlgorithm": true, "showPrecisionHint": false, "strictPrecision": false, "precision": "0", "variableReplacements": [], "mustBeReducedPC": 0, "allowFractions": false, "minValue": "{WY}", "variableReplacementStrategy": "originalfirst", "scripts": {}, "unitTests": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "precisionPartialCredit": "50", "customMarkingAlgorithm": "", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "customName": "", "marks": "1"}], "showFeedbackIcon": true, "unitTests": [], "variableReplacements": [], "marks": 0, "customName": "", "sortAnswers": false}, {"variableReplacementStrategy": "originalfirst", "useCustomName": false, "scripts": {}, "prompt": "

Calculate, to the nearest degree, the size of the angle marked $\\theta$.

\n

$\\theta$ = [[0]] $^\\circ$

", "showCorrectAnswer": true, "type": "gapfill", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "gaps": [{"useCustomName": false, "correctAnswerStyle": "plain", "precisionType": "dp", "maxValue": "{theta}", "extendBaseMarkingAlgorithm": true, "showPrecisionHint": false, "strictPrecision": false, "precision": 0, "variableReplacements": [{"part": "p0g0", "must_go_first": true, "variable": "WY"}], "mustBeReducedPC": 0, "allowFractions": false, "minValue": "{theta}", "variableReplacementStrategy": "originalfirst", "scripts": {}, "unitTests": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "precisionPartialCredit": "50", "customMarkingAlgorithm": "", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "customName": "", "marks": 1}], "showFeedbackIcon": true, "unitTests": [], "variableReplacements": [], "marks": 0, "customName": "", "sortAnswers": false}, {"variableReplacementStrategy": "originalfirst", "useCustomName": false, "scripts": {}, "prompt": "

Calculate to the nearest kilometre, the distance between towns Y and Z.

\n

YZ = [[0]] km

", "showCorrectAnswer": true, "type": "gapfill", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "gaps": [{"useCustomName": false, "correctAnswerStyle": "en", "precisionType": "dp", "maxValue": "{YZ}", "extendBaseMarkingAlgorithm": true, "showPrecisionHint": false, "strictPrecision": false, "precision": 0, "variableReplacements": [{"part": "p0g0", "must_go_first": true, "variable": "WY"}], "mustBeReducedPC": 0, "allowFractions": false, "minValue": "{YZ}", "variableReplacementStrategy": "originalfirst", "scripts": {}, "unitTests": [], "correctAnswerFraction": false, "showCorrectAnswer": true, "type": "numberentry", "precisionPartialCredit": "50", "customMarkingAlgorithm": "", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "notationStyles": ["en", "si-en"], "mustBeReduced": false, "customName": "", "marks": 1}], "showFeedbackIcon": true, "unitTests": [], "variableReplacements": [], "marks": 0, "customName": "", "sortAnswers": false}], "variable_groups": [{"variables": [], "name": "Unnamed group"}], "tags": [], "ungrouped_variables": ["WXY", "XYW", "XWY", "WX", "XY", "fixed_WY", "WY", "WZmin", "WZmax", "WZ", "YZ", "theta"], "advice": "

Avoid using rounded values in calculations and just round for the final answer.

", "name": "Maria's copy of Meetu's copy of Michael's copy of Trigonometry Q1", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Draws a triangle based on 3 side lengths.

"}, "rulesets": {}, "preamble": {"js": "", "css": ""}, "statement": "

The figure below shows the position of four towns marked on a map.

\n

{plotgraph(WY,WX,XY,WZ,WXY,XYW,XWY,theta)}

", "variablesTest": {"maxRuns": "200", "condition": "WX-XY<>0 &&\nWY-XY>0"}, "variables": {"WZ": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WZ", "definition": "random(WZmin..WZmax)"}, "XY": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "XY", "definition": "WX/(tan(radians(XYW)))"}, "WZmin": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WZmin", "definition": "floor(fixed_WY/2)"}, "WXY": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WXY", "definition": "90\n"}, "theta": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "theta", "definition": "degrees(arccos(WZ/WY))"}, "XWY": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "XWY", "definition": "180-(WXY + XYW)"}, "YZ": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "YZ", "definition": "sqrt(WY^2-WZ^2)"}, "WX": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WX", "definition": "random(5..50)"}, "XYW": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "XYW", "definition": ""}, "WY": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WY", "definition": "fixed_WY"}, "WZmax": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "WZmax", "definition": "ceil(fixed_WY*sqrt(0.75))"}, "fixed_WY": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "name": "fixed_WY", "definition": "sqrt(WX^2+XY^2)"}}, "extensions": ["jsxgraph"], "functions": {"plotgraph": {"definition": "// This functions plots a triangle based on three lengths\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 hX = WX*Math.sin(toRadians(XWY))\nvar hZ = WZ*math.sin(toRadians(theta))\nvar h = Math.max(hX, hZ);\n\n//Set text and graph offsets to appear uniform\nvar xOffset = Math.ceil(WY/10)\nvar yOffset = Math.ceil(WY/2+xOffset-(hX+hZ)/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 = WY+2*xOffset;\nvar y_max = x_max/2;\nvar y_min = -y_max;\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,y_min],\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//Draw three points \nvar pX = board.create('point', [(WX*Math.cos(toRadians(XWY))+xOffset), (WX*Math.sin(toRadians(XWY)))], \n {size:0, fixed:true, name:'X',\n label:{offset: [-5,10]}});\nvar pY = board.create('point', [(WY+xOffset), (0)],\n {size:0, fixed:true, name:'Y',\n label:{offset: [20,0]}});\nvar pW = board.create('point', [(xOffset), (0)],\n {size:0, fixed:true, name:'W',\n label:{offset: [-20,0]}});\nvar pZ = board.create('point', [(WZ*Math.cos(toRadians(theta))+xOffset), (-WZ*Math.sin(toRadians(theta)))],\n {size:0, fixed:true, name:'Z',\n label:{offset: [-5,-20]}});\n\n//Dummy text for testing variables, remove after testing\n//tempText = board.create('text',[(xOffset),(hX+yOffset),\n//function () {return 'hX is ' + hX.toFixed(2) + ' hZ is ' + hZ.toFixed(2) + ' h is ' + h.toFixed(2) + ' x_max is ' + x_max.toFixed(2) + ' y_max is ' + y_max.toFixed(2)}]);\n//tempText = board.create('text',[(xOffset),(hX+yOffset/2),\n//function () {return 'Theta is ' + theta.toFixed(2)}]);\n//tempText2 = board.create('text',[(xOffset),(-hZ-yOffset/2),\n//function () {return 'WY is ' + WY.toFixed(2) + ' ZY is ' + +pY.Dist(pZ).toFixed(2)}]);\n\n//Draw a line between them\nvar lXY = board.create('line',[pX,pY],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar lWY = board.create('line',[pW,pY],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar lWX = board.create('line',[pW,pX],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar lWZ = board.create('line',[pW,pZ],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar lZY = board.create('line',[pZ,pY],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\n\n//Draw angles\nvar angleXYW = board.create('nonreflexangle', [pX,pY,pW], {type:'sector', orthoType:'square', orthoSensitivity:0.4, \nradius:function() { return scale;}\n });\nvar angleWXY = board.create('nonreflexangle', [pW,pX,pY], {type:'sector', orthoType:'square', orthoSensitivity:0.4,\nradius:function() { return scale;} \n});\n/*\nvar angleXWY = board.create('nonreflexangle', [pY,pW,pX], {type:'sector', orthoType:'square', orthoSensitivity:0.4,\nradius:function() { return scale;} \n});\n*/\nvar angleYWZ = board.create('nonreflexangle', [pY,pW,pZ], {type:'sector', orthoType:'square', orthoSensitivity:0.4,\nradius:function() { return scale;} \n});\n\nvar angleWZY = board.create('nonreflexangle', [pW,pZ,pY], {type:'sector', orthoType:'square', orthoSensitivity:0.4,\nradius:function() { return scale;} \n});\n\n\n//Blank out label for this version\nangleXYW.label.setText('');\nangleWXY.label.setText('');\n//angleXWY.label.setText('');\nangleYWZ.label.setText('\\u03B8');\nangleWZY.label.setText('');\n\nvar XYWLabel = angleXYW.label.setText(function () {\n var angle = 180.0 * angleXYW.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(0) + '\\u00B0';\n } else {\n return '';\n }\n});\nXYWLabel.setAttribute({anchorX:'middle'});\n\n/* Angle labels used for testing\nvar WXYLabel = angleWXY.label.setText(function () {\n var angle = 180.0 * angleWXY.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(2) + '\\u00B0';\n } else {\n return '';\n }\n});\nWXYLabel.setAttribute({anchorX:'middle'});\n\nvar XWYLabel = angleXWY.label.setText(function () {\n var angle = 180.0 * angleXWY.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(2) + '\\u00B0';\n } else {\n return '';\n }\n});\nXWYLabel.setAttribute({anchorX:'middle'});\n*/\n\n//Set up dimension labels to be properly aligned\n/*\ntextXY = board.create('text', \n [function () {return (pX.X() + pY.X())/2},\n function () {return ((pX.Y() + pY.Y())/2)+(scaleOffset/2)},\n function () {return +pX.Dist(pY).toFixed(2) + 'km'}],\n {fontSize:15, anchorX:'middle'});\n*/\n\ntextWY = board.create('text', \n [function () {return (pY.X() + pW.X())/2},\n function () {return ((pY.Y() + pW.Y())/2)-scaleOffset/2},\n function () {return '? km'}],\n {fontSize:15, anchorX:'middle'});\n\ntextWX = board.create('text', \n [function () {return (pX.X() + pW.X())/2},\n function () {return ((pX.Y() + pW.Y())/2)+(scaleOffset/2)},\n function () {return +pX.Dist(pW).toFixed(2) + 'km'}],\n {fontSize:15, anchorX:'middle'});\n\ntextWZ = board.create('text', \n [function () {return (pW.X() + pZ.X())/2},\n function () {return ((pZ.Y())/2)+(scaleOffset/2)},\n function () {return +pW.Dist(pZ).toFixed(2) + 'km'}],\n {fontSize:15, anchorX:'middle'});\n\ntextZY = board.create('text', \n [function () {return (pY.X() + pZ.X())/2},\n function () {return ((pZ.Y())/2)+(scaleOffset/2)},\n function () {return '? km'}],\n {fontSize:15, anchorX:'middle'});\n\n//Set up transform for rotating dimension labels\n/*\nvar tXYRot = board.create('transform', \n [function () {return lXY.getAngle()}, \n function () {return (pX.X() + pY.X())/2}, \n function () {return (pX.Y() + pY.Y())/2}],\n {type:'rotate'});\n*/\n\nvar tWYRot = board.create('transform', \n [function () {return lWY.getAngle()}, \n function () {return (pY.X() + pW.X())/2}, \n function () {return (pY.Y() + pW.Y())/2}],\n {type:'rotate'});\n\nvar tWXRot = board.create('transform', \n [function () {return lWX.getAngle()}, \n function () {return (pX.X() + pW.X())/2}, \n function () {return (pX.Y() + pW.Y())/2}],\n {type:'rotate'});\n\nvar tWZRot = board.create('transform', \n [function () {return lWZ.getAngle()}, \n function () {return (pW.X() + pZ.X())/2}, \n function () {return (pZ.Y())/2}],\n {type:'rotate'});\n\nvar tZYRot = board.create('transform', \n [function () {return lZY.getAngle()}, \n function () {return (pY.X() + pZ.X())/2}, \n function () {return (pZ.Y())/2}],\n {type:'rotate'});\n\n//Perform text rotations and update\n//tXYRot.bindTo(textXY);\ntWYRot.bindTo(textWY); \ntWXRot.bindTo(textWX);\ntWZRot.bindTo(textWZ);\ntZYRot.bindTo(textZY);\nboard.update();\n\nreturn div;", "type": "html", "parameters": [["WY", "number"], ["WX", "number"], ["XY", "number"], ["WZ", "number"], ["WXY", "number"], ["XYW", "number"], ["XWY", "number"], ["theta", "number"]], "language": "javascript"}}, "type": "question", "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}, {"name": "Meetu Chhabra", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3398/"}]}]}], "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}, {"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}, {"name": "Meetu Chhabra", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3398/"}]}