Why Is the Area Calculation of a Triangle Using Given Algorithms Unstable?

In summary, the algorithm for computing the area of a triangle with sides of length A, B, and C is unstable due to the presence of minus signs in the equations. This can be shown through examples where the values of the area differ greatly when using the given equations. The proposed approach, Area2, is also unstable due to the presence of minus signs. To create a more stable version, the formula can be rearranged to eliminate the minus signs, resulting in a more accurate and reliable calculation of the area.
  • #1
MtX
9
0
Consider the following algorithm for computing the area of a triangle with sides of length A, B, and C:

S = (A+B+C) / 2
Area1(A,B,C) = sqrt(S(S-C)(S-B)(S-A)).

A) Explain why this approach is unstable, and illustrate with an example.

B) A student proposes the following less efficient, but more stable, approach:

Area2(A,B,C) = sqrt((A+B+C)(A+B-C)(A-B+C)(-A+B+C)) / 4

Explain why this approach is still unstable and illustrate with an example.

C) Reaarange the formula to produce a more stable version. Explain why it is more stable.


I really have no clue on how to start off but for parts A) and B), I plan to insert arbitrary values of A, B and C, compare the area of the triangle using sides A, B, and C, versus the value of the area after using the Area1 and Area2 equations as examples. I am guessing the compared values will differ greatly and as a result makes this "approach" unstable.

For Part C) however, I have no clue how to begin. Am I suppose to create my own formula? Or modify theirs? What should I do?

Thanks.
 
Physics news on Phys.org
  • #2
I am not sure what "stability" is supposed to mean. I'll assume that it means expression without minus signs. With very little difficulty I got:

area=sqrt(S(S3+AB(A+B)+AC(A+C)+BC(B+C)+ABC)/2)
 
  • #3


A) The approach presented in the algorithm is unstable because it involves subtracting similar numbers from each other, which can lead to a loss of significant digits and result in a less accurate calculation. This can be illustrated with an example where A=10, B=10, and C=10. Using the Area1 equation, we get S = (10+10+10)/2 = 15 and Area1(10,10,10) = sqrt(15(15-10)(15-10)(15-10)) = sqrt(15*5*5*5) = 37.4166. However, if we use the more accurate value of S = (A+B+C)/2 = (10+10+10)/2 = 15.000, we get a significantly different result of Area1(10,10,10) = sqrt(15.000(15.000-10.000)(15.000-10.000)(15.000-10.000)) = sqrt(15.000*5.000*5.000*5.000) = 37.4166. This shows how a small change in the input values can result in a large difference in the calculated area, making this approach unstable.

B) The proposed approach, Area2, is less efficient because it involves more calculations, but it is more stable because it avoids subtracting similar numbers. However, it is still unstable because it involves multiplying and dividing large numbers, which can lead to a loss of significant digits. For example, using the same input values of A=10, B=10, and C=10, we get Area2(10,10,10) = sqrt((10+10+10)(10+10-10)(10-10+10)(-10+10+10))/4 = sqrt(30*10*10*10)/4 = sqrt(30000)/4 = 54.7723. However, if we use the more accurate value of S = (A+B+C)/2 = (10+10+10)/2 = 15.000, we get a significantly different result of Area2(10,10,10) = sqrt((15.000+15.000+15.000)(15.000+15.000-15.000)(15.000-15.000+15.000)(-15.000+15.000+
 

FAQ: Why Is the Area Calculation of a Triangle Using Given Algorithms Unstable?

What is the stability of the area of a triangle?

The stability of the area of a triangle refers to how much the area of a triangle changes when its dimensions are varied.

What factors affect the stability of the area of a triangle?

The stability of the area of a triangle is affected by the lengths of its sides and the angles between them.

How can the stability of the area of a triangle be calculated?

The stability of the area of a triangle can be calculated using the formula: stability = (base x height) / (2 x area).

Why is the stability of the area of a triangle important in mathematics?

The stability of the area of a triangle is important in mathematics because it helps determine the accuracy of measurements and calculations involving triangles.

What are some real-world applications of understanding the stability of the area of a triangle?

Understanding the stability of the area of a triangle is important in fields such as engineering, architecture, and surveying, where accurate measurements and calculations involving triangles are necessary.

Similar threads

Replies
13
Views
1K
Replies
9
Views
3K
Replies
5
Views
1K
Replies
2
Views
5K
Replies
2
Views
2K
Replies
9
Views
2K
Replies
15
Views
3K
Back
Top