Gauss–Legendre algorithm: Difference between revisions

Content deleted Content added
make section
Algorithm: align env; some minor tweaks
Line 13:
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}, \\!</math>
:<math> b_{n+1} & = \sqrt{a_n b_n}\!</math>, \\
:<math> t_{n+1} & = t_n - p_n(a_n - a_{n+1})^2, \\!</math>
p_{n+1} & = 2p_n.
\end{align}
</math>
 
3. &pi; is then approximated as:
:<math>b_{n+1} = \sqrt{a_n b_n}\!</math>,
:<math>t_{n+1} = t_n - p_n(a_n - a_{n+1})^2,\!</math>
:<math>p_{n+1} = 2p_n.\!</math>
 
3. &pi; is approximated with <math>a_n\!</math>, <math>b_n\!</math> and <math>t_n\!</math> as:
 
:<math>\pi \approx \frac{(a_n+b_n)^2}{4t_n}.\!</math>