# Pi by recursive decimal places

Asked Mar 30, 2004, 12:16 PM — 5 Answers
I would like to know if there is a way to calculate pi by using the current last decimal place to calculate the next decimal place. I already made a formula for pi that I posted on another board, but someone suggested I copy here.

---Begin quote---
This doesn't really fit anywhere so I'm just putting it in general. Warning: not for the faint of math skillZ

I didn't want to do my work in Calculus today so decided to do something I've always wanted to: find an answer to Pi. There are probably many other and better formulas to calculate it, but it's not like I have a degree or something, and I came up with one by using simple algebra and trigonometry.

First my theory on how to calculate pi:

First take a regular geometric shape (a regular polygon). If you keep increasing the number of sides, it starts to look more and more like a circle (a regular polygon has all sides the same length). If you get enough sides on the polygon, eventually it becoms a circle, which would be infinity. Since we cannot reach the number infinaty, the closest we can do it get bigger and bigger. We can approch infinity.

Now consider the formula for the circumference of a circle (or perimeter):
C=2(pi)r

If we leave the radius as 1, the are of the equation becomes negligable.

Now back to the polygon. If we draw lines to the center of the polygon from each corner, we see what would be the radius of the circle if the shape had infinate sides. Make this lenth one and the are from the equation for circumference dissappears.

The problem I worked most at was how to find the perimeter of the polygon. I decided to use triangles

Using one side of the polygon and 2 lines drawn to the center, we get an isocolies triangle. The angles of the two outermost angles are determined by the sum of all the angles (180(n-2)) devided by the number of angles (n), and cut in half (they are bisected by the lines to the center). We subtract twice this value from 180 to get the angle measure of the innermost angle.

To get the length of the side from this we use the law of sines, used to find the side length or measure of any angle of side, given another angle and oppisite side, and one of the measures.

Recall that both other sides are 1, and both other angles are 180(n-2)/(2n)

From this we can get:
1/sin(180(n-2)/2n)=X/sin(180-2(180-2n)/2n)

Get X by itself and we now know what the length of one side is.

Multiply this by the numbe rof side to get the total perimiter of the polygon.

Looking back to the equation for circumference, C=2(pi)r:

Perimeter=2(pi)(1)

Devide each side by 2 and we get a formula for the number pi. We still need to get close to an infinate number of sides, so we take this equation and find the limit as n approaches infinity:

Limit as n->infinity of n(sin(180-(2(180(n-2)/2n))))/2(sin((180(n-2))/2n))=(pi)

We just found an equation for pi using basic trigonometry and geometry!
---End Quote---

 glenvb Posts: 1, Reputation: 1 New Member #2 May 12, 2004, 02:21 PM
Re: Pi by recursive decimal places
Nice! Your basic idea is roughly similar to that of Archimedes, one of the first to calculate pi. He took the calculation to a 96-sided polygon, I believe. In the 15th century the Persian astronomer Jamshid al-Kashi computed pi to about 16 decimal places by taking this method out to a polygon of over 805 million sides. Yikes.
 matte Posts: 1, Reputation: 1 New Member #3 Aug 23, 2007, 06:07 AM
2nrcos180((n-2)/(2n)) would be a more proper sollution actually for the distance around the polygon. Divide by 2 to get the value of pi.
 ebaines Posts: 10,033, Reputation: 5529 Expert #4 Aug 23, 2007, 12:50 PM
This is a fine technique, although there's a crucial step missing in how to calculate the cosine or sine of the angles (assuming that like Archimedes you don't have a calculator). One could use an infinite series, for example:

Sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...

But this is cumbersome, and requires a knowledge of calculus that I doubt the ancients had. So I wonder if they didn't use another technique, such as this: given the knowledge that cos(pi/4) = sqrt(2)/2, and the relationship cos(x) = sqrt[(cos(2x)-1)/2], you can play around using basic trig identities and you find that you get a neat recursive formula:

$
\sin $$\frac {\pi} 4$$ = \frac {\sqrt 2} 2 \\
\sin $$\frac {\pi} 8$$ = \frac 12 \sqrt {2 - \sqrt 2} \\
\sin $$\frac {\pi} {16}$$ = \frac 12 \sqrt {2 - \sqrt {2+ \sqrt 2}}\\
\sin $$\frac {\pi} {32}$$ = \frac 12 \sqrt {2 - \sqrt {2+ \sqrt {2 + \sqrt 2}}}
$

Etc.

The length of the side of an n-sided polygon is 2* sin(pi/(n)), so if we choose polygons where each has twice the number of sides as its predecessor, the accuracy in determining pi is limited only by one's accuracy in calculating square roots. The formula for estimating the length of half the the perimeter (that is, pi) is:

$
\pi (est.) = N \times \sin(\pi/N).
$

We choose the value for N to be 1, 2, 4, 8, 16, etc., and what we find is that the approximation for pi converges pretty quickly to a reasonable level of accuracy:

$
\begin{matrix}
N & \Pi(est) \\
4 & 2.828 \\
8 & 3.061 \\
16 & 3.121 \\
32 & 3.136 \\
64 & 3.140 \\
128 & 3.1413 \\
256 & 3.14151 \\
512 & 3.14157
\end{matrix}
$

Etc.
 eodnohj Posts: 1, Reputation: -2 Junior Member #5 Oct 27, 2011, 05:40 PM
your answers are wrong for one crutial fact that is the sine function in pure math is in radians and thus nsin(180/n) becomes nsin(Pi/n). as n->oo sin nsinPi/n aproaches n*Pi/n (by small angle theorem) so you get the trivial solution of Pi=Pi. However if you want a mathematically correcct expression for pi then you can employ the use of a taylor series fot arctangent and evaluate at 1, knowing that tan(pi/4)=1. This becomes the infinte series of sum(4*(-1)^(i+1)*factorial(2*i-2)/factorial(2*i-1), i = 1 .. infinity), which is an expression of pi, mathematically correct, however it does not converge that well. Your answer allthouge logically correct is mathematically insound due to the fact that degrees are not pure numbers.
Unknown008 (Oct 27, 2011 09:56 PM): The member you rated did NOT use degrees.   Source:
ebaines (Oct 28, 2011 06:05 AM):   Source:
 ebaines Posts: 10,033, Reputation: 5529 Expert #6 Oct 28, 2011, 06:10 AM
Quote:
 Originally Posted by eodnohj your answers are wrong for one crutial fact that is the sine function in pure math is in radians and thus nsin(180/n) becomes nsin(Pi/n). .... Your answer allthouge logically correct is mathematically insound due to the fact that degrees are not pure numbers.
There is nothing wrong with using degrees as the measure of an angle. Degrees and radians are both dimensionless numbers, so I don't understand your point. When someone writes "sin(180/n)" it's pretty clear they're talking about degrees, not radians, so there should be no confusion.

## Check out some similar questions!

Calculating pi to n decimal places [ 5 Answers ]

Suppose your goal is to calculate (not look up) a value of pi that is accurate to n decimal places. Suppose n were 10. How would you do it?

Recursive Matlab problem [ 2 Answers ]

Hi, I'm trying to write a matlab program for a recursive sequence. I worked out the sequence right I think but can't get the figures right in the program. Here's the program I have so far: %recursive program for water %dam cycling down to empty Clear Format long A=32; Fprintf(' Week ...

401k in two places [ 1 Answers ]

Hi - I currently have 2 401k's roaming about from previous jobs. I don't have one set up with my current employer. I am in a position where I need to get a hold of that money quick, but I'm not sure what my best options are. Any and all help would be greatly appreciated! Thank you! :confused:

Accessing FTP through My Network Places [ 2 Answers ]

I'm trying to access a music file I've hidden on my website, but of course I can't remember what I've called it so I thought I'd access the FTP window and look for it that way, but I'm having trouble getting on it by putting in the ftp.address.net bit - it keeps timing out before the login box...

PVC Tight Places HELP! [ 3 Answers ]

I was forced to cut off a closet (toliet) flange and the 90 degree elbow to which it was glued due to damage to get to clean PVC drain pipe in good condition. The problem is where the elbow will turn up and at the point where the new flange and coupling is needed is very tight. The area is between...