Question: We know that on a flat surface, the shortest path between any 2 points is a straight line (and so we can calculate the shortest

 We know that on a flat surface, the shortest path betweenany 2 points is a straight line (and so we can calculate

We know that on a flat surface, the shortest path between any 2 points is a straight line (and so we can calculate the shortest distance between any two points using the Pythagorean theorem). On a curved surface (like the Earth's surface), this is not true. On a sphere, the shortest path between 2 points is a segment of a "great circle," the unique circle (with the same radius of the sphere) that connects both points. Any location on the Earth's surface can be identified with 2 numbers: a latitude and a longitude (both measured in degrees). Latitude gives the location south or north of the equator. It ranges from 90 (the South pole) to 90 (the North pole). The equator is located at 0 latitude. Longitude measures the location east or west of the Prime Meridian (which runs through England, France, Spain, and parts of Western Africa). The Prime Meridian lies at 0 longitude. Longitude ranges from 180 (West of Prime Meridian) to 180 (east of Prime Meridian). For example, Baruch College is located at 40.74 (North) latitude and 73.98 (West) longitude and the southeast corner of Central Park is 40.76 (North) latitude and 73.97 (West). If (1,1) and (2,2) are any two points on the surface of a sphere, the shortest distance between these 2 points can be calculated by: d=r where =arccos(sin1sin2+cos1cos2cos(12)) and r is the radius of the sphere. You are to write a program which allows the user to enter 2 locations on Earth (the latitude and longitude of 2 separate points) and then calculate and display the distance of the shortest path between them. Your output should show only 3 decimal places. Assume that the Earth is a sphere with radius, r=3959.87 miles. The inverse cosine function, arccos, is one of the functions in the math library. It's function name is acos. Keep in mind that the built-in trig functions, sin() and cos(), accept angles in radians only. So before entering the latitude and longitude into the formula, you will need to convert them from degrees to radians (multiply them by 3.14/180 ). As an added requirement, create a Python function for the formula described above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!