Function Repository Resource:

GeometricSolve

Source Notebook

Solve for a given quantity in a geometric scene

Contributed by: Daniel McDonald

ResourceFunction["GeometricSolve"][scene,expr]

solves for the quantity expr defined by the GeometricScene scene.

ResourceFunction["GeometricSolve"][scene,{expr1,expr2,}]

returns a list containing the solutions of scene for expr1,expr2, ….

Details and Options

Each separate solution is returned as a List.
Solution components are returned in the form expr1value1, expr2value2, ….

Examples

Basic Examples (3) 

Solve for the hypotenuse of a right triangle:

In[1]:=
ResourceFunction["GeometricSolve"][
 GeometricScene[{a, b, c}, {Triangle[{a, b, c}], PlanarAngle[{a, b, c}] == 90 \[Degree], EuclideanDistance[a, b] == 3, EuclideanDistance[b, c] == 4}],
 EuclideanDistance[a, c]
 ]
Out[1]=

Compute the area of a specific triangle:

In[2]:=
ResourceFunction["GeometricSolve"][
 GeometricScene[{a, b, c}, {a == {0, 0}, b == {0, 4}, c == {5, 3}, p == Polygon[{a, b, c}]}],
 Area[p]
 ]
Out[2]=

Compute the area of a triangle where one point has an unknown but positive x value:

In[3]:=
ResourceFunction["GeometricSolve"][
 GeometricScene[{a, b, c}, {a == {0, 0}, b == {0, 4}, c == {d, 5}, d > 0, p == Polygon[{a, b, c}]}],
 Area[p]
 ]
Out[3]=

Scope (2) 

For a generic triangle, there are two possible solutions for the area, only one of which will have the correct sign for a specific numeric instantiation of the parameters:

In[4]:=
ResourceFunction["GeometricSolve"][
 GeometricScene[{a, b, c}, {p == Polygon[{a, b, c}]}],
 Area[p]
 ]
Out[4]=

Find an instance of a scene:

In[5]:=
scene = RandomInstance[
  GeometricScene[{a, b, c, d}, {Triangle[{a, b, c}], CircleThrough[{a, b, c}, d], Line[{a, d, c}]}]
  ]
Out[5]=

Solve for the point a, the distance between points a and c and the area of the triangle in this scene instance:

In[6]:=
ResourceFunction[
 "GeometricSolve"][scene, {a, EuclideanDistance[a, c], Area[Triangle[{a, b, c}]]}]
Out[6]=

Publisher

Daniel McDonald

Requirements

Wolfram Language 12.2 (December 2020) or above

Version History

  • 1.0.0 – 07 December 2020

Author Notes

Requires Version 12.2.

License Information