Hi Hans
At 11:48 PM 8/19/96 +-200, you wrote:
>With great interest I've read the article of Mr.Bartmann about making
sundials using a spreadsheet program (reference in 'sundial links' WWW-page).
Could you give the URL? I could not locate it. Using spreadsheet for
repetitive calculations is very good idea. Spreadsheets have only one flaw.
They are capable of plotting functions but plotting general curves is still
beyond them.
>I encountered however 2 problems:
>
>1. Incorrect formula for azimuth
>
> Formula given in article: cos(A) = sin(d) - ( sin(lat) * sin(a) ) /
( cos(lat) * cos(a) )
>
> which should be: cos(A) = ( sin(lat) * sin(a) - sin(d) )
/ ( >cos(lat) * cos(a) )
I find the original formula correct. I checked in the manual on Celestial
Navigation and found the formula it was derived from.
>2. Using the ACOS function to return the azimuth angle is rather tricky, >
because returned values are in the range from -pi till +pi.
No trigonometric function may have inverse in [-pi, pi] because none of them
is one-to-one on such interval. In case of inverse to cosine (arc cos)
mathematicians agreed to assume for its range of values to be [0, pi], with
argument in [-1, 1].
This is OK Hans. Not all of us have to remember maths, and even those who
remember make mistakes.
>Any comments/suggestions?
In times of logarithmic tables the following formula was popular
sin(A) = sin(LHA) * cos(dec) / cos(a)
where LHA is Local Hour Angle and a, like above, is altitude. This was
attractive because of number and kind of operations. You get the solution in
0-90 and naming (determining the quadrant) is tricky, I do not remember its
rules and arriving at them would take some time.
The recommended formula is
(*) ctga(A) = cos(lat) * tg(dec) / sin(LHA) - sin(lat) * ctg(LHA)
There is a bit more calculations but naming conventions are more "common
sense" and one version of them is
Assume
lat - always positive
dec - positive if same name as lat, negative otherwise
LHA - express in 0-180 and name it E or W appropriately (e.g. 123 E)
You obtain A in 0-180, e.g. ( N 135 W, S 060 E, e.t.c.) where first letter
is same as lat and second same as LHA. Remember that arc ctg is defined on -
to + infinity and takes values in [0, pi]. Calculators and computers usually
do not have arc ctg but arc tg (atan) only. So invert the right-hand side of
(*) and apply arc tg. If you get negative result (arc tg may be negative),
make it positive but change the first letter to opposite to lat (or add 180
to the result and preserve the first letter).
Once you have properly named the result you may express the azimuth in
"regular" 0-360 system.
- Slawek Grzechnik