HP Forums
Distance between geographic poimts - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Distance between geographic poimts (/thread-110456.html)



Distance between geographic poimts - Sam Levy - 03-18-2007

Around the HP-65 HP-67 era my boss had me calculate distances for his glider club. It was in the calculator book I was using, I shortened the program and made it automatic for crossing the equator. I have the manuals on CD and I request help finding that worked solution. If you could help me find the book and page please. Sam


Re: Distance between geographic poimts - Thomas Okken - 03-18-2007

I have an HP-42S program that computes Great Circle Distance here. Should be easy to adapt to the HP-65 or HP-67 or any other RPN scientific.


It takes coordinates in decimal degrees, so you may want to add ->HMS commands at a few places; it calculates the distance in kilometers, but that is easy enough to change to nautical miles by changing the final multiplication to 21600.


The formula used is

dist = acos(cos(lat1)*cos(lat2)*cos(lon1-lon2)+sin(lat1)*sin(lat2))

Where dist is an angle on the Great Circle passing through the two points. Assuming the calculator is in DEG mode, multiply by 60 to get nautical miles, etc. This formula works for any pair of coordinates -- no issues with crossing the equator or passing over the poles or anything like that.

UPDATE: There is more information, and more accurate formulae, here.

- Thomas

00 { 101-Byte Prgm }
01>LBL "GC"
02 MVAR "LAT1"
03 MVAR "LON1"
04 MVAR "LAT2"
05 MVAR "LON2"
06 MVAR "DIST"
07 DEG
08 RCL "LAT1"
09 COS
10 RCL "LAT2"
11 COS
12 ×
13 RCL "LON1"
14 RCL- "LON2"
15 COS
16 ×
17 RCL "LAT1"
18 SIN
19 RCL "LAT2"
20 SIN
21 ×
22 +
23 ACOS
24 360
25 ÷
26 40076
27 ×
28 RCL- "DIST"
29 .END.


Edited: 18 Mar 2007, 5:07 p.m.


Re: Distance between geographic poimts - Charles - 03-18-2007

Sam,

Try the "HP25 Applications Programs" book, pages 61-69


Re: Distance between geographic poimts - Jean-Marc - 03-18-2007

Hi,

you could try the "Terrestrial geodesic distance" programs

in the HP-41 library.

Regards

JMB


Re: Distance between geographic poimts - Sam Levy - 03-18-2007

Thanks to all. I had hoped to find the example I used before but I will be more adventurous and try one of the complex solutions. Sam


Re: Distance between geographic poimts - Les Wright - 03-18-2007

Are you referring to the programs in the Navigation Pacs for HP65 or HP67? Both of those manuals are on the DVD under the "Calculator Software Manuals" subheading.

Les


Re: Distance between geographic poimts - Les Wright - 03-19-2007

Actually, there is a simpler routine called Great Circle Navigation in the manual for the HP65 Standard Pac. That is on the DVD too. Maybe that is the one you are remembering? It just fits into the HP65's 100 steps.

Les


Re: Distance between geographic poimts - Les Wright - 03-19-2007

I would recommend this highly.

Jean-Marc doesn't post nearly frequently enough on the Forum for my liking. I have become a huge fan of his work--indeed, most of my more recent programming efforts in special functions for the HP33S and 32sii are basically shameless plagiarisations of his stuff. His contributions are prolific and are almost always huge improvements over what has previously been available in the HP41 users' library solution books.

Can you let us know if you ever locate the old program you were thinking of?

Les


Re: Distance between geographic poimts - Sam Levy - 03-19-2007

First my surprise at finding my own entry in this forum on Google search for Kinpo. Second the equation I used must have been in a calculator manual as I did not buy any other texts or programs.
It specifically had a correction for crossing the equator when a certain term was evaluated. I foumd that term in the equation and during the solution added a test and a flag to make the correction automatic. It must have been for the HP-65 as it fit in the program space with few steps left. Sam Thanks all.


Re: Distance between geographic poimts - Jean-Marc - 03-20-2007

Hi Les,
Thank you for praising my programs.
The angular distance d between (L,b) and (L',b') on a sphere
may also be obtained by

( sin(d/2) )^2 = ( sin(b-b')/2 )^2 ( cos(L-L')/2 )^2
+ ( cos(b-b')/2 )^2 ( sin(L-L')/2 )^2

where L , L' = longitudes and b , b' = latitudes

These formulas are less accurate than Andoyer's formulas,
except perhaps for nearly antipodal points.

Actually, d/2 is in X-register at line 30 of the "TGD" program
listed in "Terrestrial Geodesic Distance for the HP-41.
( delete lines 27 and 23 which are unuseful here )
and simply multiply by the Earth diameter to get the distance.

Regards,
JMB.