Pi Calculator (Machin Formula, Two-Term arctan)
Approximate pi with Machin's formula pi/4 = 4 arctan(1/5) − arctan(1/239). Choose the number of Taylor-series terms to see the approximation, the error against true pi, the matching digits, and the convergence table.
Input
Approximate pi using Machin''s formula and the arctangent Taylor series. Enter the number of series terms to see the approximation, the error against true pi, the matching digits, and the convergence.
pi/4 = 4 arctan(1/5) − arctan(1/239)
arctan(1/x) = 1/x − 1/(3 x^3) + 1/(5 x^5) − 1/(7 x^7) + …
Enter the number of terms used in each arctan series (1 to 20).
Result
Pi approximation with 10 terms
3.14159265359
Error vs true pi
8.882e-16
Matching decimals
15
Terms
10
Formula breakdown
4 arctan(1/5)
0.7895822394
arctan(1/239)
0.004184076002
Convergence
As the term count grows, the approximation approaches true pi and the error shrinks.
| Terms | Approximation | Error |
|---|---|---|
| 1 | 3.183263598326 | 4.167e-2 |
| 2 | 3.140597029326 | 9.956e-4 |
| 3 | 3.141621029325 | 2.838e-5 |
| 4 | 3.141591772182 | 8.814e-7 |
| 5 | 3.141592682404 | 2.881e-8 |
| 6 | 3.141592652615 | 9.745e-10 |
| 7 | 3.141592653624 | 3.376e-11 |
| 8 | 3.141592653589 | 1.191e-12 |
| 9 | 3.14159265359 | 4.308e-14 |
| 10 | 3.14159265359 | 8.882e-16 |
The error is the absolute difference between the approximation and a high-precision reference value of pi. Because 1/5 and 1/239 are small, the series converges quickly and matches many digits with few terms.
How it works
- Uses Machin's formula pi/4 = 4 arctan(1/5) − arctan(1/239), computing each arctan with the arctangent Taylor series arctan(1/x) = 1/x − 1/(3x^3) + 1/(5x^5) − ….
- Because the arguments 1/5 and 1/239 are small, the series converges quickly and matches many digits with only a few terms.
- Adding more terms brings the approximation closer to true pi, and the error (the absolute difference from true pi) shrinks, as shown in the table.
- The error is the absolute difference from the reference value, and the matching digits is the approximate number of correct decimal places.
- Because of floating-point precision limits, adding enough terms makes the error level off near its minimum value.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Pi Calculator (Machin Formula, Two-Term arctan)