Pi Calculator (Viete Formula)
Approximate pi using Viete infinite product formula. Enter the number of terms to see each partial product and the error against the true value of pi.
Input
Approximate pi using the Viete formula (an infinite product). Enter the number of terms to use.
Enter a whole number from 1 to 60.
Result
Approximation of pi with 10 terms
3.141591421511
Error from true pi
0.000001232079
Terms
10
True pi
3.14159265359
Convergence of partial products
Each row shows the factor of that term, the partial product from the first term, and the approximation of pi at that point.
| Term | Factor | Partial product | Pi approximation |
|---|---|---|---|
| 1 | 0.707106781187 | 0.707106781187 | 2.828427124746 |
| 2 | 0.923879532511 | 0.653281482438 | 3.061467458921 |
| 3 | 0.980785280403 | 0.640728861935 | 3.121445152258 |
| 4 | 0.995184726672 | 0.637643577336 | 3.136548490546 |
| 5 | 0.998795456205 | 0.636875507722 | 3.140331156955 |
| 6 | 0.999698818696 | 0.636683692726 | 3.141277250933 |
| 7 | 0.999924701839 | 0.636635751615 | 3.141513801144 |
| 8 | 0.999981175283 | 0.636623767127 | 3.141572940367 |
| 9 | 0.99999529381 | 0.636620771054 | 3.141587725277 |
| 10 | 0.999998823452 | 0.636620022039 | 3.141591421511 |
The factors of 2/pi = (sqrt(2)/2)(sqrt(2+sqrt(2))/2)(sqrt(2+sqrt(2+sqrt(2)))/2)... are multiplied in order, and the approximation is 2 divided by the partial product.
How it works
- Viete formula expresses 2/pi as an infinite product of nested square roots.
- Each factor is a(k)/2, where a(1) equals the square root of 2 and a(k) equals the square root of 2 plus a(k-1).
- Given the partial product P(n), the approximation of pi is 2 divided by P(n).
- The more terms you add, the faster the approximation converges to the true pi.
- The error is shown as the absolute difference between the approximation and the true pi.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Pi Calculator (Viete Formula)