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 6372.795 km.Let 41,1, and P2,1, be the latitude and longitude of two points, respectively. 1, the longitudinal difference, and Ao, the angular difference/distance in radians, can be determined as follows from the spherical law of cosines:Ao = arccos(sin P, sin 42+ cos 4, cos 4, cos ANFor example, consider the latitude and longitude of two major cities:
Nashville, TN: N 36\deg 7.2', W 86\deg 40.2'
Los Angeles, CA: N 33\deg 56.4', W 118\deg 24.0'
You must convert these coordinates to radians before you can use them effectively in the formula. After conversion, the coordinates become
Nashville: 41=36.12\deg =0.6304 rad, A,=-86.67\deg =-1.5127 rad
Los Angeles: 92=33.94\deg =0.5924 rad, 42=-118.40\deg =-2.0665 rad
Using these values in the angular distance equation, you get
rAo =6372.795 X 0.45306=2887.259 km
Thus, the distance between these cities is about 2887 km, or 1794 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 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!