Iterative Methods for π

Math 242 practice problems

Name: _________________

Learning Goals: Gain proficiency with programming in Mathematica. Develop and implement an algorithm to solve a mathematical problem, and interpret your results.

Your task: Implement two algorithms for approximating π, as described below, and assess the accuracy of each.

Due: Monday, February 21, at 5:00pm. Upload your solution as a Mathematica notebook to the Iterative Methods for Pi assignment (Moodle link)

Grading: If you successfully implement each algorithm and assess how the number of correct digits of π depends on the number of terms/iterations, you will earn a Satisfactory grade.

Need help? Review the notes from class, which are posed on the course web site. If you still need help, email Prof. Wright.

Problem 1

Implement a module that computes partial sums of either Ramanujan’s series (equation (1.10) in the text) or the Chudnovsky brothers’ formula (equation (1.11) in the text). Make a table showing how the number of correct digits of π increases with the number of terms that you add up. Use your computations to answer the question: What is the relationship between the number of terms you add and the number of correct digits of π  you compute?

Problem 2

Implement a module that computes approximations of π using the Salamin-Brent method (Algorithm 1.20 in the text). Your module should accept one input parameter: an integer that specifies how many iterations of the algorithm to compute. Make a table showing how the number of correct digits of π increases with the number of terms that you add up. Answer the question: What is the relationship between the number of iterations and the number of correct digits of π?