The Madhava series

Question Q2.4.4

Use a for loop to estimate $\pi$ from the first 20 terms of the Madhava series: $$ \pi = \sqrt{12} \left( 1 - \frac{1}{3\cdot 3} + \frac{1}{5\cdot 3^2} - \frac{1}{7\cdot 3^3} + \cdots \right). $$


Solution