// Numbas version: exam_results_page_options {"name": "bearing triangle - find a distance", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "bearing triangle - find a distance", "tags": [], "metadata": {"description": "
Students are given the bearings and distances of 2 consecutive straight line walks. They are asked to find the distance from the starting point to the endpoint. They are given a diagram to assist them.
\nThe bearings and distances are randomised (any bearing, distances between 1.1 and 5.). Bearings can be given as either compass bearings or true bearings.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "A group of people walk along a bearing {bearing1} for a distance of {w1} {units} to point F.
\nThey then walk along a bearing {bearing2} for a distance of {w2} {units} to point G.
\n{geogebra_applet('https://www.geogebra.org/m/szvpe7e2',defs)}
", "advice": "Let's call the starting point S. Connecting G back to S creates a triangle, SFG.
\nWe know the lengths of SF and FG. If we can work out the size of $\\angle SFG$ then we can use the cosine rule to find the length of GS.
\nWe can use geometry to work out that $\\angle SFG = \\var{included_angle}$°
\nThen the cosine rule states that
\n$c^2 = a^2 + b^2 - 2ab\\cos(C)$, so
\n$ c = \\sqrt{a^2 + b^2 - 2ab\\cos(C)}$
\nHence
\n$GS=\\sqrt{\\var{w1}^2+\\var{w2}^2-2\\times\\var{w1}\\times\\var{w2}\\times\\cos(\\var{included_angle})}°=\\var{length}$ {units}
", "rulesets": {}, "extensions": ["geogebra"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"defs": {"name": "defs", "group": "geogebra vars", "definition": "[\n ['w1',w1],['w2',w2],['a1',a1],['a2',a2]\n ]", "description": "", "templateType": "anything", "can_override": false}, "w1": {"name": "w1", "group": "geogebra vars", "definition": "decimal(random(10..50)/10)", "description": "the length of the first walk
", "templateType": "anything", "can_override": false}, "w2": {"name": "w2", "group": "geogebra vars", "definition": "decimal(random(10..50)/10)", "description": "the length of the second walk
", "templateType": "anything", "can_override": false}, "a1": {"name": "a1", "group": "geogebra vars", "definition": "random(-90..269)", "description": "the first angle, rotated clockwise from the +x-axis
", "templateType": "anything", "can_override": false}, "a2": {"name": "a2", "group": "geogebra vars", "definition": "random(-90..269)", "description": "the second angle, rotated clockwise from the +x-axis
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "options", "definition": "random('m','km')", "description": "", "templateType": "anything", "can_override": false}, "compass_bearing": {"name": "compass_bearing", "group": "options", "definition": "random(0,1)", "description": "0 = compass bearing
\n1 = true bearing
", "templateType": "anything", "can_override": false}, "a1_true": {"name": "a1_true", "group": "calculations", "definition": "mod(a1+90,360)", "description": "a1 true bearing
", "templateType": "anything", "can_override": false}, "a2_true": {"name": "a2_true", "group": "calculations", "definition": "mod(a2+90,360)", "description": "a2 true bearing
", "templateType": "anything", "can_override": false}, "a1_compass": {"name": "a1_compass", "group": "calculations", "definition": "switch(a1_true=0,\"N\",\n 0a1 as a true bearing in a string
", "templateType": "anything", "can_override": false}, "a2_true_string": {"name": "a2_true_string", "group": "calculations", "definition": "lpad(string(a2_true)+\"\u00b0\",4,\"0\")", "description": "a2 as a true bearing string
", "templateType": "anything", "can_override": false}, "bearing1": {"name": "bearing1", "group": "display vars", "definition": "if(compass_bearing=0,a1_compass,a1_true_string)", "description": "angle 1 display version
", "templateType": "anything", "can_override": false}, "bearing2": {"name": "bearing2", "group": "display vars", "definition": "if(compass_bearing=0,a2_compass,a2_true_string)", "description": "angle 2 display version
", "templateType": "anything", "can_override": false}, "included_angle": {"name": "included_angle", "group": "calculations", "definition": "switch(a1_true=a2_true,180,\n (a1_true<=180 and a2_true<=180) or (a1_true>=180 and a2_true>=180),180-abs(a2_true-a1_true),\n (a1_true<=180 and a2_true>=180),if(180+a1_trueIf b1 <= 180 and b2 > 180 then
\nif 180 + b1 < b2 then included_angle = -180 - b1 + b2
\nif 180 + b1 > b2 then included_angle = 180 - b2 + b1
\nIf b1 >=180 and b2 < 180 then
\nif b1-180 < b2 then included_angle = 180 + b2 - b1
\nif b1 - 180 > b2 then included_angle = -180 - b2 + b1
", "templateType": "anything", "can_override": false}, "length": {"name": "length", "group": "calculations", "definition": "if(a1_true=a2_true,w1+w2,if(max(a1_true,a2_true)-180=min(a1_true,a2_true),abs(w1-w2),precround(cosrule_side(w1,w2,radians(included_angle)),1)))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "geogebra vars", "variables": ["w1", "w2", "a1", "a2", "defs"]}, {"name": "options", "variables": ["units", "compass_bearing"]}, {"name": "display vars", "variables": ["bearing1", "bearing2"]}, {"name": "calculations", "variables": ["a1_true", "a2_true", "a1_compass", "a2_compass", "a1_true_string", "a2_true_string", "included_angle", "length"]}], "functions": {"cosrule_side": {"parameters": [["a", "number"], ["b", "number"], ["C", "number"]], "type": "number", "language": "javascript", "definition": "tmp=Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(C);\ntmp2 = Math.sqrt(tmp);\nreturn tmp2;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "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": "From their endpoint at G, many {units} are they from their starting point in a straight line?
\nGive your answer rounded to 1 decimal place.
", "minValue": "length-0.1", "maxValue": "length+0.1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}]}], "contributors": [{"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}