Estimating Pi using series

Alanna Hoyer-Leitzel
Mount Holyoke College,
Author Profile
Initial Publication Date: October 7, 2016 | Reviewed: November 15, 2018


This lab activity uses MATLAB to approximate pi. Students calculate partial sums of infinite series that sum to a multiple of pi, and then calculate error or error bounds. The goal of this lab is to introduce the ideas of finite sum approximation, and the issue deciding what size error is reseasonable in a calculation.

Used this activity? Share your experiences and modifications

Learning Goals

The goal of this activity is to numerically approximate pi, and then calculate the error of the approximation. Students use MATLAB to compute partial sums, and then calculate bounds on the error of their calculations.

Context for Use

This lab activity is designed for second semester Calculus students who have learned about partial sums and infinite series. The lab uses the Integral Test, the Alternating Series Test, and Taylor series. I used this activity in a class that had dedicated time in a computer lab, and students completed this lab over the course of three weeks. Students had previously learned For loops, plotting functions, and how to use the documentation center to learn new commands. The lab could easily be adapted into smaller chunks, or by providing a script file, could be given to an audience with less MATLAB experience.

Description and Teaching Materials

After teaching students about series and tests for convergence, this lab is a review of the idea of partial sums as an approximation for the sum of the series. For this lab, I give students this attached handout and let them independently, or with a partner, depending on the size of the class and the computing resources available. Students are expected to fill in their answers to questions on the handout, and to electronically submit an annotated script file for the work did completing the lab.
Estimating Pi Lab (Acrobat (PDF) 100kB Sep27 16)
Tex code for handout ( 5kB Sep27 16)

Teaching Notes and Tips


Grading this lab is farily easy - just check the student's script file gives correct answers to the questions on the handout.

References and Resources