# 2026-09-23 - Trig Tables for AWKeteers
       
       Recently i read an article titled Slide Rules For Rocketeers [1].
       I have neither rocket nor slide rule.  So why did i find it so
       interesting?  I think it's the idea of computing without electronics.
       Slide rules were used for nearly 4 centuries before they went out of
       style.
       
       In the example of two tracking stations 1000' apart; A measures
       34 degrees and B measures 22 degrees.  In school i learned that the
       angles in a triangle always total 180 degrees.  So:
       
           C = 180 - (A + B) = 124
       
       The example simplified formula for calculating the altitude was:
       
           Altitude = (1000' * sin(A) * sin(B)) / sin(C)
       
       The author calculates the altitude twice: once using a slide rule and
       again using a 2-digit trig table.  This table takes advantage of the
       periodicity of the sin() function to compact the table to 90 degrees.
       When C > 90, then sin(C) == sin(180 - C), so sin(124) == sin(56).
       
       Using the slide rule:
       
           Altitude = (1000' * sin(34) * sin(22)) / sin(56)
           Altitude = (1000' * .559 * .375) / .829
           Altitude = 252' 10"
           Altitude = 253' (rounded)
       
       Using the trig table:
       
           Altitude = (1000' * sin(34) * sin(22)) / sin(56)
           Altitude = (1000' * .56 * .37) / .83
           Altitude = 249' 7"
           Altitude = 250' (rounded)
       
       Why use a slide rule instead of a trig table?  Not because of
       precision.  Either could have greater precision depending on the
       construction.  For example, the trig tables in RadioShack's
       Electronics Data Handbook [2] have *four* digits of precision.
       By the way, RadioShack's table takes even further advantage of
       the periodicity to compact the table to 45 degrees.  When C > 45 then
       sin(C) = cos(90 - C), so sin(56) = cos(34).
       
       Using RadioShack's table:
       
           Altitude = (1000' * sin(34) * sin(22)) / sin(56)
           Altitude = (1000' * .5592 * .3746) / .8290
           Altitude = 252' 8"
           Altitude = 253' (rounded)
       
       The reason to use a slide rule is speedy lookup for repetitive
       calculations.  For example, calculating the altitude of *all* of the
       rockets for an entire club.  It's much faster than looking up values
       from a table in a book.
       
       For my purpose, a table would suffice.  But i'd like to print my own.
       I wrote AWK scripts to generate trig tables in a compact format like
       RadioShack's.  One script generates CSV [3] and another makes
       preformatted text [4] [5]. I imported the CSV into Gnumeric, split it
       into a sheet per page, marked it up, and exported to PDF [6].  The
       precision is a setting in the AWK script that defaults to 4 digits.
       
       On a tangent, i thought about applying this to measure the height of
       a tree.  Wikipedia has a page dedicated to the subject [7].  See also
       DendromeTREE [8].
       
       By the way, the author of Slide Rules For Rocketeers also published
       the DATAFILE database application in Run Magazine [9].  This includes
       a BASIC listing that totals a little over 700 lines.  Admittedly,
       these lines use colons (:) to cram multiple statements per line.
       This may have been necessary to fit the constraints of magazine
       publishing and 8-bit computers.  This looks very similar to the
       Flip-file database BASIC listing in the book
       Programming Tricks And Skills [10], also published in 1984.
       
       tags: retrocomputing,technical
       
       # Footnotes
       
 (DIR) [1] Slide Rules For Rocketeers
       
 (HTM) [2] Electronics Data Handbook (trig table) (JS)
       
 (TXT) [3] trigcsv.awk
       
 (TXT) [4] trigtxt.awk
       
 (TXT) [5] trig.txt
       
 (BIN) [6] trig.pdf (PDF)
       
 (TXT) [7] Tree height measurement (wikipedia)
       
 (TXT) [8] Dendrometry (wikipedia)
       
       [9] DATAFILE database by Mike Konshak
       
 (HTM) DATAFILE database, part 1 (JS)
       
 (HTM) DATAFILE database, part 2 (JS)
       
 (DIR) [10] FLIP.BAS from Programming Tricks And Skills
       
       # Tags
       
 (DIR) retrocomputing
 (DIR) technical