# Exact symbolic area of an intersection of two regular pentagons with parameters

The question of finding the area of intwrsection of two regions with parameters has been answered here using and RegionIntersection with delimeter GenerateConditions -> All. More sophisticated example, for which Mathematica does not return any answer, is as follows.

Consider a vertices of a regular pentagon

regulPen[i_] := {Cos[-((2 \[Pi])/5) + (2 \[Pi])/5 i], Sin[-((2 \[Pi])/5) + (2 \[Pi])/5 i]};


We now rotate this pentagon by $$\pi/5$$, forming a new pentagon with vertices

regulPenShif[i_] := {Cos[-(\[Pi]/5) + (2 \[Pi])/5 i], Sin[-(\[Pi]/5) + (2 \[Pi])/5 i]};


The area of intersection of these pentagons is $$\frac12 \sqrt{\frac52(5+\sqrt{5})}$$, which is confirmed by Mathematica. Now we shift the center of the second pentagon into the point $$\{p,q\}$$, the area of intersection should now depend on $$\{p,q\}$$, however

Area[RegionIntersection[
Polygon[{regulPen,
regulPen,
regulPen,
regulPen,
regulPen}],
Polygon[{regulPenShif + {p, q},
regulPenShif + {p, q},
regulPenShif + {p, q},
regulPenShif + {p, q},
regulPenShif + {p, q}}]],
GenerateConditions -> All]


returns itself. How to refine the code such that Mathematica will solve that indeed?

You can't get an exact symbolic area of the intersection of two regular pentagons with parameters when the parameters are symbolic because Area is a computational function like NIntegrate and not symbolic expression manipulator like Integrate. Even the result you show isn't symbolic; it is just exact.

The best we can do is define a numeric evaluator for the area of the intersection. Like so:

regulPen[i_] := {Cos[-((2 π)/5) + (2 π)/5 i], Sin[-((2 π)/5) + (2 π)/5 i]}
regulPenShif[i_] := {Cos[-(π/5) + (2 π)/5 i], Sin[-(π/5) + (2 π)/5 i]}
area[{p_?NumericQ, q_?NumericQ}] :=
With[
{poly =
Polygon[{regulPen, regulPen, regulPen, regulPen, regulPen}]},
area[{p_?NumericQ, q_?NumericQ}] :=
N @
Area[
RegionIntersection[
poly,
Polygon[
{regulPenShif + {p, q}, regulPenShif + {p, q},
regulPenShif + {p, q}, regulPenShif + {p, q},
regulPenShif + {p, q}}]]]]


Then we can make a demonstration allowing us to see one the pentagons shifting around while the area of intersection is computed. Like so:

With[
{poly =
Polygon[{regulPen, regulPen, regulPen, regulPen, regulPen}],
spacer = Invisible["mmmmmmmmmmmm"]},
Manipulate[
Column[
{Graphics[
{EdgeForm[Black], FaceForm[],
poly,
Polygon[
{regulPenShif + pq, regulPenShif + pq, regulPenShif + pq,
regulPenShif + pq, regulPenShif + pq}]},
ImageSize -> Medium],
Style[Row[{"Shift: ", pq, "    Area: ", area[pq]}], "SR"]},
Center],
{{pq, {0, 0}, Style[Row[{spacer, "Shift "}], 16]}, {-1, -1}, {1, 1}, {.05, .05},
ImageSize -> {175, 175}},
ControlPlacement -> Bottom]] Your code works for concrete p,q in 12.2, e.g.

p = -1/4; q = 1/2; Area[RegionIntersection[Polygon[{regulPen, regulPen,
regulPen, regulPen,regulPen}],Polygon[{regulPenShif + {p, q}, regulPenShif +{p, q},
regulPenShif + {p, q}, regulPenShif +{p, q}, regulPenShif + {p, q}}]]]


1/2 (1/4 (1 - Sqrt) ((Sqrt[5 + Sqrt] (-4 Sqrt + Sqrt))/( 4 (-5 + Sqrt)) + 1/4 (2 - Sqrt[2 (5 + Sqrt)]) +..

, but a long output is not very useful.

• But this result isn't a conditions expressed symbolically in terms of p and q, which is what I believe the OP is asking for. It is just an exact result for a particular pair of exact numbers. Dec 18 '20 at 9:26
• @m_goldberg: As well as yours. Dec 18 '20 at 10:20