PQR is a triangle with PQ = 33, PR= 21 and QR = X, where X is an integer.
There are points S and T on the sides PQ and PR respectively such that PS=ST=TR = Y, where Y is an integer.
Find X.
The program finds length of ST for all possible combinations of X and Y (used in determining PS and TR). If it equals Y, it's the solution.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For x = 13 To 53
cosp = (33 * 33 + 21 * 21 - x * x) / (2 * 33 * 21)
For y = 1 To 20
st = Sqr(y * y + (21 - y) * (21 - y) - 2 * y * (21 - y) * cosp)
diff = Abs(st - y)
If diff / y < 0.000001 Then
Text1.Text = Text1.Text & x & Str(y) & Str(cosp) & crlf
End If
Next
Next x
Text1.Text = Text1.Text & crlf & " done"
End Sub
finds
X = 30; Y = 11; cos(P) ~= .454545454545455
The angle P = acos(45/99) is about 62.9643082105877°.
Edited on July 26, 2015, 11:01 am
|
Posted by Charlie
on 2015-07-26 10:56:57 |