Generate π to 5 decimal places
Use Gauss Legendre Algorithm
Iteration Formula is below:
y = a
a=½(a+b)
b=√by
c = c - x(a-y)2
x = 2x
π = | (a+b)2 |
4c |
Start with these initial values:
a = 1
x = 1
b = | 1 |
√2 |
c = ¼
π to 5 digits using Gauss-Legendre
a | b | c | x | π = (a + b)^2/4c |
---|---|---|---|---|
1 | 0.70710678118 | 0.25 | 1 | 2.91421 |
0.85355339059 | 0.84089641524 | 0.22855339060 | 0.85355339059 | 3.14057 |
0.84722490291 | 0.84720126673 | 0.22847329110 | 0.84722490291 | 3.14159 |
π to 5 digits = 3.14159
ncG1vNJzZmivp6x7rq3ToZqepJWXv6rA2GeaqKVfqLKivsKhZamgoHS%2BfrzIXmlprJ9af3GBhGtnnZ2TnrqiuIRrZ6mkkZiytA%3D%3D