File:Mrs Miniver's Problem.svg
Original file (SVG file, nominally 900 × 348 pixels, file size: 793 bytes)
Captions
Summary
[edit]DescriptionMrs Miniver's Problem.svg |
English: Three instances of Mrs. Miniver's problem, of arranging two circles so that their area of overlap equals the area of their symmetric difference. In each case the inner yellow area equals the total area of the surrounding blue regions. The left case shows two circles of equal areas, the right case shows one circle with twice the area of the other, and the middle case is intermediate between these two. |
Date | |
Source | Own work |
Author | David Eppstein |
Licensing
[edit]This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Source code
[edit]from math import pi,asin,sin,cos,acos
from PADS.SVG import *
import sys
# Circular segment formulas from https://en.wikipedia.org/wiki/Circular_segment
def areaFromRadius(r): return pi*r**2
def twoCircleArea(r1,r2): return areaFromRadius(r1)+areaFromRadius(r2)
def angleFromChord(r,c):
return 2*asin(c/(2*r))
def areaFromAngle(r,theta):
return r**2*(theta-sin(theta))/2
def areaFromChord(r,c):
theta = angleFromChord(r,c)
return areaFromAngle(r,theta)
def distanceToChord(r,c):
theta = angleFromChord(r,c)
return r*cos(theta/2)
def separationFromChord(r1,r2,c):
return distanceToChord(r1,c)+distanceToChord(r2,c)
# Bisection to solve Mrs. Miniver's problem within floating point accuracy
def miniverSeparation(r1,r2):
if r1 > r2: r1,r2 = r2,r1 # make sure small circle first
totalArea = twoCircleArea(r1,r2)
targetArea = totalArea/3
def miniverTest(x):
# x = cos(chord on small circle), -1: outside, 1: inside
chord = 2*r1*sin(acos(x))
area1 = areaFromChord(r1,chord)
if x > 0:
area1 = areaFromRadius(r1) - area1
area2 = areaFromChord(r2,chord)
return area1 + area2 < targetArea
lo,hi = -1.0,1.0
for i in range(100):
mid = (hi+lo)/2
if miniverTest(mid):
lo = mid
else:
hi = mid
chord = 2*r1*sin(acos(mid))
return distanceToChord(r2,chord) - r1*mid
# Make it into a nice picture
# Monochromatic and with a loose frame for now; we'll fix it up later
gridUnit = 150
targetArea = 100000.0
boundingBox = (6+4j)*gridUnit
output = SVG(boundingBox,sys.stdout)
output.group(fill="none",stroke="#000")
for i in (0,1,2):
ratio = 2.0**(i*0.25)
areaWhenSmall = twoCircleArea(1.0,ratio)
factor = (targetArea/areaWhenSmall)**0.5
r1,r2 = factor,factor*ratio
s = miniverSeparation(r1,r2)
o = (1+2j+2*i)*gridUnit
output.circle(o + (s+r2-r1)*0.5j, r1)
output.circle(o - (s+r1-r2)*0.5j, r2)
output.ungroup()
output.close()
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 19:35, 29 May 2022 | 900 × 348 (793 bytes) | David Eppstein (talk | contribs) | Keep outer circles as circles for tighter svg coding; should be no visible change | |
06:48, 29 May 2022 | 900 × 348 (1 KB) | David Eppstein (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikipedia.org
- Usage on pt.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 900 |
---|---|
Height | 348 |