mini challenge: find the smallest cosine of an integer
10-24-2021, 11:42 PM
Post: #21
 Albert Chan Senior Member Posts: 2,650 Joined: Jul 2018
RE: mini challenge: find the smallest cosine of an integer
(10-24-2021 06:17 PM)Albert Chan Wrote:  10 P0=0 @ P1=1 @ P=P0 @ S=2
20 P=P+P1 @ S2=ABS(SIN(P))
30 IF S>S2 THEN S=S2 @ DISP P @ P0=P1 @ P1=P @ P=P0
40 IF P<1.E+12 THEN 20

It is not obvious (at least for me), why smaller |sin(P)| signaled a convergent.
Say, 2 neighboring convergents, p1/q1 > π > p2/q2
We write this to show p2/q2 is the better estimate for π:

p1/q1 > (p1+p2)/(q1+q2) > π > p2/q2

(p1+p2) > (q1+q2)*π
p1 - q1*π > q2*π - p2 > 0
|p1 - q1*π| > |p2 - q2*π|

Both sides are tiny. Within this range, sin is increasing function, so take sin of both side.

sin(|p1 - q1*π|) > sin(|p2 - q2*π|)
|sin(p1)| > |sin(p2)|

Thus, when |sin(P)| get smaller, we found a convergent.
 « Next Oldest | Next Newest »

 Messages In This Thread mini challenge: find the smallest cosine of an integer - EdS2 - 10-19-2021, 10:23 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-19-2021, 11:33 AM RE: mini challenge: find the smallest cosine of an integer - PeterP - 10-19-2021, 11:58 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-19-2021, 01:30 PM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-19-2021, 02:44 PM RE: mini challenge: find the smallest cosine of an integer - EdS2 - 10-21-2021, 09:44 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-21-2021, 12:01 PM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-21-2021, 01:09 PM RE: mini challenge: find the smallest cosine of an integer - EdS2 - 10-21-2021, 03:04 PM RE: mini challenge: find the smallest cosine of an integer - EdS2 - 10-23-2021, 06:47 AM RE: mini challenge: find the smallest cosine of an integer - PeterP - 10-24-2021, 06:56 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021, 06:17 PM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021 11:42 PM RE: mini challenge: find the smallest cosine of an integer - PeterP - 10-24-2021, 05:36 PM RE: mini challenge: find the smallest cosine of an integer - EdS2 - 10-23-2021, 06:53 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-23-2021, 05:10 PM RE: mini challenge: find the smallest cosine of an integer - EdS2 - 10-24-2021, 08:27 AM RE: mini challenge: find the smallest cosine of an integer - ijabbott - 10-24-2021, 10:28 AM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021, 09:53 PM RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021, 12:46 PM RE: mini challenge: find the smallest cosine of an integer - PeterP - 10-24-2021, 06:56 PM

User(s) browsing this thread: 1 Guest(s)