keisoku

Pi via Three-Term Arctangent Formula

Approximate pi using the three-term Machin-like formula pi/4 = arctan(1/2) + arctan(1/5) + arctan(1/8). Choose the number of series terms and see each arctan value, the error against true pi, the correct digits, and the convergence table.

Input

Approximate pi with a three-term Machin-like formula. Enter how many series terms to use for each arctangent.

pi/4 = arctan(1/2) + arctan(1/5) + arctan(1/8)

Enter an integer from 1 to 200. More terms bring the approximation closer to true pi.

Result

Approximation of pi with 5 terms each

3.141739328007

True pi

3.14159265359

Absolute error

1.4667e-4

Correct digits

4

Value of each arctangent term

arctan(1/2)

0.463684275794

arctan(1/5)

0.197395561651

arctan(1/8)

0.124354994557


Convergence by term count

Pi approximation and absolute error against true pi as the term count increases from 1.

TermsPi approximationAbsolute error
13.31.5841e-1
23.12006252.1530e-2
33.1453429140623.7503e-3
43.1408710415847.2161e-4
53.1417393280071.4667e-4

Each arctan is computed from the series arctan(x) = x − x^3/3 + x^5/5 − x^7/7 + …, and four times the sum of the three terms gives pi. Smaller arguments converge faster.

How it works

  • Uses the three-term Machin-like formula pi/4 = arctan(1/2) + arctan(1/5) + arctan(1/8).
  • Each arctan is evaluated with the power series arctan(x) = x − x^3/3 + x^5/5 − x^7/7 + … up to the chosen number of terms.
  • The three arctan values are summed and multiplied by 4 to approximate pi.
  • Because the arguments 1/2, 1/5, and 1/8 are small, the series converges quickly even with few terms.
  • The absolute error against true pi (Math.PI) gives the approximate number of correct significant digits.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Pi via Three-Term Arctangent Formula