Question: Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and longitudes. This is a
Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and longitudes. This is a useful operation because it tells you how far apart two cities are if you multiply the distance by the radius of the Earth, which is roughly kmLet and P be the latitude and longitude of two points, respectively. the longitudinal difference, and Ao the angular differencedistance in radians, can be determined as follows from the spherical law of cosines:Ao arccossin P sin cos cos cos ANFor example, consider the latitude and longitude of two major cities:
Nashville TN: N deg W deg
Los Angeles, CA: N deg W deg
You must convert these coordinates to radians before you can use them effectively in the formula. After conversion, the coordinates become
Nashville: deg rad, Adeg rad
Los Angeles: deg rad, deg rad
Using these values in the angular distance equation, you get
rAo X km
Thus, the distance between these cities is about km or miles. Note: To solve this problem, you will nec to use the Math. acos method, which returns an arccosine angle in radians.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
