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

 Objective: Integer! (Posted on 2016-06-14)

O1 is a circle with diameter AOB, of radius r.

C is a point on AB between O and A, and the length of AC is s.

O2 is a second circle, radius t, centred on C, such that s < t < r, so that some part of O2 will always fall outside O1.

D is the common area of O1 and O2.

If r, s, and t are all integer values less than 100 units, say of centimetres, when is D closest to an integer value?

For example, if r=97, s=2, and t=78, then D = 8185.006 cm^2, a near miss. Is there a neater solution than this?

 No Solution Yet Submitted by broll No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 4 |
5    bestdiff=1
6    kill "objintgr.txt":open "objintgr.txt" for output as #2
10    For r = 3 To 100
20    For t = 2 to r-1
30    For s = 1 to t-1
40       cosa = (r * r + (r - s) * (r - s) - t * t) / (2 * r * (r - s))
50       sina = Sqr(1 - cosa * cosa)
60       a = Atn(sina / cosa)
70       hgt = r * sina
80       base = r * cosa
90       d1 = r * r * a - base * hgt
100
110       cosc = (t * t + (r - s) * (r - s) - r * r) / (2 * t * (r - s))
120       sinc = Sqr(1 - cosc * cosc)
121       if cosc=0 then
122         :c=#pi/2
123       :else
130          :c = Atn(sinc / cosc)
140       If c < 0 Then c = c + #pi
150       hgt = t * sinc
160       base = t * cosc
170       d2 = t * t * c - base * hgt
180
190       d = d1 + d2
191       dround=int(d+.5)
192       if abs(d-dround) <= bestdiff then
193          :print r,t,s,d
194          :print #2, r,t,s,d
195          :bestdiff=abs(d-dround)
210     next
220     next
230     next
240     close #2

to find successively better approximations to integers:

`  r   t   s            D     3   2   1   9.3204778955757026782  5   2   1   9.6991563660426482314  5   3   1   18.2246946609861792419  5   3   2   24.082570710619696239  7   5   4   72.0498673837428549039  8   3   1   18.9787625988235752569  9   6   1   60.0117226015716722812  10   7   6   146.0034085891044524847  11   9   6   209.9991389657466712032  22   18   6   625.0007644328349099103  23   9   4   187.9996978940880101749  24   19   4   613.999794044358302884  32   11   5   285.0001721145300130949  35   34   25   3049.0000917415865148564  36   14   1   310.0000559545887104217  45   13   1   275.000030503785316484  45   33   24   2989.0000155083033543965  73   22   2   798.9999990508283636297 `

verified in VB:

`3 2 1   9.32047789557575 2 1   9.699156366042655 3 1   18.22469466098625 3 2   24.08257071061977 5 4   72.04986738374298 3 1   18.97876259882369 6 1   60.011722601571710 7 6   146.00340858910411 9 6   209.99913896574722 18 6   625.00076443283523 9 4   187.99969789408824 19 4   613.99979404435832 11 5   285.0001721145335 34 25   3049.0000917415936 14 1   310.00005595458945 13 1   275.00003050378545 33 24   2989.000015508373 22 2   798.999999050828`

DefDbl A-Z
Dim crlf\$

Form1.Visible = True

Text1.Text = ""
crlf = Chr\$(13) + Chr\$(10)

pi = Atn(1) * 4

bestdiff = 1
For r = 3 To 100
For t = 2 To r - 1
For s = 1 To t - 1
DoEvents
cosa = (r * r + (r - s) * (r - s) - t * t) / (2 * r * (r - s))
sina = Sqr(1 - cosa * cosa)
a = Atn(sina / cosa)
hgt = r * sina
base = r * cosa
d1 = r * r * a - base * hgt

cosc = (t * t + (r - s) * (r - s) - r * r) / (2 * t * (r - s))
sinc = Sqr(1 - cosc * cosc)

If cosc = 0 Then
c = pi / 2
Else
c = Atn(sinc / cosc)
End If
If c < 0 Then c = c + pi

If c < 0 Then c = c + pi
hgt = t * sinc
base = t * cosc
d2 = t * t * c - base * hgt

d = d1 + d2

dround = Int(d + 0.5)
If Abs(d - dround) <= bestdiff Then
Text1.Text = Text1.Text & r & Str(t) & Str(s) & "   " & d & crlf
bestdiff = Abs(d - dround)
End If

Next
Next
Next

Text1.Text = Text1.Text & crlf & " done"

End Sub

 Posted by Charlie on 2016-06-14 15:43:05

 Search: Search body:
Forums (4)