This project implements one of the most famous infinite series discovered by Srinivasa Ramanujan for calculating π.
Published in 1914, Ramanujan's series for ( \frac{1}{\pi} ) is known for its incredible rate of convergence, producing approximately 8 additional correct decimal digits of π per term.
The formula is:
Because of its extremely fast convergence, even the first term ((k = 0)) produces an approximation of π accurate to several decimal places.
This project explores:
- Implementing arbitrary precision calculations in C++
- Understanding infinite series convergence
- Comparing calculated values of π against the true value
- Measuring runtime and accuracy across multiple iterations
- Calculates π using Ramanujan's infinite series
- Supports increasing precision with additional terms
- Measures program execution time
- Compares computed π with the actual value of π
Using only the first term:
Calculated π: 3.141592653589793 Actual π: 3.141592653589793
Adding more terms rapidly increases accuracy due to the exponential convergence of the series.
- Add arbitrary precision support using libraries such as Boost.Multiprecision
- Visualize convergence over multiple iterations
- Compare Ramanujan's series against other π algorithms
- Benchmark performance improvements
- S. Ramanujan, "Modular equations and approximations to π", 1914