Talk:Great-circle distance

From Wikipedia, the free encyclopedia

Contents

[edit] Page name

Why is "spherical distance" a better name for this page than great circle distance, which has now been made a redirect page? Is it not standard to speak of "great circle distance"? Michael Hardy 21:26, 5 Oct 2004 (UTC)


I agree, I think the page has been made, while perhaps mathematically correct, harder to understand by introducing the formulas using spherical coordinates instead of latitude and longitude.

I think it's wise to at least break it up into two sections, one for the math principals behind it, and one for a practical use case (latitude and longitude to find distance).

I always intended for it to be easy to understand. --JeremyCole 17:34, Oct 16, 2004 (UTC)

The article says:

Consider a sphere of radius r centered at the origin. That is, the set of all points (x1, x2, x3) such that
x_1^2 + x_2^2 + x_3^2 = r^2
The spherical distance between any two points x and y on this sphere is given by
d(x,y) = r \cos^{-1}\left(\frac{x_1 y_1 + x_2 y_2 + x_3 y_3}{r^2}\right).

Why is this of interest? The spherical distance is r times the angle (in radians). That seems to be the main point. The dot product over r2 is the cosine of the angle. Taking the arccosine of the cosine, after using a needlessly complicated expression for the cosine, when one could have said simply "The spherical distance is r times the angle (in radians)" would be more to the point. Michael Hardy 23:48, 16 Oct 2004 (UTC)

It's useful if you want to see a derivation of the spherical distance formula. You start with your statement (d = r times the angle) then solve for the angle in terms dot product, which leads to the above formula. Then just plug in your favorite spherical coordinates to arrive at the final formula. -- Fropuff 01:27, 2004 Oct 17 (UTC)

[edit] Proof ?

Is it possible to give a proof that it is really a distance ? it has to satisfy these three conditions

acos(P.Q)=0 <=> P=Q
acos(P.Q)=acos(Q.P)
acos(P.Q)<=acos(P.M)+acos(M.Q)

The first two are trivial and the triangle inequality can be shown from the cosines rules of sides (see Haversine formula)

Note that the distance (ab is the same as the angle <AOB on the unit sphere)

The cosines rules of sides states that for a spherical triangle ABC

cos(ac)=cos(ab)cos(bc)+sin(ab)sin(bc)cos(<ABC)

Given that -1<=cos(<ABC)<=1

cos(ac)>=cos(ab)cos(bc)-sin(ab)sin(bc)=cos(ab+bc)

Given that acos is strictly decreasing

We get ac<=ab+bc that is <AOC <= <AOB +<BOC

Sorry for the syntax !

[edit] Polar vs. equatorial (meridional) arcradius

The meridional (vertical, north-south) arcradius ("radius of curvature") variation is relatively inverse to the radius. This is easy to visualize: Picture the transverse equator of an oblate spheroid——i.e., the facing, horizonal meridian (viewed as 2-D, it would be the perimeter of the ellipse). At the poles, where the radius (b) is less than at the equator (a), the arcradius flattens, meaning the "per unit radius of curvature" is greater than the vertical, chordial radius. Conversely, at the equator, where the horizontal radius spreads out, the vertical arc squeezes closer together, so that the per unit value is less than the horizontal radius (which equals the horizontal arcradius, since the equator is a great circle). The actual vertical values are \frac{b^2}{a}\,\! at the equator and \frac{a^2}{b}\,\! at the poles.  ~Kaimbridge~17:27, 12 January 2006 (UTC)

[edit] Parametric equations?

I'm not good enough with my trigonometry, but perhaps someone else would be able to add in the conversions of the arcsine (and maybe even the arctan) solved for φ1 and λ1 rather than the distance. That would be helpful if you know the distance, and you're looking for the point the satisfies it; that's the situation I'm in. I'm trying to draw a circle on a sphere, and so I know the distance (radius), but not the (φ,λ) coordinates of a point on the circle. MidnightLightning 21:50, 13 January 2006 (UTC)

[edit] Dot product

Might it be worthwhile pointing out that the dot product of two unit vectors is the cosine of the angle between them, and that great circle didtance can be computed in this way? —The preceding unsigned comment was added by Pmurray bigpond.com (talkcontribs) 04:26, 13 February 2006 (UTC)

I had that in here at one point (see top of this page), but it got taken out. People seem to prefer complicated formulas. -- Fropuff 04:54, 13 February 2006 (UTC)

[edit] Confusing discussion of relative errors

Previously, the article contained several overly-complicated equations and somewhat misleading discussion of the rounding errors. In particular, it gave six equations:

  \Delta\sigma=\arcsin\left\{\sqrt{\left[\cos\phi_2\sin\Delta\lambda\right]^2+\left[\cos\phi_1\sin\phi_2-\sin\phi_1\cos\phi_2\cos\Delta\lambda\right]^2}\right\},\,\!
=\arccos\left\{\sin\phi_1\sin\phi_2+\cos\phi_1\cos\phi_2\cos\Delta\lambda\right\},\,\!
=\arctan\left\{\frac{\sqrt{\left[\cos\phi_2\sin\Delta\lambda\right]^2+\left[\cos\phi_1\sin\phi_2-\sin\phi_1\cos\phi_2\cos\Delta\lambda\right]^2}}{\sin\phi_1\sin\phi_2+\cos\phi_1\cos\phi_2\cos\Delta\lambda}\right\};\,\!

and

=2\arcsin\left\{\sqrt{\sin\left\{\frac{\phi_2-\phi_1}{2}\right\}^2 +\cos{\phi_1}\cos{\phi_2}\sin\left\{\frac{\Delta\lambda}{2}\right\}^2}\right\},\,\!
=2\arccos\left\{\sqrt{\cos\left\{\frac{\phi_2-\phi_1}{2}\right\}^2-\cos{\phi_1}\cos{\phi_2}\sin\left\{\frac{\Delta\lambda}{2}\right\}^2}\right\},\,\!
=2\arctan\left\{\sqrt{\frac{\sin\left\{\frac{\phi_2-\phi_1}{2}\right\}^2+\cos{\phi_1}\cos{\phi_2}\sin\left\{\frac{\Delta\lambda}{2}\right\}^2}{\cos\left\{\frac{\phi_2-\phi_1}{2}\right\}^2-\cos{\phi_1}\cos{\phi_2}\sin\left\{\frac{\Delta\lambda}{2}\right\}^2}}\right\};\,\!


Of these six, the two arccos versions are inaccurate for small distances due to rounding, but all of the other equations are almost equally accurate for most distances. In particular, the 2arcsin equation, the haversine formula, is perfectly fine for small distances; the article incorrectly stated that it was inaccurate — this would indeed be surprising, since the haversine formula was specifically created for use in navigation and has been used for almost two centuries.

(I wrote a quick C program to check the accuracy for various angles by comparing calculations in double and single precision). As far as I can tell, the haversine formula (the 2arcsin formula) has a very slight edge over the others in accuracy for small distances, which is not surprising since it requires fewer operations and has no fundamental instabilities in that regime.

The advantage of the arctan formula comes for large distances. In particular, for points on almost exactly opposite ends of the sphere, the haversine formula has rounding problems, but the arctan equation is still accurate. In fact, out of the six, it seems to be the only one that maintains high accuracy in all regimes.

I've edited that section of the article to only list the haversine (2arcsin) formula and the inaccurate-but-simple cosine formula, and the arctan formula. There are an infinite variety of other formulas, of course, thanks to trig identities, but I don't see any point to listing them if they have no accuracy or simplicity advantages.

—Steven G. Johnson 02:40, 2 March 2006 (UTC)

I'm the culprit who added the "overly-complicated equations"! P=)
First of all, the full "1arcsin", while the choice for small values, is unacceptable for general application because the result is found from a square root——thus it only recognizes the primary, 0-90°, quadrant! But, beyond its "small value" advantage (plus, you need it for 1arctan, anyways), its components have another major application——azimuth (α1):
SA=\cos\phi_2\sin\Delta\lambda;\,\!
SB=\cos\phi_1\sin\phi_2-\sin\phi_1\cos\phi_2\cos\Delta\lambda;\,\!

then

\Delta\sigma=\arcsin\left(\sqrt{SA^2+SB^2}\right);\,\!
\alpha_1=\arctan\left(\frac{SA}{SB}\right).\,\!
If you are just looking to consolidate appearance, you could redefine as sin(σ), cos(σ) and then define σ from arctan:
\sin\Delta\sigma=\sqrt{\left[\cos\phi_2\sin\Delta\lambda\right]^2+\left[\cos\phi_1\sin\phi_2-\sin\phi_1\cos\phi_2\cos\Delta\lambda\right]^2};\,\!
\cos\Delta\sigma=\sin\phi_1\sin\phi_2+\cos\phi_1\cos\phi_2\cos\Delta\lambda;\,\!
\Delta\sigma=\arctan\left(\frac{\sin\Delta\sigma}{\cos\Delta\sigma}\right).\,\!
But doing it that way upsets the formulatic continuity! P=|
As for the 2arcsin "small distance inaccuracy", yes it is relatively more error-prone. The "C" is just limited to single and double, but other programs/languages may be more flexible. I use UBasic, where precision can be defined to less than .11000!!! Using this little program,
  10 RF=#Pi/180
 100 BLat=(81-0.1^13)*RF:DLat=(81+0.1^10)*RF:MD=0.1^9*RF
 200 SA=cos(DLat)*sin(MD):SB=cos(BLat)*sin(DLat)-sin(BLat)*cos(DLat)*cos(MD)
1000 V1=asin((SA^2+SB^2)^0.5)/RF
1010 V2=acos(sin(BLat)*sin(DLat)+cos(BLat)*cos(DLat)*cos(MD))/RF
1020 V3=2*asin((sin(0.5*(DLat-BLat))^2+cos(BLat)*cos(DLat)*sin(0.5*MD)^2)^0.5)/RF
1030 V4=2*acos((cos(0.5*(DLat-BLat))^2-cos(BLat)*cos(DLat)*sin(0.5*MD)^2)^0.5)/RF
2000 ?"V1=";V1:?"V2=";V2:?"V3";V3:?"V4";V4
The last 4-5 decimals are always error-prone, so they will be ignored:
Point 15 (≈.172)
V1= 0.0000000001857195516152077495375701342520533447749318909192117752252
V2= 0.0000000001857195516152077495375701342520533447749318909192768034706
V3= 0.0000000001857195516152077495375701342520533447749318909191948355277
V4= 0.0000000001857195516152077495375701342520533447749318909199951831628
Point 12 (≈.157)
V1= 0.0000000001857195516152077495375701342520533427367852
V2= 0.0000000001857195516152077495375701342520533525926904
V3= 0.0000000001857195516152077495375701342520533372508105
V4= 0.0000000001857195516152077495375701342520535174730760
Point 7 (≈.133)
V1= 0.0000000001857195516127245757
V2= 0.0000000001857195516212353316
V3= 0.0000000001857195516110224245
V4= 0.0000000001857195517267687042

Point 5 (≈.124)

V1= 0.0000000001805150554
V2= 0.0000000002084408316
V3= 0.0000000001473899255
V4= 0.0000000004168816632
As you can see, V3 (2arcsin) isn't the best choice, in any case! P=) Granted, UBasic doesn't use floating point, so, yes, it will be more prone to error rounding (so just set the "point" value higher), but that means there are other programs (likely not precision adjustable) that are also susceptible. I don't have any fanatical obsession to include all of the different forms——so I won't run over and revert it P=)——I just think, if they are all known (sin, cos and tan) for a given equation version, then they all should be provided (some programs may only utilize arcsin or arccos or arctan). One thing I do want to revert is varphi to phi: Phi, rather than varphi, does seem to be the defacto standard: See Vincenty's formula(PDF))——just keep in mind, in this paper, ''\sigma''=\Delta\sigma\,\! (ellipsoidal, not spherical; likewise λ and α) while \Delta\sigma\,\! is an ellipsoidal cosine multiple series complement for the binomial series expansion approximation. ~Kaimbridge~16:03, 2 March 2006 (UTC)
Error comparisons in fixed-point are not very relevant in the real world, come on. Even very accurate methods can become horrendously innaccurate in fixed point if careful attention is not paid to scaling. Computer users these days will almost always employ floating point, and the historical users of manual tables would also use floating point (effectively). —Steven G. Johnson 17:48, 2 March 2006 (UTC)

[edit] Example gives incorrect result

It should be around 1562 miles, not 1794 as stated. Have a look at [1] if you don't believe me. Btyner 21:43, 11 October 2006 (UTC)

My bad, I was accidentally using nautical miles Btyner 21:55, 11 October 2006 (UTC)

[edit] Request for formula comparison

Would someone please provide a long/lat pair that demonstrates how each formula is progressively better? -- Myearwood 15:48, February 17, 2007

Look ↑two sections up↑, towards the end: \phi_1\,\! = 80.9999999999999°, \phi_2\,\! = 81.0000000001°, \Delta\lambda\,\! = 0.000000001°. ~Kaimbridge~22:49, 17 February 2007 (UTC)