# 2026-09-24 - Under The Trig Table
In Trig Tables for AWKeteers, i wrote an AWK script to generate a
printable trig table. My demo trig.pdf and trig.txt had 4 digits
of precision. AWK can easily give more. But what if i wanted to
calculate the table values by hand rather than using AWK?
Wikipedia lists exact trigonometric values [1] [2]. These are
defined using arithmetic and square roots. OK, how does one
calculate a square root by hand? Heron's method [3] is named after
Hero of Alexandria who described the method in his AD 60 work
Metrica.
For example, sin(45) is equal to half the square root of 2.
Heron's method uses an iterative formula:
X0 = S / 2
X(n + 1) = (Xn + S/Xn) / 2
n = 0:
X = 1
n = 1:
X = (1 + 2 / 1) / 2 = 1.5
n = 2:
X = (1.5 + 2 / 1.5) / 2 = 1.41666666666666666666
n = 3:
X = (1.41666666666666666666 + 2 / 1.41666666666666666666) / 2
= 1.41421568627450980392
n = 4:
X = (1.41421568627450980392 + 2 / 1.41421568627450980392) / 2
= 1.41421356237468991062
n = 5:
X = (1.41421356237468991062 + 2 / 1.41421356237468991062) / 2
= 1.41421356237309504880
sqrt(2) = 1.41421356237
After 5 iterations, this can be used to calculate sin(45) with
6 digits of precision.
sin(45) = sqrt(2) / 2 = .707107
Exact trigonometric values using Heron's method cannot be calculated
for angles that are not divisible by 3. Traditionally, the sine of
the missing angles can be interpolated from neighbors. For example,
(sin(3) - sin(0)) / 3 = 0.0174453, which is pretty close to sin(1).
Wikipedia also has a Taylor series from the 1700's to calculate sine.
The more terms calculated in the series, the more precise the result
becomes. This method works with all angles, not only multiples of 3.
sin(x) = x - x^3 / 3! + x^5 / 5! - x^7 / 7! + ...
x = 45 * pi / 180 = 0.78539816
sin(0.78539816) = 0.78539816 - 0.78539816^3 / 3! +
0.78539816^5 / 5! - 0.78539816^7 / 7! + 0.78539816^9 / 9!
sin(0.78539816) = .707107
The first four terms of the power series give 6 digits of precision.
That's far enough down this rabbit hole for me today.
tags: science,technical
# Footnotes
(IMG) [1] Exact trigonometric values for multiples of 3 degrees
(TXT) [2] Exact trigonometric values (wikipedia)
(TXT) [3] Heron's method (wikipedia)
(TXT) [4] Taylor series for sine (wikipedia)
# Tags
(DIR) science
(DIR) technical