There are different ways to calculate the value of the number $$\pi$$ by means of a computer. You can, for example, calculate the partial sums of the Gregory-Leibniz sequence: \[ \pi = \frac41 - \frac43 + \frac45 - \frac47 + \dots \] The Indian mathematician Madhaya of Sangamagrama proposed an alternative sequence development in the fourteenth century: \[ \pi = \sqrt{12}\,\left( 1 - \frac1{3\cdot 3} + \frac1{5\cdot 3^2} - \frac1{7\cdot 3^3} + \cdots \right) \]

Assignment

Example

>>> GL(2)
2.666666666666667
>>> MvS(2)
3.0792014356780038
>>> approach_pi(2)
(8, 3.141568715941784)