Let ABC be a triangle with side lengths a, b, c and a=2, b+2c=4. Find the value of c which maximizes the area of the triangle.
I did a numerical analysis essentially the same as Charlie with the same results.
But I wanted to attempt an exact solution. Here is my idea for a setup, but I kept getting math errors and so far have not reached a solution.
All triangles could be considered to have a base of 2 and an altitude which is the perpendicular distance from side a to Vertex A. Maximize the altitude and you maximize the Area.
Consider a physical construct where there are 2 vertices, C and B, 2 units apart on the undersurface of a horizontal beam.
A rope, 4 units long is attached on the left at C, travels down and to the right through a loop attached to a weight. From there, the rope goes up and right to a pulley at B and then back down and left again to the weight (which is at vertex A).
Minimizing the potential energy, the weight would come to rest as low as possible (maximizing the area).
If x is the horizontal distance from C (C is at x=0) to the x coordinate of A, then 2-x is the distance from there to B (B is at x=2). If h is the height (downward) of A:
x^2 + h^2 = b^2 eqn 1
(2-x)^2 + h^2 = c^2 eqn 2
b + 2c = 4 eqn 3
It should be possible to solve for h solely in terms of x and then differentiate with respect to x to find the maximum h. Then use eqn 2 to solve for c.
---------------
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)
a = 2
amax = -1
abcmax = []
for i in range(0,4000001):
b = i/1000000
c = 2 - b/2
area = areaHeron(a,b,c)
if area > amax:
amax = area
abcmax = [a,b,c]
print(amax, abcmax)
0.9840232795417484 [2, 1.829708, 1.085146]
Edited on September 5, 2023, 10:57 am
|
Posted by Larry
on 2023-09-04 17:32:09 |