TIP: Click on subject to list as thread! ANSI
echo: science
to: Miles Maxted
from: DAVID WILLIAMS
date: 2005-10-04 21:36:58
subject: Re: math question

-> Well, I've succumbed and determined the radius of one circle to be  
-> 2.5231325 odd cms before calculating the angle of a chord whose  
-> area was 4.5cms^2  -  half of the overlap of 9cms^2 needed between  
-> any two squares  -  at 126.84910 degrees or so. 
  
Here's the program I wrote, in QBasic. Notes below: 
  
----------------------------------------------- 
  
DEFDBL A-Y 
DEFLNG Z 
CLS 
PI = 4 * ATN(1) 
K = 9 * PI / 20 
L = 1.6 
H = 3 
DO 
 A = (L + H) / 2 
 IF ABS(H - L) < 1E-15 THEN EXIT DO 
 IF A - SIN(A) > K THEN H = A ELSE L = A 
LOOP 
D = COS(A / 2) 
X1 = -D: Y1 = 0 
X2 = D: Y2 = 0 
X3 = 0: Y3 = D * SQR(3) 
Z1 = 0: Z2 = 0: Z3 = 0 
FOR X = X1 - 1 TO X1 + 1 STEP .01 
 FOR Y = -1 TO 1 STEP .01 
   DX = X - X1: DY = Y - Y1 
   IF DX * DX + DY * DY < 1 THEN 
    Z1 = Z1 + 1 
    DX = X - X2: DY = Y - Y2 
    IF DX * DX + DY * DY < 1 THEN 
     Z2 = Z2 + 1 
     DX = X - X3: DY = Y - Y3 
     IF DX * DX + DY * DY < 1 THEN 
      Z3 = Z3 + 1 
     END IF 
    END IF 
   END IF 
 NEXT 
NEXT 
F = 20 / Z1 
PRINT F * Z2, F * Z3 
  
----------------------------------- 
  
The DO...LOOP does a binary search for the angle subtended at the 
centre of a circle by the area of overlap. A is the answer, and comes 
to about 2.214 radians. 
  
The FOR...NEXT loops produce a uniform distribution of test point, and 
counts how many are within one circle, within the area of overlap of 
two circles, and within the are of overlap of all three circles. 
Knowing that the area of each circle is 20 cm^3, it calculates and 
prints the other two areas. 
  
I couldn't be bothered to optimize it, but it works. 
  
                               dow 
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)
SEEN-BY: 633/267 270
@PATH: 250/514 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.