Archimedes’s Method for π

Math 242: Modern Computational Mathematics (spring 2024)

Lists in Mathematica

When working with a sequence of values, it’s helpful to use a list. Here are two ways of creating lists:

Use the part operator, [[]], to access and assign values to list elements. Note that in Mathematica, list indexes start from 1.

Implementing Archimedes’s Method

Complete the code in the following cell to implement Archimedes’s method for approximating π with inscribed (2^n)-gons.

(* specify the number of iterations *)


(* initialize values *)


(* initialize a list for approximations of π *)


(* include the initial approximation in the list *)


(* main loop *)



(* display the results *)

Accuracy of Approximation

Assess the accuracy of your results. How does the number of correct digits of π relate to the number of iterations of Archimedes’s method?

The negative log of the difference is (roughly) the number of correct digits of π:

We can make a table like Figure 1.1 in the text:

We can also make a plot similar to Figure 1.3 in the text: