Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Gauss–Legendre algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 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}.</math> # Repeat the following instructions until the difference between <math>a_{n+1}</math> and <math>b_{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}, \\ \\ p_{n+1} & = 2p_n, \\ \\ t_{n+1} & = t_n - p_n(a_{n+1}-a_{n})^2. \\ \end{align} </math> # {{pi}} is then approximated as: <math display="block">\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): :<math>3.140\dots</math> :<math>3.14159264\dots</math> :<math>3.1415926535897932382\dots</math> :<math>3.14159265358979323846264338327950288419711\dots</math> :<math>3.141592653589793238462643383279502884197169399375105820974944592307816406286208998625\dots</math> The algorithm has [[quadratic convergence]], which essentially means that the number of correct digits doubles with each [[iteration]] of the algorithm.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)