31. The shortest distance between two points on the surface of the globe (greatcircle distance) can be

Question:

31. The shortest distance between two points on the surface of the globe (greatcircle distance) can be calculated by using the haversine formula. If and are the latitude and longitude of point 1 and and are the latitude and longitude of point 2, the great circle distance between the points is given by:

where , and mi is the Earth radius. Write a user-defined function that determines the distance between two points on the Earth. For the function name and arguments, use dis = GreatCirDis(Lat1,Lng1,Lat2,Lng2), where the input arguments are the latitude and longitude of the two points (degrees in decimal format), and dis is the great-circle distance in miles. Use the function to calculate the distance between London (51.50853°, –0.12574°) and New York City (40.71427°, –74.00597°).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: