Post Reply 
(41C) Area of Triangle (SSS)
11-12-2018, 10:33 PM (This post was last modified: 11-12-2018 11:31 PM by Albert Chan.)
Post: #11
RE: (41C) Area of Triangle (SSS)
(11-12-2018 08:28 PM)Dieter Wrote:  Both the formula and the program look good.
But is there a proof that the formula is (at least) as exact as Kahan's?

I had picked the more accurate version of Law of Cosine for a reason:

c² = (a-b)² + 4ab*sin(C/2)²

If c is the shortest side, b/a > 50%. Thus, a-b is exact.
(even if exponents don't match, say a 2 decimals setup: 1.2 - 0.72 = 0.48)

c² - (a-b)² may suffered from subtraction cancellation. Thus, y = (c - (a-b))*(c + (a-b)) / 4

Bad errors occurred when triangle is needle-like, possibly even flattened.
Since c and a-b about the same size, for needle-like triangle, y is still relatively accurate.

Area Δ = √((ab-y)*y), with two terms growing opposite way.
So, slight errors in y tended to cancel each other somewhat (if y is big) ...

Examples can't validate formula, but if carried out calculations by hand, precision is preserved.

Example: (a,b,c) = (100000, 99999.99979, 0.00029)
a-b = 0.00021 (exact)
y = 0.00008 * 0.00050 / 4 = 1e-8 (exact)
Area Δ = √((ab-y)*y) = √((99999 99979 - 1e-8) * 1e-8) ~ √(99.999 99979) = 9.9999 99989
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(41C) Area of Triangle (SSS) - Gamo - 11-10-2018, 12:20 PM
RE: (41C) Area of Triangle (SSS) - Dieter - 11-10-2018, 08:53 PM
RE: (41C) Area of Triangle (SSS) - Dieter - 11-12-2018, 08:28 PM
RE: (41C) Area of Triangle (SSS) - Albert Chan - 11-12-2018 10:33 PM
RE: (41C) Area of Triangle (SSS) - Gamo - 11-11-2018, 05:04 AM
RE: (41C) Area of Triangle (SSS) - Dieter - 11-11-2018, 07:53 AM
RE: (41C) Area of Triangle (SSS) - Gamo - 11-11-2018, 12:23 PM
RE: (41C) Area of Triangle (SSS) - Dieter - 11-11-2018, 04:25 PM



User(s) browsing this thread: 1 Guest(s)