All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 All integers (Posted on 2005-01-17)
The sides of a trapezoid are 5, 8, 11, and 13, and its diagonals are also integer numbers; what are they?

 See The Solution Submitted by Federico Kereki Rating: 4.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Programmed Correctly Now | Comment 13 of 14 |
(In reply to re: Solution, by hand by Charlie)

By using an appropriate implementation of the arccos function the program now finds the solution:

DEFDBL A-Z
pi = ATN(1) * 4
DEF fnas (x) = ATN(x / SQR(1 - x * x))
DEF fnac (x) = pi / 2 - fnas(x)
CLS
top = 8: bottom = 13: left = 5: right = 11
GOSUB findEm
top = 5: bottom = 13: left = 8: right = 11
GOSUB findEm
top = 8: bottom = 11: left = 5: right = 13
GOSUB findEm
top = 8: bottom = 5: left = 13: right = 11
GOSUB findEm
top = 5: bottom = 11: left = 8: right = 13
GOSUB findEm
top = 11: bottom = 13: left = 5: right = 8
GOSUB findEm
END

findEm:
FOR d1 = 1 TO top + left - 1
csn = ((top * top + left * left - d1 * d1) / (2 * top * left))
IF ABS(csn) > 1 AND ABS(csn) - 1 < .000001 THEN csn = SGN(csn)
IF d1 < bottom + right AND ABS(csn) <= 1 THEN
IF ABS(csn) = 1 THEN
a = (pi / 2) * (1 - SGN(csn))
ELSE
a = fnac(csn)
END IF
alt1 = left * COS(a - pi / 2)
a1 = a: cs1 = csn
FOR d2 = 1 TO top + right - 1
csn = ((top * top + right * right - d2 * d2) / (2 * top * right))
IF ABS(csn) > 1 AND ABS(csn) - 1 < .000001 THEN csn = SGN(csn)
IF d2 < bottom + left AND ABS(csn) <= 1 THEN
IF ABS(csn) = 1 THEN
a = (pi / 2) * (1 - SGN(csn))
ELSE
a = fnac(csn)
END IF
alt2 = right * COS(a - pi / 2)
a2 = a: cs2 = csn
r = alt1 / alt2
IF ABS(r - 1) < .00000001# THEN
o1 = left * SIN(a1 - pi / 2)
o2 = right * SIN(a2 - pi / 2)
b = top + o1 + o2
PRINT USING "### ### ### ###    ### ###   ##.#####   ###.##### ###.#####    ###.######"; top; bottom; left; right; d1; d2; alt1; o1; o2; b
END IF
END IF
NEXT
END IF
NEXT
RETURN

resulting in:

`top"bot" lt rt     d1  d2     alt.      overhang 1 overhang 2    bottom 8  13   5  11     11   5    4.58258     2.00000 -10.00000      0.000000 5  13   8  11     11   8    7.33212     3.20000  -8.20000     -0.000000 8   5  13  11      9   9    8.87412    -9.50000  -6.50000     -8.000000 8   5  13  11      9  17    8.87412    -9.50000   6.50000      5.000000 8   5  13  11     11  13   10.95445    -7.00000  -1.00000      0.00000011  13   5   8      8   5    3.33278    -3.72727  -7.27273      0.000000`

 Posted by Charlie on 2005-01-18 20:42:43

 Search: Search body:
Forums (0)