The side lengths of a triangle are consecutive integers.
The largest interior angle is twice the smallest.
What are the side lengths of the triangle?
DECLARE FUNCTION asin# (x#)
DECLARE FUNCTION acos# (x#)
DEFDBL A-Z
DIM SHARED pi
pi = 4 * ATN(1)
FOR s1 = 2 TO 45
s2 = s1 + 1: s3 = s2 + 1
' a^ = b^2 + c^2 - 2bc cosA
' cos A = (b^2 + c^2 - a^2)/(2bc)
cosSmall = (s2 ^ 2 + s3 ^ 2 - s1 ^ 2) / (2 * s2 * s3)
cosLarge = (s2 ^ 2 + s1 ^ 2 - s3 ^ 2) / (2 * s2 * s1)
small = acos(cosSmall)
large = acos(cosLarge)
PRINT USING "## ## ## "; s1; s2; s3;
PRINT USING " ###.#####"; small; large; large / small
NEXT s1
FUNCTION acos (x)
acos = 90 - asin(x)
END FUNCTION
FUNCTION asin (x)
IF ABS(x) = 1 THEN
asin = 90 * SGN(x)
ELSE
asin = ATN(x / SQR(1 - x * x)) * 180 / pi
END IF
END FUNCTION
finds
s1 s2 s3 angle 1 angle 3 ratio
2 3 4 28.95502 104.47751 3.60827
3 4 5 36.86990 90.00000 2.44102
4 5 6 41.40962 82.81924 2.00000
5 6 7 44.41531 78.46304 1.76658
6 7 8 46.56746 75.52249 1.62179
7 8 9 48.18969 73.39845 1.52312
8 9 10 49.45840 71.79004 1.45152
9 10 11 50.47880 70.52878 1.39720
10 11 12 51.31781 69.51268 1.35455
11 12 13 52.02013 68.67631 1.32019
12 13 14 52.61680 67.97569 1.29190
13 14 15 53.13010 67.38014 1.26821
14 15 16 53.57643 66.86760 1.24808
15 16 17 53.96812 66.42182 1.23076
16 17 18 54.31467 66.03052 1.21570
17 18 19 54.62346 65.68426 1.20249
18 19 20 54.90037 65.37568 1.19081
19 20 21 55.15010 65.09894 1.18040
20 21 22 55.37646 64.84934 1.17106
21 22 23 55.58261 64.62307 1.16265
22 23 24 55.77113 64.41700 1.15502
23 24 25 55.94420 64.22854 1.14808
24 25 26 56.10364 64.05552 1.14174
25 26 27 56.25101 63.89612 1.13591
26 27 28 56.38763 63.74879 1.13055
27 28 29 56.51462 63.61220 1.12559
28 29 30 56.63299 63.48523 1.12099
29 30 31 56.74357 63.36688 1.11672
30 31 32 56.84711 63.25632 1.11274
31 32 33 56.94427 63.15279 1.10903
32 33 34 57.03561 63.05564 1.10555
33 34 35 57.12165 62.96431 1.10228
34 35 36 57.20283 62.87828 1.09922
35 36 37 57.27956 62.79711 1.09633
36 37 38 57.35218 62.72039 1.09360
37 38 39 57.42103 62.64777 1.09102
38 39 40 57.48639 62.57893 1.08859
39 40 41 57.54851 62.51357 1.08628
40 41 42 57.60763 62.45145 1.08408
41 42 43 57.66397 62.39233 1.08200
42 43 44 57.71772 62.33600 1.08001
43 44 45 57.76905 62.28225 1.07812
44 45 46 57.81812 62.23093 1.07632
45 46 47 57.86507 62.18186 1.07460
Left out at the beginning is the degenerate triangle with sides 1, 2 and 3, where the smallest angle is 0 degrees and the largest 180, for an infinite ratio.
There's one obtuse triangle, then the familiar 3:4:5 right triangle.
Then comes the solution to the problem: 4:5:6 gives a 2:1 ratio between its largest and smallest angles.
The ratio is monotonically decreasing, approaching 1 as the sides approach the ratio of 1:1:1 of an equilateral triangle.
|
Posted by Charlie
on 2009-03-05 12:48:10 |