Jeff Adkins wrote:

> I have two separate references, listed below, that gives the solution to
> this problem in terms of the cosine of the hour angle as follows:
>
> cos H =(sin (altitude) - sin (lat) sin (dec))/(cos(lat) cos(dec))
> 
> where H is the hour angle.  Since the tangent of H is undefined when H
> approaches +/- 90 degrees, perhaps this form is of more general use.


The above expression, although correct, has a couple computational
warts, however.  If latitude or declination is +/- 90 degrees, the
rightmost term blows up.  And even when it doesn't, the expression
still has a built-in ambiguity: If cos H = 0.5, say, H could either
be +60 degrees or -60 degrees.  Thus you need to make use of additional
information to resolve this inherent confusion.

The previously quoted expression for hour angle,

   tan H = sin A / (cos A * sin f + tan h * cos f) [corrected],

will work fine, but only if you invoke a *two-parameter* arctangent
function when solving for H in a computer program.  Such are commonly
found in most computer languages; they take a quotient's numerator
and denominator as separate parameters, check the signs of numerator
and denominator, examine whether the denominator is zero or infinite,
and then return an angle that's always in the correct quadrant -- a
more robust approach.

The same trick can be done on a scientific calculator.  Let the above
numerator and denominator be y and x values, respectively, which are
readily converted, via a rectangular-to-polar operation, to r and theta.
Theta will be your H, "automagically" placed in the correct quadrant.


~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~ 
  Mark Gingrich      [EMAIL PROTECTED]      San Leandro, California

Reply via email to