Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the area of a triangle from the edge lengths
ResourceFunction["HeronFormula"][{a,b,c}] gives the area of the triangle with edge lengths {a,b,c}. |
A 3-4-5 right triangle has area 6:
In[1]:= |
|
Out[1]= |
|
A 13-14-15 triangle has area 84:
In[2]:= |
|
Out[2]= |
|
HeronFormula works for inexact side lengths:
In[3]:= |
|
Out[3]= |
|
HeronFormula works for symbolic arguments:
In[4]:= |
|
Out[4]= |
|
Side lengths corresponding to a degenerate triangle will give a zero result:
In[5]:= |
|
Out[5]= |
|
If the triangle inequality is not satisfied, HeronFormula remains unevaluated:
In[6]:= |
|
Out[6]= |
|
In[7]:= |
|
Out[7]= |
|
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License