Find a triangle with area 168, whose side lengths are integers, with all three vertices lying on a circle whose radius is a perfect square.
Circumcircle of a triangle with sides a,b,c has a radius R, where
R = abc/(4*area)
/*
(I tried a shortcut which turned out not to work)
If triangle with sides abc happens to be a right triangle, with c being the hypotenuse, then the area would be ab/2.
R = abc/(4*ab/2) = c/2
If R is a perfect square then c = twice a perfect square
Some Pythagorean triples are:
3 4 5
5 12 13
7 24 25 <-- c is a square, but we need c to be twice a square
Just double all the sides:
14 48 50 works in that the radius is 25, a perfect square.
Radius = 25 (a perfect square)
Area = 336 (not 168)
So this triangle is not the solution. The solution is likely not a right triangle. It was worth a try.
*/
The area of a triangle with sides 1, 336, 336 is close to 168, so the longest side cannot be larger than 336.
A program finds only one triangle that fits all the criteria:
Solution: (14,30,40)
Three other triangles had the right area, but the radius was not a square
10 35 39
14 25 25
25 25 48
------------------------------
def areaHeron(a,b,c):
""" input 3 float numbers, the 3 sides of a triangle
output the area """
if c >= a+b or b >= a+c or a >= b+c:
return 0
s = (a+b+c)/2 # semiperimeter
return (s*(s-a)*(s-b)*(s-c))**(1/2)
def issquare(n):
""" Input an integer, Returns True iff it is a perfect square. """
if round(n**0.5)**2 == n:
return True
else:
return False
epsilon = .0000001
for a in range(1,400):
for b in range(a,400):
for c in range(b,400):
area = areaHeron(a,b,c)
if area != 168:
if abs(area - 168) < epsilon:
print('close', a,b,c, area)
continue
print(a,b,c)
try:
radius = a*b*c/(4*area)
except:
continue
if issquare(radius):
print('({},{},{}) with radius {} and area {}'.format(a,b,c,radius,area))
program output:
10 35 39
14 25 25
14 30 40
(14,30,40) with radius 25.0 and area 168.0
25 25 48
|
Posted by Larry
on 2024-03-07 08:53:06 |