Question: Problem 7. (Great Circle) Write a program great_circle.py that takes four oats x1, y1, x2, and y2 representing the latitude and longitude in degrees of

Problem 7. (Great Circle) Write a program great_circle.py that takes four oats x1, y1, x2, and y2 representing the latitude and longitude in degrees of two points on earth as command-line arguments and writes the great-circle distance (in km) between them, given by the equation:

d = 111arccos(sin(x1)sin(x2) + cos(x1)cos(x2)cos(y1 y2)).

Note that this equation uses degrees, whereas Pythons trigonometric functions use radians. Use math.radians() and math.degrees() to convert between the two. Use your program to compute the great-circle distance between Paris (48.87 N and 2.33 W) and San Francisco (37.8 N and 122.4 W).

$ python3 great_circle.py 48.87 -2.33 37.8 -122.4

8701.389543238289

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!