This is the problem.

A circular corral of unit radius is enclosed by a fence. A goat inside the corral is tied to the fence with a rope of length $0 \le a \le 2$ (see figure). What is the area of the region (inside the corral) that the goat can graze? Check your answer with the special cases $a=0$ and $a=2$.

See figure:


This is what I have so far.


I figured that I can't do filling with PolarPlot and I wonder what are the alternative ways of showing the problem in Mathematica.

I think ultimately I will need something that look like this: (Blue is the shaded part)



4 Answers 4


Try this:

d1 = Disk[{0, 0}, 1];
d2 = Disk[{0, 1}, 1];
d3 = RegionIntersection[d1, d2];
  Graphics[{White, EdgeForm[Directive[Red, Thick]], d2}],
  RegionPlot[d3, PlotStyle -> Blue, BoundaryStyle -> {Red, Thick}]

enter image description here

Have fun!


Here's a tasty one-liner solution for the computational part of the problem!

Simplify@Integrate[1, {x, y} \[Element] RegionIntersection[Disk[], Disk[{1, 0}, a]], GenerateConditions -> True]

Area formula


Using Manipulate allows you to easily vary the radius. You could do all your plotting with RegionPlot, but I found this way gave higher quality plots more easily.

 regint = RegionIntersection[Disk[{0, 0}, 1], Disk[{0, 1}, a]];
 Show[Graphics[{EdgeForm[Directive[Thick, Black]], LightBlue, 
    Disk[{0, 0}, 1]}], 
  Graphics[{EdgeForm[Directive[Black, Dashed]], LightGreen, 
    Disk[{0, 1}, a]}], 
  RegionPlot[regint, BoundaryStyle -> Directive[Red, Thick], 
   PlotStyle -> Blue], PlotRange -> {{-2, 2}, {-1, 3}}, 
  PlotLabel -> "Area = " <> ToString[RegionMeasure@regint]],
 {{a, Sqrt[2]}, 0, 2}]

enter image description here


Just extending @AlexeiBoulbitch nice answer:

reg[a_] := RegionIntersection[Disk[], Disk[{0, 1}, a]]
rp[a_] := 
 With[{region = reg[a]}, 
   Epilog -> {Red, PointSize[0.02], Point[{0, 1}], Black, Circle[], 
     Text[Style[Area@region, 20, Bold], {0, 0}]}, 
   PlotRange -> Table[{-1, 1}, 2]]]
tab = Table[rp[a], {a, 0.1, 2, 0.1}];

The table exported as an animated gif:

enter image description here

The area can determined as above using Area on Region or you can calculate yourself,e.g. the sum of the orange and black areas:

enter image description here

For example (I did not "deal with a=0"):

int[a_] := {x, y} /. 
  NSolve[{x^2 + y^2 == 1, x^2 + (y - 1)^2 == a^2}, {x, y}, Reals]
ar1[a_] := VectorAngle @@ ({#1, #2 - 1} & @@@ int[a]) a^2/2
ar2[a_] := Module[{i = int[a], v},
  v = VectorAngle[i[[1]], {0, 1}];
  v - Norm[i[[1]] - {0, 1}] Cos[v/2]]
aint[a_] := ar1[a] + ar2[a]
Table[{j, Area@reg[j], aint[j]}, {j, 0.1, 2, 0.1}] // 
 TableForm[#, TableHeadings -> {None, {"a", "Method 1", "Method 2"}}] &

enter image description here


Your Answer

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

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