Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Heron's formula
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example== <div class="calculator-container" data-calculator-refresh-on-load="true" style=" border: 1px solid grey; float: right; margin: 3px;"> {|- class="wikitable floatleft" style="margin: 0;" ! colspan=2 style="padding: 0 1em" | Area calculator |- | {{calculator label|label={{font color|orange|{{mvar|a}}}}|for=a}} || {{calculator|size=3|default=3|min=1|step=1|id=a}} |- | {{calculator label|label={{font color|green|{{mvar|b}}}}|for=b}} || {{calculator|size=3|default=4|min=1|step=1|id=b}} |- | {{calculator label|label={{font color|purple|{{mvar|c}}}}|for=c}} || {{calculator|size=3|default=5|min=1|step=1|id=c}} |- | {{mvar|s}} || {{calculator|type=plain|default=6|formula=(a+b+c)/2|NaN-text= |id=s}} |- | Area<ref>The formula used here is the [[#Numerical stability|numerically stable formula]] (relabeled for {{tmath|a \leq b \leq c}}), not simply {{tmath|\textstyle ~\!\!\sqrt{s(s-a)(s-b)(s-c)}\! }}. For example, with {{tmath|1= a=3}}, {{tmath|1= b=4}}, {{tmath|1= c=6.999}}, the correct area is {{tmath|0.205}} but the naive implementation produces {{tmath|0.000}} instead. {{pb}} The area is reported as "Not a triangle" when the side lengths fail the [[triangle inequality]]. When the area is equal to zero, the three side lengths specify a [[degenerate triangle]] with three colinear points.</ref> |style="max-width: 4em" | {{calculator|type=plain|decimals=3|default=6.000|formula=sqrt((c+(b+a))*(a-(c-b))*(a+(c-b))*(c+(b-a)))/4|NaN-text=Not a triangle}} |}{{calculator|type=hidden|default=5|formula=max(a,b,c)|id=maxabc}}{{calculator|type=hidden|default=1|formula=1-ifpositive(min(a,b,c),0,1)|id=allnonneg}}<!-- Figure of the triangle using CSS. If allnonneg is 0, then the figure will be hidden. --><div style=" --scale: calc(160px / var(--calculator-maxabc,5) * var(--calculator-allnonneg,1)); --thickness: 3px; width: 240px; height: 150px; position: relative; display: inline-block;"> <div style=" width: calc(var(--calculator-c,5) * var(--scale)); border-top: var(--thickness) solid purple; left: 40px; top: 150px; position: absolute;"></div> <div style=" width: calc(var(--calculator-b,4) * var(--scale)); border-top: var(--thickness) solid green; transform: /* law of cosines */ rotate(calc(-1 * acos( (var(--calculator-c,5) * var(--calculator-c,5) + var(--calculator-b,4) * var(--calculator-b,4) - var(--calculator-a,3) * var(--calculator-a,3) ) / 2 / var(--calculator-b,4) / var(--calculator-c,5) ))); transform-origin: 0px calc(var(--thickness) / 2); /* rotate from the center of the line rather than the top */ left: 40px; top: 150px; position: absolute;"></div> <div style=" width: calc(var(--calculator-a,3) * var(--scale)); border-top: var(--thickness) solid orange; transform: rotate(calc(acos( (var(--calculator-c,5) * var(--calculator-c,5) + var(--calculator-a,3) * var(--calculator-a,3) - var(--calculator-b,4) * var(--calculator-b,4) ) / 2 / var(--calculator-a,3) / var(--calculator-c,5) ))); transform-origin: calc(var(--calculator-a,3) * var(--scale)) calc(var(--thickness) / 2); left: calc(40px + var(--calculator-c,5) * var(--scale) - var(--calculator-a,3) * var(--scale)); top: 150px; position: absolute;"></div> </div> </div> Let {{tmath|\triangle ABC}} be the triangle with sides {{tmath|1= a = 4}}, {{tmath|1= b = 13}}, and {{tmath|1= c = 15}}. This triangle's semiperimeter is <math>s = \tfrac12(a+b+c)= {}</math><math>\tfrac12(4+13+15) = 16</math> therefore {{tmath|1= s-a = 12}}, {{tmath|1= s-b =3}}, {{tmath|1= s-c =1}}, and the area is <math display=block>\begin{align} A &= {\textstyle \sqrt{s(s-a)(s-b)(s-c)}} \\[3mu] &= {\textstyle \sqrt{16 \cdot 12 \cdot 3 \cdot 1 \vphantom)} } \\[3mu] &= 24. \end{align}</math> In this example, the triangle's side lengths and area are [[integer]]s, making it a [[Heronian triangle]]. However, Heron's formula works equally well when the side lengths are [[real number]]s. As long as they obey the strict [[triangle inequality]], they define a triangle in the [[Euclidean plane]] whose area is a positive real number.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)