Madhava Series

MATH 242 practice problems

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

Your task: How does the choice of numerical representation affect the runtime of adding up terms of the Madhava series to approximate π? The three problems below ask you to measure the runtime using exact, floating-point, and high-precision (1000 digits) arithmetic.

Due: Friday, February 13, at 5:00pm. Try to complete this before class on Friday, but you can ask last-minute questions on Friday before turning it in. Upload your solution as a Mathematica notebook to the Madhava Series assignment on Moodle.

Grading: If you successfully measure and compare runtimes using the specified number types, you will earn a Satisfactory grade for each problem.

Need help? Review the notes from class (which are posed on the course web site), talk with your classmates, or email Prof. Wright.

Name:

What assistance did you receive and what resources did you use (if any) while working on this assignment?

(your response here)

Problem 1: exact arithmetic

Write a Module that adds up n terms of the Madhava series using exact arithmetic. Make a plot showing how the runtime depends on the number of terms that you add up. Be sure to choose n large enough to obtain runtimes larger than 0.1 seconds.

Problem 2: floating-point arithmetic

Write a Module that adds up n terms of the Madhava series using floating-point arithmetic. Make a plot showing how the runtime depends on the number of terms that you add up. Be sure to choose n large enough to obtain runtimes larger than 0.1 seconds.

Problem 3: high-precision arithmetic

Write a Module that adds up n terms of the Madhava series using high-precision arithmetic with 1000 digits. Make a plot showing how the runtime depends on the number of terms that you add up. Be sure to choose n large enough to obtain runtimes larger than 0.1 seconds.
Finally, write a few sentences summarizing your observations from your experiments in Problems 1, 2, and 3.