Does this count as a suitable approach for an algorithm to π?

I was thinking of a way to find the value of π and here is what I have came to a conclusion to:

  1. Ascribe a circle with radius 1
  2. The area is now π
  3. Draw a polygon subtended by the circle with equal side lengths
  4. The area of the polygon will equal π when number of sides increase

Hence here is the formula I had gathered: ( n * sin(theta) ) / 2 where theta = ( (n-2)180 )/n and n = number of sides and by taking the limit as n -> ∞ the formula will equal π

What I am doing is finding the area of the polygon by taking the area of each triangle inside the polygon with angle theta which would be 1/2sin(theta)ab and because a, b = 1 as they are the radius it is just 1/2sin(theta) and then I am multiplying each triangles area by the amount of sides which will encompass each triangle inscribed inside the polygon.

I need you guys to slaughter my answer and point out any mistakes or improvements.

Here is my script:

import math, time from math import sin #n = int(input("n: ")) n = 3 while True: time.sleep(1.5) theta = (n - 2) * 180 theta = theta / n phi = 180 - theta a = math.sin(math.radians(phi)) b = a/2 c = n * b n += 1 print(f"Area of Polygon with {n-1} sides enclosed in a unit circle is {c}") 

submitted by /u/grobdley23
[link] [comments]

Published by

Nevin Manimala

Nevin Manimala is interested in blogging and finding new blogs https://nevinmanimala.com

Leave a Reply

Your email address will not be published. Required fields are marked *