Gauss–Legendre algorithm: Difference between revisions

Content deleted Content added
PyetroPy (talk | contribs)
Algorithm: Reordered formulas
Tags: Mobile edit Mobile web edit
Line 7:
 
== Algorithm ==
# Initial value setting: <math display="block">a_0 = 1\qquad b_0 = \frac{1}{\sqrt{2}}\qquad p_0 = 1\qquad t_0 = \frac{1}{4}\qquad p_0 = 1.</math>
# Repeat the following instructions until the difference ofbetween <math>a_na_{n+1}</math> and <math>b_nb_{n+1}</math> is within the desired accuracy: <math display="block"> \begin{align}
a_{n+1} & = \frac{a_n + b_n}{2}, \\
\\
b_{n+1} & = \sqrt{a_n b_n}, \\
\\
t_p_{n+1} & = t_n - p_n(a_{n}-a_{n+1})^22p_n, \\
\\
p_{n+1} & = 2p_n.
\\
t_{n+1} & = t_n - p_n(a_{n+1}-a_{n})^2. \\
\end{align}
</math>