Three circles of radius 6, 7, and 8 are externally tangent to each other. There exists a smaller circle tangent to all three (in the space created between the three original circles).
What is the radius of this smallest circle?
Using Heron's formula for area, calculate the sum of the area of the three small triangles and compare that to the area of the large trianle. They should be equal. Adjust the value of 'r' until the difference is very small.
I found r = about 1.07006369426752
Python code follows:
def areaHeron(a,b,c):
""" input 3 float numbers, the 3 sides of a triangle
output the area """
s = (a+b+c)/2 # semiperimeter
return (s*(s-a)*(s-b)*(s-c))**(1/2)
def calcR(r):
""" input radius guess for the small circle,
return the error between the calculated area of
the three smaller triangles vs the total triangle
specifically for radii of 6, 7, 8 units """
a1 = areaHeron(6+7,6+r,7+r)
a2 = areaHeron(6+8,6+r,8+r)
a3 = areaHeron(7+8,7+r,8+r)
aTotal = areaHeron(6+7,6+8,7+8)
return a1+a2+a3 - aTotal
epsilon = .0000000000001
hi = 2 # initial guesses for r and the range of r
lo = 1
r= 1.5
while abs(calcR(r)) > epsilon: # divide and conquer search for best r
if calcR(r) > 0:
hi = r
r = (lo + r)/2
elif calcR(r) < 0:
lo = r
r = (r + hi)/2
elif calcR(r) == 0:
print('found r exactly')
break
print(r, calcR(r))
Output: 1.0700636942675175 5.684341886080802e-14
Edited on November 18, 2019, 11:33 am
|
Posted by Larry
on 2019-11-18 11:29:59 |