There are many formulae for computing π (the ratio of a circle’s circumference to its diameter). The simplest is
which comes from putting x = 1 in the series
(a) Write a program to compute π using Equation (4.6). Use as many terms in the series as your computer will reasonably allow (start modestly, with 100 terms, say, and re-run your program with more and more each time). You should find that the series converges very slowly, i.e. it takes a lot of terms to get fairly close to π.
(b) Rearranging the series speeds up the convergence:
Write a program to compute π using this series instead. You should find that you need fewer terms to reach the same level of accuracy that you got in (a).
(c) One of the fastest series for π is
Use this formula to compute π. Don’t use Math.atan to compute the arctangents, since that would be cheating. Rather use Equation (4.7).
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here