// Numbas version: exam_results_page_options {"name": "bearing triangle - find a bearing", "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 bearing", "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": "*** This is a challenge question! ***
\nA 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)}
\n", "advice": "Let's call the starting point $S$. Connecting $G$ back to $S$ creates a triangle, $\\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 value of $\\angle FSG$.
\nWe could also use the sine rule, but we would additionally need to check whether or not $\\angle FSG$ was obtuse as the sine rule will always give us an acute angle value. Both methods will work, but we will use the cos rule here.
\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}
\nThen, by the cos rule:
\n$\\angle FSG = \\frac{SG^2 + SF^2 - FG^2}{2 \\times SG \\times SF}$
\n$\\angle FSG = \\frac{\\var{length}^2+\\var{w1}^2-\\var{w2}^2}{2 \\times \\var{length} \\times \\var{w1}} = \\var{angleFSG}$
\nWe can see that (the bearing from $S$ to $G$) = (the bearing from $S$ to $F$) {sign} $\\angle FSG = \\var{a1_true} \\var{sign} \\var{angleFSG} = \\var{StoG_true}$
\nBut we need the bearing from $G$ to $S = \\var{StoG_true} + 180°$. If this is greater than $360°$, then we need to subtract $360°$ from the answer.
\nSo the true bearing from $G$ to $S$ is $\\var{GtoS_true}$.
\n\nWe are asked to give the bearing as a compass bearing. This is $\\var{answer}$.
\n\n", "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}, "q_no": {"name": "q_no", "group": "options", "definition": "random(0..1)", "description": "", "templateType": "anything", "can_override": false}, "questions": {"name": "questions", "group": "options", "definition": "[ \"What is the bearing from the starting point to the people?\",\n \"What is the bearing from the people to the starting point?\"]", "description": "", "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": "precround(cosrule_side(w1,w2,radians(included_angle)),1)", "description": "", "templateType": "anything", "can_override": false}, "side_SG": {"name": "side_SG", "group": "calculations", "definition": "cosrule_side(w1,w2,radians(included_angle))", "description": "", "templateType": "anything", "can_override": false}, "angleFSG": {"name": "angleFSG", "group": "calculations", "definition": "round(degrees(cosrule_angle(w1,side_SG,w2)))", "description": "", "templateType": "anything", "can_override": false}, "angleFGS": {"name": "angleFGS", "group": "calculations", "definition": "round(degrees(cosrule_angle(w2,side_SG,w1)))", "description": "", "templateType": "anything", "can_override": false}, "bearing_StoG": {"name": "bearing_StoG", "group": "calculations", "definition": "switch(\n b1=b2,\n b1,\n max(b1,b2)-180 = min(b1,b2),\n if(w1>w2,b1,b2),\n (b1<=180 and b2<=180) or (b1 > 180 and b2 > 180),\n if(b1>b2,b1-angleFSG,b1+angleFSG),\n (b1 <= 180 and b2 > 180) and (b1 +180 > b2),\n mod(b1 + angleFSG,360),\n (b1 <= 180 and b2 > 180) and (b1 +180 < b2),\n mod(b1 - angleFSG,360),\n (b1 > 180 and b2 <= 180) and (b1 < b2 + 180),\n mod(b1 - angleFSG,360),\n (b1 > 180 and b2 <= 180) and (b1 > b2 + 180),\n mod(b1 + angleFSG,360),\n 0\n)", "description": "", "templateType": "anything", "can_override": false}, "bearing_GtoS": {"name": "bearing_GtoS", "group": "calculations", "definition": "mod(bearing_StoG+180,360)", "description": "", "templateType": "anything", "can_override": false}, "StoG_compass": {"name": "StoG_compass", "group": "calculations", "definition": "true2compass(bearing_StoG)", "description": "", "templateType": "anything", "can_override": false}, "GtoS_compass": {"name": "GtoS_compass", "group": "calculations", "definition": "true2compass(bearing_GtoS)", "description": "", "templateType": "anything", "can_override": false}, "StoG_true": {"name": "StoG_true", "group": "calculations", "definition": "string(bearing_StoG)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "GtoS_true": {"name": "GtoS_true", "group": "calculations", "definition": "string(bearing_GtoS)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "answers": {"name": "answers", "group": "answers", "definition": "[[StoG_true, StoG_compass],[GtoS_true, GtoS_compass]]", "description": "", "templateType": "anything", "can_override": false}, "answer": {"name": "answer", "group": "display vars", "definition": "answers[q_no][compass_bearing]", "description": "", "templateType": "anything", "can_override": false}, "answer_min": {"name": "answer_min", "group": "display vars", "definition": "answers_min[q_no][compass_bearing]", "description": "", "templateType": "anything", "can_override": false}, "answer_max": {"name": "answer_max", "group": "display vars", "definition": "answers_max[q_no][compass_bearing]", "description": "", "templateType": "anything", "can_override": false}, "answers_min": {"name": "answers_min", "group": "answers", "definition": "[[StoG_true_min, StoG_compass_min],[GtoS_true_min, GtoS_compass_min]]", "description": "", "templateType": "anything", "can_override": false}, "answers_max": {"name": "answers_max", "group": "answers", "definition": "[[StoG_true_max, StoG_compass_max],[GtoS_true_max, GtoS_compass_max]]", "description": "", "templateType": "anything", "can_override": false}, "StoG_compass_min": {"name": "StoG_compass_min", "group": "answers", "definition": "true2compass(bearing_StoG-1)", "description": "", "templateType": "anything", "can_override": false}, "StoG_compass_max": {"name": "StoG_compass_max", "group": "answers", "definition": "true2compass(bearing_StoG+1)", "description": "", "templateType": "anything", "can_override": false}, "GtoS_compass_min": {"name": "GtoS_compass_min", "group": "answers", "definition": "true2compass(bearing_GtoS-1)", "description": "", "templateType": "anything", "can_override": false}, "GtoS_compass_max": {"name": "GtoS_compass_max", "group": "answers", "definition": "true2compass(bearing_GtoS+1)", "description": "", "templateType": "anything", "can_override": false}, "StoG_true_min": {"name": "StoG_true_min", "group": "answers", "definition": "string(bearing_StoG-1)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "StoG_true_max": {"name": "StoG_true_max", "group": "answers", "definition": "string(bearing_StoG+1)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "GtoS_true_min": {"name": "GtoS_true_min", "group": "answers", "definition": "string(bearing_GtoS-1)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "GtoS_true_max": {"name": "GtoS_true_max", "group": "answers", "definition": "string(bearing_GtoS+1)+'\u00b0'", "description": "", "templateType": "anything", "can_override": false}, "sign": {"name": "sign", "group": "display vars", "definition": "switch(\n b1=b2,\n \" = \",\n max(b1,b2)-180 = min(b1,b2),\n \" = -\",\n (b1<=180 and b2<=180) or (b1 > 180 and b2 > 180),\n if(b1>b2,\" - \",\" + \"),\n (b1 <= 180 and b2 > 180) and (b1 +180 > b2),\n \" + \",\n (b1 <= 180 and b2 > 180) and (b1 +180 < b2),\n \" - \",\n (b1 > 180 and b2 <= 180) and (b1 < b2 + 180),\n \" - \",\n (b1 > 180 and b2 <= 180) and (b1 > b2 + 180),\n \" + \"\n)", "description": "", "templateType": "anything", "can_override": false}, "answer2": {"name": "answer2", "group": "display vars", "definition": "split(answer,\"\u00b0\")[0]+if(split(answer,\"\u00b0\")[0]=answer,\"\",split(answer,\"\u00b0\")[1])", "description": "", "templateType": "anything", "can_override": false}, "answer2_min": {"name": "answer2_min", "group": "display vars", "definition": "split(answer_min,\"\u00b0\")[0]+if(split(answer_min,\"\u00b0\")[0]=answer_min,\"\",split(answer_min,\"\u00b0\")[1])", "description": "", "templateType": "anything", "can_override": false}, "answer2_max": {"name": "answer2_max", "group": "display vars", "definition": "split(answer_max,\"\u00b0\")[0]+if(split(answer_max,\"\u00b0\")[0]=answer_max,\"\",split(answer_max,\"\u00b0\")[1])", "description": "", "templateType": "anything", "can_override": false}, "answer_type": {"name": "answer_type", "group": "display vars", "definition": "[\"true bearing\", \"compass_bearing\"]", "description": "", "templateType": "anything", "can_override": false}, "b1": {"name": "b1", "group": "calculations", "definition": "a1_true", "description": "bearing 1 - from S to F
", "templateType": "anything", "can_override": false}, "b2": {"name": "b2", "group": "calculations", "definition": "a2_true", "description": "bearing 2 - from F to G
", "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", "q_no", "questions"]}, {"name": "display vars", "variables": ["bearing1", "bearing2", "answer", "answer_min", "answer_max", "sign", "answer2", "answer2_min", "answer2_max", "answer_type"]}, {"name": "calculations", "variables": ["a1_true", "a2_true", "a1_compass", "a2_compass", "a1_true_string", "a2_true_string", "included_angle", "angleFSG", "angleFGS", "length", "side_SG", "bearing_StoG", "bearing_GtoS", "StoG_compass", "GtoS_compass", "StoG_true", "GtoS_true", "b1", "b2"]}, {"name": "answers", "variables": ["answers", "answers_min", "answers_max", "StoG_compass_min", "StoG_compass_max", "GtoS_compass_min", "GtoS_compass_max", "StoG_true_min", "StoG_true_max", "GtoS_true_min", "GtoS_true_max"]}], "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;"}, "sinerule_angle": {"parameters": [["a", "number"], ["b", "number"], ["angB", "number"]], "type": "number", "language": "javascript", "definition": "return Math.asin(a*Math.sin(angB)/b)"}, "cosrule_angle": {"parameters": [["a", "number"], ["b", "number"], ["c", "number"]], "type": "number", "language": "javascript", "definition": "num = Math.pow(a,2) + Math.pow(b,2) - Math.pow(c,2);\nden = 2 * a * b\nreturn Math.acos(num/den);"}, "true2compass": {"parameters": [["a1_true", "number"]], "type": "number", "language": "jme", "definition": "switch(a1_true=0,\"N\",\n 0Give your answer as a {answer_type[compass_bearing]}.
\nGive your answer rounded to the nearest degree.
\nYou can copy the \"°\" symbol from here, or just leave it out from your answer.
", "answer": "{answer_min}$|^{answer}$|^{answer_max}$|^{answer2_min}$|^{answer2}$|^{answer2_max}", "displayAnswer": "{answer}", "matchMode": "regex"}], "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/"}]}