NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
Re: POL and arctan2
From: George Huxtable
Date: 2005 Nov 10, 01:10 -0000
From: George Huxtable
Date: 2005 Nov 10, 01:10 -0000
Bill asked- > George wrote: > >> az = arctan2 ( tan dec cos lat - cos LHA sin lat , - sin LHA) >> >> Really, you don't need to know any of the stuff above, except for that >> final >> formula for az. But Bill asked... >> >> It will give a true result, for all azimuths, even when the body is >> actually >> out of sight around the curve of the Earth, below the horizon, with a >> negative altitude. > > Thank you very much George. Finally found the time to work through your > post > and do some sample calculations on my TI-30XA's. Works just fine in the > rectangular-to-polar mode. Which leads me to another question. > > As noted, we plug in two values and get two back. When doing "flat earth" > trig, the first value returned (radius) is the distance from departure to > destination (when Lat and Lon were converted to miles). The second value > returned was true course. > > The question: When using the equation you posted, the second value is the > azimuth (or initial course in great circle sailing.) That leaves me with > the mystery first value returned. In the few trial runs I have done, it > is > <1.0, and it's cosine is in the neighborhood of calculated Hc (which of > course can be used to find distance of vice versa). Was that pure > coincidence and a useless by-product, or can Hc/great-circle distance be > extracted from the radius value returned? =================== Bill is obviously something of a thinker, and it's a pleasure to respond to his interesting questions. I had wondered about the same matter myself, and so I've picked up my old Casio programmable calculator and done a few sample calculations. It's set to work in degrees rather than in radians (in contrast to many computer programs, which can only work in radians, and need converting to and from degrees). It does a rectangular to polar conversion using its POL (y,x) function, in which case the position (x,y) is converted to a radius R (= square-root of (x squared + y squared)), which appears as one of the results, and an angle A (= arc tan (y / x)), which appears as the other. If into such a rectangular to polar conversion, you put- x = - Sin LHA, and y = tan dec cos lat - cos LHA sin lat (these are the two terms in the spherical-trig azimuth formula quoted above) the result of which is A = Azimuth (in the range -180 to +180 degrees (add 360 if negative.) then what appears as the "R" result of the calculation appears to be closely akin to tan (zenith distance), where zenith distance is (90 - Hc). This hasn't been proved; it's no more, as yet, than a working hypothesis, based on observing the results of calculations. Or, if you're calculating great-circle course and distance from (lat1, long1 to lat2, long2), then A will be the great circle course, between - 180 and +180 degrees (add 360 if negative), and R will be akin to tan (great circle distance), with distance in degrees, or to tan (great circle distance / 60) if distance is in miles. So, as Bill suspected, and that hypothesis is right, you could use that function- arctan2 ( tan dec cos lat - cos LHA sin lat , - sin LHA), or its equivalent arctan2 (tan lat2 cos lat1 - cos (long2 - long1) sin lat1, -sin (long2 - long1)) to provide azimuth or course. Similarly, from arctan (R), you could find alt from alt = 90 - arctan (R), or find great-circle distance Dist from- Dist = 60* arctan (R) There's a snag, though. Why I've written "akin to" rather than "equal to", is that an important bit of information has been lost. It's quite reasonable to calculate an altitude less than zero, for a body below the horizon (in which case the zenith distance would exceed 90 degrees),.Similarly, one might well wish to calculate course and distance for a great-circle voyage that's greater than a quarter-circumference of the Earth (5400 miles). In either case, that angle being greater than 90- degrees, its tan should be negative. However, using the POL function, the resulting value for R can only ever be positive, so the resulting angle A will only ever be in the range 0 to 90 degrees. If the angle should really be in a different quadrant, any sign indicating that has been lost. You could express this mathematically by saying , instead of tan (zenith distance) = R, tan (zenith distance) = square root of (R squared).. Almost the same thing, but it can never go negative. In the polar-rectangular conversion formula, we know that, by definition, R squared = x squared + y squared.and that- x = - sin LHA, and y = tan dec cos lat - cos LHA sin lat in which case (tan (zenith distance)) squared = sin LHA (squared) + (tan dec cos lat - cos LHA sin lat) squared. I repeat, the equation above is no more than a hypthesis, not based on analytical reasoning, just on observing how the numbers work out. Is it true? I'm not certain. Is it equivalent to the following familiar expression? sin alt = cos zenith distance = sin lat sin dec + cos lat cos dec cos LHA If those equations are equivalent (i.e. if one can be derived from the other) then the assumption stands, that altitude or distance can be obtained from arctan (R), but with some ambiguity about the appropriate sector. That ambiguity reduces the usefulness of deriving alt, or dist, from a rectangular- to- polar conversion. Unfortunately, proving (or disproving) that equivalence is way beyond my limited trigonometrical powers; perhaps one of our more mathematical gurus may pick it up as a challenge. George. ======================= contact George Huxtable at george@huxtable.u-net.com or at +44 1865 820222 (from UK, 01865 820222) or at 1 Sandy Lane, Southmoor, Abingdon, Oxon OX13 5HX, UK.