In
qball's Circular Logic, we were asked to determine the Area of the region common to a circle and a square, one vertex of which was at the center of the circle. The figure was drawn to show that e (the edge of the square) was greater than r (the radius of the circle), and the Area resolved to 25% that of the circle, or πrČ/4.
But what if e were less than r? The second and third verteces would be inside the circle, and the Area becomes a function of e (expressed as a fraction of r). When e is less than r/(√2), the fourth vertex is within the circle, and the area of the common region becomes the area of the square eČ
But what is the function f(x) such that A=f(e) for r ≥ e ≥ r/(√2) ?
Note: we already know that f(r) = πrČ/4, and f(r/(√2)) = rČ/2, because although the derivative of the greater function becomes discontinuous at these points, the function itself does not.
It was a comment by Manolo on the page for the original Circular Logic problem that suggested this one to me.
If we draw lines from the centre of the circle to the two circle-square intersection points we can see that the shared-area is divided into 3 sections: 2 identical right-angled triangles, with 1 circle-segment between them.
Let's say that the interior angle (near the centre of the circle) of the right-angled triangles is "a". This makes the angle of our circle segment to be "π/2 - 2a"
Let's find "a" to start things off:
Well, a simple way of evaluating it is:
Cos a = e/r
So: a = InvCos(e/r)
What else can we determine from this?
Well, we know for any angle: Sin²x + Cos²x = 1
So, here we have:
(e/r)² + Sin²a = 1
Sin²a = 1 - e²/r²
or
Sin²a = (r² - e²)/r²
So:
Sin a = (√(r² - e²))/r
Okay - that'll do for that.
So, the area of a single one of our right-angled triangles is:
er * Sin a
Or e * √(r² - e²)
And for our circle-segment, the area is:
(r² / 2) * (π/2 - 2*InvCos(e/r))
(where our InvCos value is expressed in radians, of course...)
So, the grand total area we get is:
(e*√(r²-e²))+(r²/2)*((π/2)-2*InvCos(e/r))
Putting either 'r' or 'r/√2' into the equation gives us as expected at our limits.
Obviously there's probably other ways of expressing this equation...