Jump to content

File:Mrs Miniver's Problem.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 900 × 348 pixels, file size: 793 bytes)

Summary

Description
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

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero 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.

Source code

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()

Captions

Three instances of Mrs. Miniver's Problem

Items portrayed in this file

depicts

28 May 2022

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:35, 29 May 2022Thumbnail for version as of 19:35, 29 May 2022900 × 348 (793 bytes)David EppsteinKeep outer circles as circles for tighter svg coding; should be no visible change
06:48, 29 May 2022Thumbnail for version as of 06:48, 29 May 2022900 × 348 (1 KB)David EppsteinUploaded own work with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata