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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started