// Numbas version: exam_results_page_options {"name": "Calculate the distance between two points", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Calculate the distance between two points", "tags": ["geodesy", "geospatial", "latitude", "longitude", "spatial", "spherical cosine rule", "spherical trigonometry"], "metadata": {"description": "

Calculate the distance between two points along the surface of a sphere using the cosine rule of spherical trigonometry. Context is two places on the surface of the Earth, using latitude and longitude.

\n

The question is randomised so that the numerical values for Latitude for A and B will be positive and different (10-25 and 40-70 degrees). As will the values for Longitude (5-25 and 50-75). The question statement specifies both points are North in latitude, but one East and one West longitude, This means that students need to deal with angles across the prime meridian, but not the equator.

\n

Students first calculate the side of the spherical triangle in degrees, then in part b they convert the degrees to kilometers. Part a will be marked as correct if in the range true answer +-1degree, as long as the answer is given to 4 decimal places. This allows for students to make the mistake of rounding too much during the calculation steps.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

This problem will use your answer for the first part of the question to check your final answer, so if you make a mistake in the first part but your later working is correct, then you will get the marks for the second part of the question.

\n

Model the Earth as a sphere, with a radius of 6371km.

\n

Calculate the shortest distance along the surface of the sphere between points A and B:

\n

point A ( Latitude {LatA}oN, Longitude {LongA}oW)

\n

point B ( Latitude {LatB}oN, Longitude {LongB}oE)

\n

", "advice": "

Part a)

\n

First draw your spherical triangle.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Latitude (deg)  Longitude (deg)
Location A:     {LatA}N        {LongA}oW
Location B:     {LatB}N        {LongB}oE
\n

Label the corners with a capital letter (e.g. A, B), and the side opposite each corner with the matching lower case letter.

\n

If we select the North Pole as the third point, N, in the spherical triangle:

\n

side a = latitude of North Pole - latitude of B = {latPole} - {LatB} = {side_a} degrees

\n

side b = latitude of North Pole - latitude of A = {latPole} - {LatA} = {side_b} degrees

\n

angle N between side a and side b = {longA} + {longB} = {Ndeg} degrees (remember to check for East and West longitudes)

\n

\n

Equation for the cosine rule for spherical trigonometry

\n

$\\cos(n) = \\cos(a)\\cos(b) + \\sin(a)\\sin(b)\\cos(N)$

\n

n= {side_n_deg} degrees

\n

\n

Part b)

\n

Distance between A and B in km:

\n

Convert n to radians, n = {side_n_rad} radians

\n

Multiply by the specified Earth radius, {EarthRadius} km, to convert from angle to distance: {side_n_km} km.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"Ndeg": {"name": "Ndeg", "group": "Ungrouped variables", "definition": "LongA+LongB", "description": "

Angle between the two meridians forming the sides of the spherical triangle linking to the North Pole. Remember, LongA is west, Long B is east.

", "templateType": "anything", "can_override": false}, "LongPole": {"name": "LongPole", "group": "Ungrouped variables", "definition": "0", "description": "

Longitude of 3rd point used in spherical triangle (should be N or S pole)

", "templateType": "anything", "can_override": false}, "side_n_deg": {"name": "side_n_deg", "group": "Ungrouped variables", "definition": "precround(degrees(side_n_rad),4)", "description": "

The side n of the spherical triangle given in degrees - the answer to Part a given to 4d.p. Used in the advice section to show the correct answer.

", "templateType": "anything", "can_override": false}, "side_a": {"name": "side_a", "group": "Ungrouped variables", "definition": "LatPole-LatB", "description": "

Side of triangle a, in degrees

", "templateType": "anything", "can_override": false}, "LatA": {"name": "LatA", "group": "Ungrouped variables", "definition": "random(10..25)", "description": "

Latitude of point A - degrees N

", "templateType": "anything", "can_override": false}, "LongB": {"name": "LongB", "group": "Ungrouped variables", "definition": "random(50..75)", "description": "

Longitude of point B - degrees East

", "templateType": "anything", "can_override": false}, "EarthRadius": {"name": "EarthRadius", "group": "Ungrouped variables", "definition": "6371", "description": "

Radius of spherical Earth in km.

", "templateType": "anything", "can_override": false}, "side_n_rad": {"name": "side_n_rad", "group": "Ungrouped variables", "definition": "arccos(cos(radians(side_a))*cos(radians(side_b))+sin(radians(side_a))*sin(radians(side_b))*cos(radians(Ndeg)))", "description": "", "templateType": "anything", "can_override": false}, "LongA": {"name": "LongA", "group": "Ungrouped variables", "definition": "random(5..25)", "description": "

Longitude of point B - degrees West.

", "templateType": "anything", "can_override": false}, "side_n_km": {"name": "side_n_km", "group": "Ungrouped variables", "definition": "int(radians(side_n_deg)*EarthRadius)", "description": "

Distance between A and B in km

", "templateType": "anything", "can_override": false}, "LatPole": {"name": "LatPole", "group": "Ungrouped variables", "definition": "90", "description": "

Latitude of pole used in triangle

", "templateType": "anything", "can_override": false}, "LatB": {"name": "LatB", "group": "Ungrouped variables", "definition": "random(40..70)", "description": "

Latitude of point B - degrees N

", "templateType": "anything", "can_override": false}, "side_b": {"name": "side_b", "group": "Ungrouped variables", "definition": "LatPole-LatA", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["LatA", "LongA", "LatB", "LongB", "Ndeg", "side_a", "LatPole", "LongPole", "side_b", "EarthRadius", "side_n_rad", "side_n_deg", "side_n_km"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use the North Pole to form the third point in a spherical triangle.

\n

\n

\n

What is the value of the side of the triangle linking A and B, in degrees?

\n

[[0]] degrees (4 decimal places)

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Side n (degrees)", "marks": "6", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "side_n_deg - 1", "maxValue": "side_n_deg + 1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "4", "precisionPartialCredit": "70", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the distance between A and B along the surface of the Earth in km? Round your answer to the nearest km.

\n

[[0]] km

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "side_n_deg", "part": "p0g0", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "side_n_km+10", "maxValue": "side_n_km-10", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": 0, "precisionPartialCredit": "75", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elizabeth Petrie", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3402/"}, {"name": "Michael Barnes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/13985/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elizabeth Petrie", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3402/"}, {"name": "Michael Barnes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/13985/"}]}