I'd imagine everyone is familiar with π, the mathematical constant that relates the diameter of a circle with its circumference. I'm also fairly sure most people can recite it to a fair number of decimal places. But how was π calculated?
The Greek mathematician Archimedes was one of the first to approximate pi. He made use of the fact that: \[\pi = \frac{A}{r^2}\] He then used what is known as the method of exhaustion to calculate the area of the circle. This method involves using polygons with increasing numbers of sides to approximate the area of the circle. Wikipedia provided a nice example of this method:
This enabled him to approximate π to 3 decimal places.
Calculus and trigonometry
This post however is going to focus more upon using calculus to approximate π. So the obvious place to start is using trigonometry, specifically the inverse trigonometric functions. I started by finding the maclaurin series associated with arctan: \[\arctan x = x + \frac{x^3}{3} - \frac{x^5}{5} + \frac{x^7}{7} - \frac{x^9}{9} + \cdots \ \text{for} \ |x| \le 1\] Which can be expressed in sigma notation as: \[\sum_{k=0}^\infty \frac{(-1)^k x^{1+2k}}{1+2k} \ \text{for} \ |x| \le 1\] We can use the fact that $\arctan 1 = \frac{\pi}{4}$ to simplify the above sigma notation to approximate π \[ \pi = 4\sum_{k=0}^\infty \frac{(-1)^k}{1+2k} \] This is known as the Leibniz formula. It has a slow convergence; over 300 terms are needed to calculate the first 2 decimal places of π. The slow convergence is the result of the expansion being towards the end of the valid region of this taylor expansion, thus many terms are needed to accurately appoximate π.
Another trigonometric function that can be used is inverse sine. The maclaurin series of this function is: \[\arcsin x = x + \frac{x^3}{6} + \frac{3 x^5}{30} + \frac{5 x^7}{112} + \frac{35 x^9}{1152} + \cdots \ \text{for} \ |x| \le 1 \] Which can also be expressed in sigma notation as: \[ \sum_{k=0}^\infty \frac{(2k)! \ x^{1+2k}}{4^k(k!)^2(2k+1)} \ \text{for} \ |x| \le 1 \] As with inverse tan we can make use of the fact that $\arcsin \frac{1}{2} = \frac{\pi}{6}$ to simplify this series down to: \[ \pi = 6 \sum_{k=0}^{\infty} \frac{(2k)! \ (\frac{1}{2})^{1+2k}}{4^k(k!)^2(2k+1)} \] The approximation for π using this series converges more quickly due to the approximation being taken at 1/2. Whilst the inverse sine series has a much greater convergence it is inefficient due to the use of factorials. So improvements of the leibniz series would be better placed to accurately calculate π. I came across an interesting expression of π involving inverse tan purely by chance. But the convergence is much better than the previous series due to its position on the expansion. \[ \pi = 4\Big(\arctan \frac{1}{2} + \arctan \frac{1}{3}\Big)\]
Numerical Methods
A completely different approach to calculating π is to find the area under the curves that define the inverse trigonometry functions. I chose to use the integral that defines arctan: \[\pi = 4\int_0^1 \frac{1}{1+x^2}\ \mathrm{d}x\] This can be transformed into the left riemann sum: \[ \pi = \lim_{n \to \infty} \ 4 \sum_{k=0}^{n} \frac{1}{1+x_k^2} \times \frac{1}{n}\] By reducing n to a finite number this integral can be approximated. The same can be done with the right and middle riemann sums to approximate π. The issue is however that riemann sums make use of rectangles to approxmate the area under the integral. A more efficient and accurate approximation comes from the trapezoidal rule and Simpson's rule. Both of these provide better approximations for the area under the integral.
A practical comparison
So I've talked a lot about efficiency but what does that all mean in practice? Well I've written this script to let you trial strips on numerical integrals and terms in infinite integrals. Just type and number into the strips box and click calculate π. For the record:
\[ \pi = 3.14159265358979323846 \cdots \]
No comments:
Post a Comment