Gauss–Legendre algorithm: Difference between revisions

Content deleted Content added
WikiCleanerBot (talk | contribs)
m v2.04b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 6:
 
== Algorithm ==
# Initial value setting: <math display="block">a_0 = 1\qquad b_0 = \frac{1}{\sqrt{2}}\qquad t_0 = \frac{1}{4}\qquad p_0 = 1.</math>
1. Initial value setting:
2.# Repeat the following instructions until the difference of <math>a_n</math> and <math>b_n</math> is within the desired accuracy: <math display="block"> \begin{align}
:<math>a_0 = 1\qquad b_0 = \frac{1}{\sqrt{2}}\qquad t_0 = \frac{1}{4}\qquad p_0 = 1.</math>
:<math> \begin{align} a_{n+1} & = \frac{a_n + b_n}{2}, \\
2. Repeat the following instructions until the difference of <math>a_n</math> and <math>b_n</math> is within the desired accuracy:
:<math> \begin{align} a_{n+1} & = \frac{a_n + b_n}{2}, \\
\\
b_{n+1} & = \sqrt{a_n b_n}, \\
Line 19 ⟶ 18:
\end{align}
</math>
3.# {{pi}} is then approximated as: <math display="block">\pi \approx \frac{(a_{n+1}+b_{n+1})^2}{4t_{n+1}}.</math>
:<math>\pi \approx \frac{(a_{n+1}+b_{n+1})^2}{4t_{n+1}}.</math>
 
The first three iterations give (approximations given up to and including the first incorrect digit):