Generate π to 10 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 10 digits using Gauss-Legendre
a | b | c | x | π = (a + b)^2/4c |
---|---|---|---|---|
1 | 0.7071067811865475 | 0.25 | 1 | 2.9142135623 |
0.8535533905932737 | 0.8408964152537145 | 0.2285533905932738 | 0.8535533905932737 | 3.1405792505 |
0.8472249029234941 | 0.8472012667468913 | 0.2284732910809008 | 0.8472249029234941 | 3.1415926462 |
0.8472130848351927 | 0.8472130847527652 | 0.2284732905222320 | 0.8472130848351927 | 3.1415926535 |
π to 10 digits = 3.1415926535
ncG1vNJzZmivp6x7rq3ToZqepJWXv6rA2GeaqKVfqLKivsKhZamgoHS%2BfrzIXmlprJ9af3F9j15paZyZnLa1vw%3D%3D