Wikipedia:Reference desk/Archives/Mathematics/2018 December 30

= December 30 =

Iterative algorithm question
I worked out a simple iterative algorithm with which to compute $$\pi$$.

$$ \begin{align} x_{n+1} & = 2 x_n\text{,} \\ y_{n+1} & = \sqrt{2-\sqrt{4-y^2_n}}\text{,} \\ z_n & = x_n y_n\text{.} \end{align} $$

I won't detail the working, but it involves the cosine rule, the half-angle formula, and perimeters of polygons. A working starting point is as follows.

$$ \begin{align} x_1 & = 3\text{,} \\ y_1 & = 1\text{, from which} \\ z_\infty & = \pi\text{.} \end{align} $$

There are other starting points from which this works also.

My question: is it possible to write this method in the form $$z_{n+1} = f(z_n)$$?--Leon (talk) 13:07, 30 December 2018 (UTC)
 * I'm not sure, but it's certainly possible to write it in the form of $$z_{n+1} = f(z_n, n)$$, as $$x_{n+1} = 3 \times 2^n$$
 * &#x2230; Bellezzasolo &#x2721;  Discuss  14:18, 30 December 2018 (UTC)


 * In general you can't have a simple iteration zn+1 = f(zn) converge to π in a useful way. Presumably f would be an algebraic function involving no transendental constants. Then π = f(π) implies π is algrabraic which is false. As an aside, I'm pretty sure this method is an application of
 * $$\frac{\sin x}{x} = \cos\frac{x}{2} \cdot \cos\frac{x}{4} \cdot \cos\frac{x}{8} \cdots$$
 * with x = π/6. So it's very similar to Viète's formula which is basically the same with x = π/2. --RDBury (talk) 15:12, 30 December 2018 (UTC)

In the response to your aside, what I did was as follows.
 * 1) Consider a circle of diameter 1.
 * 2) Use the cosine rule to compute the length of the sides of a regular polygon (I opted to start with a hexagon) such that its vertices lie on the circle. The hexagon is composed of six triangles, and the angle of each triangle opposite the outward side (one actually part of the hexagon's perimeter) is $$60^\circ$$. $$\cos 60^\circ$$ is $$1/2$$, a nice rational number.
 * 3) Each iteration of $$y$$ works out the side length as the number of polygon sides doubles, applying the half-angle formula for cosine. Each iteration of $$x$$ simply accounts for the fact that the number of sides has doubled. As the number of sides of the polygon increases, it better approximates a circle.

For the record, this is not intended to be a serious method for computing $$\pi$$, but simply a pedagogic exercise.

Thanks for your help. Is there an easy way to turn my method into a series?--Leon (talk) 21:41, 30 December 2018 (UTC)


 * Maybe I'm not understanding the question, but isn't $$x_{n+1}$$ simply $$2^n \cdot x_1$$? Then just plug that into $$z_n = x_n y_n$$. Bubba73 You talkin' to me? 23:16, 30 December 2018 (UTC)
 * That's a sequence, not a series.--Leon (talk) 09:31, 31 December 2018 (UTC)
 * Actually this method was a serious method for computing π hundreds of years ago, which is what I was trying to get at above. This video uses pretty much the same method (called Archimedes' method in the video) to evaluate π in a spreadsheet, the main difference is that he uses the Pythagorean theorem to get the sides of the polygon instead of half angle formulas. The problem with π is that everything that wasn't already discovered by Ramanujan's time was discovered by Ramanujan. (Ok, not everything, but hopefully you get my point.) Any sequence {an} can be turned into a series via a1 + (a2-a1) + (a3-a2) + ... . The question is whether the series form is any simpler than the original form; in this case there are some simplifications possible, but the result will still involve square roots and won't be an improvement. --RDBury (talk) 23:12, 31 December 2018 (UTC)