The Museum of HP Calculators

HP Forum Archive 17

 Distance between geographic poimtsMessage #1 Posted by Sam Levy on 18 Mar 2007, 11:53 a.m. 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 poimtsMessage #2 Posted by Thomas Okken on 18 Mar 2007, 3:12 p.m.,in response to message #1 by Sam Levy 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 poimtsMessage #3 Posted by Charles on 18 Mar 2007, 5:50 p.m.,in response to message #2 by Thomas Okken Sam, Try the "HP25 Applications Programs" book, pages 61-69

 Re: Distance between geographic poimtsMessage #4 Posted by Jean-Marc on 18 Mar 2007, 6:00 p.m.,in response to message #1 by Sam Levy Hi, you could try the "Terrestrial geodesic distance" programs in the HP-41 library. Regards JMB

 Re: Distance between geographic poimtsMessage #5 Posted by Sam Levy on 18 Mar 2007, 10:13 p.m.,in response to message #4 by Jean-Marc 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 poimtsMessage #6 Posted by Les Wright on 18 Mar 2007, 11:27 p.m.,in response to message #5 by Sam Levy 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 poimtsMessage #7 Posted by Les Wright on 19 Mar 2007, 6:56 a.m.,in response to message #6 by Les Wright 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 poimtsMessage #8 Posted by Les Wright on 19 Mar 2007, 7:01 a.m.,in response to message #4 by Jean-Marc 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 poimtsMessage #9 Posted by Sam Levy on 19 Mar 2007, 9:04 a.m.,in response to message #8 by Les Wright 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 poimtsMessage #10 Posted by Jean-Marc on 20 Mar 2007, 5:46 p.m.,in response to message #8 by Les Wright 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.

Go back to the main exhibit hall