Heron’s formula in Logical English

heron-theorem-le.le · output · proof · check · playground


The question

Given three proposed side lengths, can they form a triangle, and what area do they enclose? What happens when the sides just meet on a straight line or the longest side cannot be reached by the other two?

Historical background

Proposition 8 in Book I of Heron of Alexandria’s Metrica gives an area method from the three sides alone. It works through sides 7, 8 and 9, forming the product 720 and taking its square root. The same triple appears here as the scalene case. Heron, Metrica I.8

What we tell eyemind

For sides a, b and c with semiperimeter s, the squared area is s * (s - a) * (s - b) * (s - c). We give the sides in tenths of a unit and compute the product with all four factors doubled. This keeps the classification exact, even with fractional side lengths. For positive lengths, a positive product describes a proper triangle, zero marks a collinear case, and a negative product marks an impossible triple. A nonpositive length also makes the triple invalid.

The program takes the square root and converts back to square units. A second calculation uses the equivalent polynomial in the squares of the sides to check the integer product before taking the root.

What eyemind concludes

Side lengths Status Area in square units
3, 4, 5 Proper 6
1, 1, 1 Proper ≈ 0.433013
5, 5, 6 Proper 12
7, 8, 9 Proper ≈ 26.832816
1, 2, 3 Degenerate 0
2.5, 4.7, 5.1 Proper ≈ 5.846052
1, 2, 4 Invalid  
0, 2, 2 Invalid  
struct('le:answer', 'areas', 'side lengths', 'right triangle', 6.0)
struct('le:answer', 'checks', 'side lengths', 'fractional sides')

What the proof establishes

The saved proof is checked. The squared-area check holds exactly for all six cases with an area, including the zero-area case. The printed areas use floating-point square roots.

Try it

node bin/eyemind.js examples/heron-theorem-le.le
node bin/eyemind.js --check-proof examples/proof/heron-theorem-le.js examples/heron-theorem-le.le

Change the too long case from 40 to 30 tenths on its longest side. It becomes degenerate and gains an area of zero.