Computing the digits of \piThis method, which uses highly sophisticated iterative techniques and programming, is provided as an illustration of what can be achieved. It is not part of your Advanced Level course!This program demonstrates arbitrary-precision arithmetic by computing the digits of pi using the Borwein iteration algorithm first published by Jonathan Borwein and Peter Borwein in 1985.
Iteration #1 produces 8 correct decimal digits, iteration #2 produces 41 digits, iteration #3 produces 171 digits, iteration #4 produces 694 digits, and each subsequent iteration increases the number of correct digits by more than a factor of four. Because it needs to test for convergence, the program will do one more iteration than necessary.
This program computes the digits of pi in several phases, and each phase can consist of several tasks. It displays the current phase and task, the elapsed time of the previous phase, and the total elapsed time. (The total elapsed time does not include the time to display the digits of pi).

To ensure the accuracy of the last digits, the program computes with a scale equal to 0.5% more than the specified number of decimal digits.
To run the demo:

Enter the number of decimal digits of pi to compute.

Press the Run button.

Press the Stop button at any time to stop the computation.

Software/Applets used on this page

This applet forms part of "Java Number Cruncher: The Java Programmer's Guide to Numerical Computation", Prentice-Hall, by Ronald Mak, and is provided for MathsNetAlevel-plus by that author - seeApropos-logic

Glossary

algorithm

A set of precise instructions which, if followed, will solve a problem.

iteration

successive repetition of a process using the result of one stage as the input for the next.

pi

the ratio of the circumference of a circle to its diameter. It is approximately 3.14159265...