Post Reply 
Π day
03-21-2022, 10:45 PM
Post: #47
RE: Π day
(03-21-2022 07:24 AM)Thomas Klemm Wrote:  We end up with the same sequence as when using Vieta's formula.

Yes. For 2^n sided polygon, we have 2^(n+1) right triangles, with acute angle x = pi/2^n

area(inscribled triangle) ≤ area(sector) ≤ area(circumscribed triangle)
sin(x)*cos(x)/2 ≤ 1^2*x/2 ≤ 1*tan(x)/2
sin(2x)/(2x) ≤ 1 ≤ tan(x)/x

I(2^n)
= sin(2x)/(2x) * pi
= sin(pi/2^(n-1)) / (pi/2^(n-1)) * pi
= 2 / (cos(pi/4) * cos(pi/8) * ... * cos(pi/2^(n-1))       // Vieta's formula for pi

Of course, the formula does not required 2^n sided polygons
Example, we can start with hexagon: I(6) = 3/2*√3 ≈ 2.598, C(6) = 2*√3 ≈ 3.464

sin(2x)/(2x) = 1 - 2/3*x^2 + 2/15*x^4 + ...
tan(x) / x     = 1 + 1/3*x^2 + 2/15*x^4 + ...

Circumscribed polygon area about twice as accurate as inscribed. (opposite sign)
We can correct for this.

Code:
10 N=6 @ A=SIN(PI/N*2)*N/2 @ B=TAN(PI/N)*N
20 A=SQRT(A*B) @ B=B*A/((B+A)*.5) @ N=N+N
30 DISP N,A,B,(A+2*B)/3
40 IF N<100 THEN 20
Code:
>RUN
 12              3                    3.21539030918        3.14359353945
 24              3.10582854123        3.15965994211        3.14171614182
 48              3.13262861329        3.14608621514        3.14160034786
 96              3.13935020305        3.14271459965        3.14159313412
 192             3.14103195089        3.14187304998        3.14159268362

We can apply Richardson extrapolation, to remove O(x^4) error

>RES
 3.14159268362
>RES + (RES-3.14159313412)/(2^4-1)
 3.14159265359

For unit circle, circumscribed polygon perimeter = its area.
Inscribed n-sided polygon perimeter = Inscribed 2n-sided polygon area.
This make complicated polygon perimeter code un-necessary. Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Π day - robve - 03-14-2022, 03:35 AM
RE: Π day - Dave Britten - 03-14-2022, 11:44 AM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 12:25 PM
RE: Π day - robve - 03-14-2022, 05:52 PM
RE: Π day - Dave Britten - 03-14-2022, 06:15 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 11:53 AM
RE: Π day - EdS2 - 03-14-2022, 01:55 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 06:06 PM
RE: Π day - EdS2 - 03-15-2022, 12:05 PM
RE: Π day - robve - 03-14-2022, 09:35 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 10:30 PM
RE: Π day - robve - 03-14-2022, 02:10 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 08:29 PM
RE: π day - Thomas Klemm - 03-14-2022, 09:17 PM
RE: Π day - robve - 03-15-2022, 04:56 PM
RE: Π day - ttw - 03-14-2022, 11:06 PM
RE: Π day - robve - 03-15-2022, 12:35 AM
RE: Π day - floppy - 04-02-2022, 11:12 AM
RE: Π day - Eddie W. Shore - 03-15-2022, 01:09 AM
RE: Π day - rprosperi - 03-15-2022, 12:25 PM
RE: Π day - Ren - 03-15-2022, 01:16 AM
RE: π day - Thomas Klemm - 03-15-2022, 07:55 PM
RE: Π day - robve - 03-15-2022, 08:49 PM
RE: Π day - Thomas Klemm - 03-17-2022, 03:40 AM
RE: Π day - robve - 03-18-2022, 01:04 AM
RE: Π day - Thomas Klemm - 03-17-2022, 03:54 AM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 11:39 AM
RE: Π day - Thomas Klemm - 03-17-2022, 12:29 PM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 02:10 PM
RE: Π day - Ángel Martin - 03-18-2022, 09:07 AM
RE: Π day - Frido Bohn - 03-19-2022, 09:45 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:17 AM
RE: Π day - Frido Bohn - 03-19-2022, 01:01 PM
RE: Π day - Frido Bohn - 03-19-2022, 03:13 PM
RE: Π day - DavidM - 03-17-2022, 08:25 PM
RE: Π day - Xorand - 03-18-2022, 03:06 AM
RE: Π day - Steve Simpkin - 03-18-2022, 04:31 AM
RE: Π day - MeindertKuipers - 03-18-2022, 10:48 AM
RE: Π day - Ángel Martin - 03-18-2022, 11:04 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:18 AM
RE: Π day - Ren - 04-02-2022, 03:14 AM
RE: Π day - Ángel Martin - 03-20-2022, 07:39 AM
RE: Π day - Frido Bohn - 03-20-2022, 07:28 PM
RE: π day - Thomas Klemm - 03-21-2022, 07:24 AM
RE: Π day - Frido Bohn - 03-21-2022, 04:03 PM
RE: Π day - Albert Chan - 03-21-2022 10:45 PM
RE: Π day - Gerson W. Barbosa - 03-24-2022, 01:36 AM
RE: Π day - Albert Chan - 03-26-2022, 03:59 PM
RE: Π day - Gerson W. Barbosa - 03-26-2022, 05:37 PM
RE: Π day - Thomas Klemm - 03-21-2022, 05:27 PM
RE: π day - Thomas Klemm - 03-21-2022, 05:54 PM
RE: π day - Thomas Klemm - 03-21-2022, 06:33 PM
RE: Π day - Albert Chan - 03-26-2022, 11:24 PM
RE: Π day - Albert Chan - 03-27-2022, 01:44 PM
RE: Π day - Albert Chan - 03-27-2022, 04:00 PM
RE: Π day - ttw - 03-31-2022, 02:04 AM



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