Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions