Consider the three disk regions plotted here, where of course I had to set a single radius (scale) to make an actual plot:

enter image description here

But in my actual problem, the scale is not set. For instance, we can set the radius of the large green disk to be $x>0$, and without loss of generality place its center at the origin.

I'm interested in the area of the dark orange wedge, as well as the length of its perimeter.

Thus I define the regions symbolically as follows:

\[ScriptCapitalR]left = Disk[{0, x/2}, x/2];
\[ScriptCapitalR]top = Disk[{x/2, x}, x/2];
\[ScriptCapitalR]big = Disk[{0, 0}, x];
\[ScriptCapitalR]goal = 
   RegionIntersection[\[ScriptCapitalR]top, \[ScriptCapitalR]big], \
Assuming[x > 0, RegionMeasure[\[ScriptCapitalR]goal]]

I get the RegionMeasure (i.e., area) just as I seek... in terms of $x$:

$$\frac{1}{8} x^2 \left(-2+\pi -\tan ^{-1}\left(\frac{44}{117}\right)\right)$$


Now I try to find its perimeter. First I define its boundary:

\[ScriptCapitalR]goalBoundary = 
  Assuming[x > 0, RegionBoundary[\[ScriptCapitalR]goal]];

Now, I try to find the length of its perimeter:




and I get no answer.

However, if I set a particular value for $x$, I get the perimeter fine:

ArcLength[\[ScriptCapitalR]goalBoundary] /. x -> 1

$$\frac{1}{4} \left(\pi +2 \sin ^{-1}\left(\frac{3}{5}\right)+4 \sin ^{-1}\left(\frac{4}{5}\right)\right)$$

(Of course I can plot and visualize the boundary only if I set a value for $x$, as in: RegionPlot[\[ScriptCapitalR]goalBoundary /. x -> 1]. Again, fine.)

How do I compute the perimeter symbolically for arbitrary $x>0$?

Of course I could solve for $x \to 1$ and then exploit my knowledge that the perimeter scales as $x$, but I'm looking for a more general solution (applicable to other problems) that relies on symbolic computation, not my "human understanding" of dimensional scaling.

  • $\begingroup$ What version are you running? in 12.3 your successful call to ArcLength returns a machine number 2.034443787674293. $\endgroup$
    – Greg Hurst
    Aug 27, 2021 at 20:30
  • $\begingroup$ I'm running 11.3. Nevertheless, your answer does not address my core problem: You certainly assume $x \to 1$, which works fine for me too. What is your answer FOR ARBITRARY $x$? Your answer must have an $x$ somewhere in it. See? $\endgroup$ Aug 27, 2021 at 20:31
  • $\begingroup$ Correct, I had just noticed the discrepancy when running your examples. $\endgroup$
    – Greg Hurst
    Aug 27, 2021 at 20:32
  • $\begingroup$ Since the top and left disks are the same size, the perimeter of the $R_{goal}$ is the same as the perimeter of $R_{big}\cap R_{top}$, if that helps. To see this, look at the boundary of $R_{left}\cap R_{top}$. $\endgroup$
    – LouisB
    Aug 27, 2021 at 20:39
  • $\begingroup$ This is more of a workaround. Sometimes when I can't get a symbolic answer out, I'll substitute a mathematical constant for a variable, run the calculation, then sub back. This of course does not guarantee the result is correct for all $x$ in your domain, but in a pinch it can work. (ArcLength[\[ScriptCapitalR]goalBoundary] /. x -> EulerGamma) /. EulerGamma -> x. You also need to be sure that your constant won't show up in the answer naturally, otherwise the backsub is wrong. $\endgroup$
    – Greg Hurst
    Aug 27, 2021 at 20:40

2 Answers 2


For this particular example expressing the region as ImplicitRegion returns an arclength.

One such way to find defining implicit conditions for a region is through RegionMember. Unfortunately it does not know the conditions for the boundary of our region:

RegionMember[\[ScriptCapitalR]goalBoundary, {a, b}] // Head
(* RegionMember *)

However there's a trick to find the implicit boundary of a semialgebraic region. Find the implicit representation of the region itself and then find its boundary through CylindricalDecomposition.

Rcond = RegionMember[\[ScriptCapitalR]goal, {a, b}];

Rbdcond = CylindricalDecomposition[Rcond, {x, b, a}, "Boundary"];

Rimplicit = ImplicitRegion[Rbdcond, {a, b}];

And the arclength, which comes back after some time on my machine:

Assuming[x > 0, ArcLength[Rimplicit]] // AbsoluteTiming
{17.7282, x ArcTan[4/3] + x ArcTan[2]}
  • $\begingroup$ Oh hey... wonderful. Thanks so much for working on this. This is the second time I've been "saved" by CylindricalDecomposition this week, and I hadn't heard of it before. I confess I really don't understand it... and the documentation could be clearer. But it works, and most importantly is of the style and constraints I laid out. Very helpful. Bravo. ($\checkmark$) $\endgroup$ Aug 28, 2021 at 4:58
  • $\begingroup$ Now I get it. Now I get it. A very powerful function. I will use CylindricalDecomposition a lot now. Basically: given an inequality, break it into inequalities for each of the variables, as will be useful in lots of multi-dimensional integrals. $\endgroup$ Aug 28, 2021 at 5:14
  • $\begingroup$ Correct, and described formally at this bullet here: reference.wolfram.com/language/ref/… $\endgroup$
    – Greg Hurst
    Aug 28, 2021 at 15:26
  • $\begingroup$ Yes, I had read that bullet, but (since you're at WRI) I must say it could have been explained better. Why is it called CYLINDRICALDecomposition, after all? I only understood it from working through the examples. You could add examples where a region is defined by intersecting disks, or rectangles, then gets converted fully to an integral over the region. Anyway, a very useful function. Thanks to all the mathematicians and coders who brought it to us. $\endgroup$ Aug 28, 2021 at 15:57
  • $\begingroup$ (Was at wri). That’s the nomenclature for problem, but it’s referring to a more general type of cylinder. That part of the name confused me at first too. See en.m.wikipedia.org/wiki/Cylinder_set $\endgroup$
    – Greg Hurst
    Aug 28, 2021 at 16:08

We want to calculate the arc length of the path along A-B-C-A. There are two paths from C to A. Both paths have the some length, so we choose the one along the top circle. We first calculate the length of the chord from A to B. The chord length is used calculate the arc length from A to B along the big circle and the arc length from B to A along the top circle. The left disk is not used in this solution.

enter image description here

The easy way to get the coordinates of B is to reflect A across the line from the center of the big circle to the center of the top circle. The formulas for the arc length and included angle are from here. $\theta_1$ is the central angle of the top circle subtended by the chord $A B$. $\theta_2$ is the central angle of the big circle subtended by the chord $A B$.

enter image description here

Here is the calculation:

cTop = {x/2, x};
v1 = Simplify[Normalize[cTop], x > 0] ;
v2 = RotationTransform[π/2][v1] ;
ptA = {0, x} ;
ptB = ReflectionMatrix[v2].ptA;
chord = Simplify[Norm[ptB - ptA], x > 0];
θ1 = 2 ArcSin[chord/(x)];
s1 = x θ1/2;
θ2 = 2 ArcSin[chord/2/x];
s2 = x θ2;
perimeter = s1 + s2
perimeter /. x -> 1.0

The resulting arc length is $$x \sin ^{-1}\left(\frac{2}{\sqrt{5}}\right)+2 x \sin ^{-1}\left(\frac{1}{\sqrt{5}}\right)$$

Code for the graphics follows

With[{x = 1}, Graphics[{{Opacity[.1], Blue, Disk[{0, x/2}, x/2],
    Orange, Disk[{x/2, x}, x/2], Green, Disk[{0, 0}, x]},
   {Red, Text["A", {0, x}],
    Text["B", {4 x/5, 3 x/5}],
    Text["C", {x/2, x/2}]}},
  PlotRange -> {{0, 1}, {0, 3/2}}, Axes -> True,
  ImageSize -> Small, Frame -> True]

disks = {Opacity[.2], Green, Disk[{0, x/2}, x/2],
   Disk[{x/2, x}, x/2], Disk[{0, 0}, x]};
lines = {Black, Line[{{0, 0}, {x/2, x}}], Dashed,
   Line[{{0, x}, {2 x, 0}}]};
points = {PointSize[.015], Red, Point[ptA], Magenta, Point[ptB]};
vectors = {Red, Arrow[{{0, 0}, v1/2}], Blue, Arrow[{{0, 0}, v2/2}]};

Graphics[{disks, lines, vectors, points} /. x -> 1,
 PlotRange -> {{-1, 2}, {0, 3/2}}, Axes -> True,
 GridLines -> {Range[-1, 2, .5], Range[0, 1.4, .2]},
 ImageSize -> Medium, Frame -> True]
  • $\begingroup$ What is pt1? And did you include all three arcs? I don't see that. $\endgroup$ Aug 28, 2021 at 1:04
  • $\begingroup$ Show be ptA. I'll fix it. -- Done! $\endgroup$
    – LouisB
    Aug 28, 2021 at 1:06
  • $\begingroup$ Your result agrees with mine (for $x \to 1$) so I trust you're correct. Thanks ($+1$). But as I wrote I was hoping to leverage the symbolic manipulation "smarts" of Mathematica rather than do most of the analysis "by hand" and then just implement it in Mathematica. After all, that works fine for the area. I still don't understand why it doesn't work for perimeter. And I want to easily compute other measures, such as the wedge region's center of mass, without having to go through the traditional calculations I would without the benefit of Mathematica. Let's see if someone figures it. $\endgroup$ Aug 28, 2021 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.