Post Reply 
mini challenge: find the smallest cosine of an integer
10-24-2021, 11:42 PM
Post: #21
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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021 11:42 PM



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