Determine a cuboid with minimal surface area, if its volume is strictly greater than 1000, and the lengths of its sides are integer numbers.
clc
fprintf('%s\n'," edges area volume")
minimum=9999999;
for a=1:20
for b=a:20
for c=b:20
if a*b*c>1000
A=2*(a*b+b*c+a*c);
if A<=minimum
fprintf('%2d %2d %2d %5d %5d\n',a,b,c,A,a*b*c)
minimum=A;
end
end
end
end
end
finds the increasingly smaller areas:
edges area volume
3 17 20 902 1020
4 13 20 784 1040
4 14 18 760 1008
5 11 19 718 1045
5 12 17 698 1020
6 9 19 678 1026
6 10 17 664 1020
6 12 14 648 1008
7 9 16 638 1008
7 11 13 622 1001
8 9 14 620 1008
The last is the best: 8 x 9 x 14 results in an area of 620, with a volume of 1008.
|
Posted by Charlie
on 2021-02-17 10:05:26 |