Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications 15th International Conference Dexa 2004 Zaragoza Spain August 30 September 3 2004 Proceedings Lncs 3180

Authors: Fernando Galindo ,Makoto Takizawa ,Roland Traunmuller

2004th Edition

3540229361, 978-3540229360

More Books

Students also viewed these Databases questions