Re: [Re: calculating distance based on zip/postal codes]

by Jan Theodore Galkowski <jtgalkowski(at)alum.mit.edu>

 Date:  Mon, 15 May 2000 20:08:43 -0400
 To:  Zach Kenyon <zantispam(at)netscape.net>
 Cc:  hwg-business <hwg-business(at)hwg.org>
 In-Reply-To:  usa
  todo: View Thread, Original
At 01:51 PM 05/15/2000 CDT, Zach Kenyon wrote:
>"Capt. Ron" <strays(at)bellsouth.net> wrote:
>

[snip]

>D=3D 6,370,997*arcos(sin(LAT1)*sin(LAT2) +
cos(LAT1)*cos(LAT2)*cos(LONG1-LONG2))

[snip]

>
>Though I believe that this is the arc-cosine rule that Galkowski advised
>against.
>

Just to confirm Capt Ron's suspicion, yes, this is the problematic
arccosine rule.  All's fine except that nasty cosine of the
difference between two longitudes:  As the distance between the=20
longitudes halves, you need more than double the amount of precision
to get the same accuracy out of the expression.

In general, folks who do a lot of 3-dimensional work on the sphere=20
represent positions by unit vectors in 3-space and use their dot
products as a reciprocal measure of distance between the points. =20
To change that into a length, one can use a number of gimmicks
which avoid having to push the quantity through a trig function.
Indeed, most real-time 3-or-greater-space work avoids trig functions
altogether, trying to reduce the calculation to +, -, *, /, and
SQRT operations only.  Vector analysis is good for this.  There
are also more numerically stable representations, such as=20
quaternions (although, apart from religious considerations, it's
hard to make a case for them versus, say, spin matrices, or=20
rotation matrices themselves) or Rodrigues parameters (a favorite
of mine). =20

In serious work, error analysis on the sphere is an important=20
consideration and, if the standard angular deviations are anything
but tiny, involves some non-standard stuff which is the subject
of spherical statistics and spherical regression, eg, paleomagnetic
calculations.

  --jtg



[snip]
______________________________________________________________________
 Jan Theodore Galkowski   =B0o=B0   (:-)}        demiourgos(at)smalltalk.org=20
 algebraist.com/       www.marsociety.org/   jtgalkowski(at)alum.mit.edu=20
 PGP fingerprint: 2757 F86D AA51 677D 38D7  964B 9A8D 7852 A494 3790=20

HTML: hwg-business mailing list archives, maintained by Webmasters @ IWA