Post Reply 
Can you calculate Pi using a Solver?
12-11-2019, 01:09 PM (This post was last modified: 12-11-2019 10:14 PM by Albert Chan.)
Post: #14
RE: Can you calculate Pi using a Solver?
(12-11-2019 11:50 AM)toml_12953 Wrote:  It shows that both an inscribed and circumscribed polygon approach PI as the number of sides increases.

We can do this with right triangles, starting from a hexagon ("radius" = side = 2S = 1)

10 N=6 @ S=.5
20 H=SQRT(1-S*S) @ A=N*S @ B=A/H
30 DISP N,A,B
40 N=N+N @ S=.5*SQRT(S^2+(1-H)^2)
50 IF A<B THEN 20

Code:
>RUN
 6                    3                    3.46410161514
 12                   3.10582854122        3.21539030916
 24                   3.13262861328        3.1596599421
 48                   3.13935020304        3.14608621512
 96                   3.14103195089        3.14271459965
 192                  3.14145247229        3.14187304999
 384                  3.14155760792        3.14166274706
 768                  3.14158389215        3.1416101766
 1536                 3.14159046322        3.14159703431
 3072                 3.141592106          3.14159374877
 6144                 3.1415925167         3.14159292739
 12288                3.14159261938        3.14159272205
 24576                3.14159264504        3.14159267071
 49152                3.14159265146        3.14159265788
 98304                3.14159265306        3.14159265467
 196608               3.14159265346        3.14159265386
 393216               3.14159265356        3.14159265366
 786432               3.14159265357        3.1415926536
 1572864              3.14159265359        3.1415926536
 3145728              3.14159265359        3.14159265359

Edit: line 40 may be replaced with simpler formula (approx. same accuracy)
40 N=N+N @ S=S/SQRT(H+H+2)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Can you calculate Pi using a Solver? - Albert Chan - 12-11-2019 01:09 PM



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