Let ABC be a triangle with integral side lengths such that angle A=3 * angle B. Find the minimum value of its perimeter.
The smallest perimeter is 21, with the sides being 10, 3, and 8, as shown in the output below.
The program goes in increasing value of perimeter, making sure a valid triangle is formed and uses the law of cosines to find the angles. Each angle is divided by each other angle to try to find a ration of 3. A leeway allows for rounding error. The full ratio is printed out to verify closer.
clearvars,clc
for peri=3:10000
for aa=1:ceil((peri-1)/2)
s(1)=aa;
for bb=aa+1:(peri-aa)/2
s(2)=bb;
s(3)=peri-aa-bb;
m=max(s);
if m<sum(s)/2
for i=1:3
a=s(i);
b=s(mod(i,3)+1);
c=s(mod(i+1,3)+1);
A=acos((b^2+c^2-a^2)/(2*b*c));
Angle(i)=A;
end
for i=1:3
for j=1:3
r=Angle(i)/Angle(j);
if abs(r-3)<.0000001
if gcd(a,gcd(b,c))==1
fprintf('%4d %4d %4d %16.14f\n%16.14f %16.14f %16.14f\n\n',[a b c r rad2deg(Angle)])
% disp([a b c r Angle(1) Angle(2) Angle(3) ])
end
end
end
end
end
end
end
end
finds the first several:
The angles are shown converted to degrees.
A triangle is shown only if the GCD of the sides is 1; any multiple will work.
Each line pair shows:
a b c ratio of angles
A B C
10 3 8 3.00000000000000 Perimeter is 21.
14.36151156291656 41.40962210927086 124.22886632781260 Angles in degrees
48 27 35 3.00000000000000
33.55730976192071 45.77076095231714 100.67192928576215
132 64 119 3.00000000000000
28.95502437185985 64.17990251256060 86.86507311557955
195 112 125 3.00000000000000
32.52040941662392 36.86989764584401 110.60969293753207
280 125 279 3.00000000000000
25.84193276316713 76.63226894733148 77.52579828950140
357 20 343 3.00000000000000
2.33876561122814 44.41530859719298 133.24592579157894
504 253 343 3.00000000000000
27.14715719304725 38.21321070173819 114.63963210521457
539 216 510 3.00000000000000
23.55646430910123 70.66939292730369 85.77414276359508
627 348 467 3.00000006940735 Not exactly 3x
33.18395898992768 47.26416173707855 99.55187927299377 slipped by the epsilon
665 343 552 3.00000000000000
31.00271913387399 55.98912346450405 93.00815740162197
792 91 729 3.00000000000000
4.95302922928078 43.76174269267980 131.28522807803941
Operation terminated by user during tripleAnglePerimeterMin
>>
|
Posted by Charlie
on 2023-12-08 08:48:07 |