Question
The following series can be used to calculate the value of pi: pi = 2 * [2 * 2/3 * 4/3 * 4/5 * 6/5
The following series can be used to calculate the value of pi:
pi = 2 * [2 * 2/3 * 4/3 * 4/5 * 6/5 *...]
pi = 4 * [1 - 1/3 + 1/5 - 1/7 + 1/9 -...]
pi = 8 * [1/(1*3) + 1/(5*7) + 1/(9*11) +...]
Using Python, write a program composed of functions (use a module) that asks the user for the percentage error which is willing to accept and calculate how many terms would be required to estimate the value of using each of the 3 series. The output must be a message on the screen showing the number of terms used, the value estimated and the associated error for each of the 3 series. In addition, your program should generate a figure composed of 2 graphs: up a graph that shows how the estimated value of changes with the number of terms and below a graph showing how the relative error changes with the number of terms (each graph will have 3 lines, 1 per equation). Run your program for errors of 10%, 5%, 2%, 1%, 0.1% and 0.01%. Show Graphs and PrtScs (no desktop tests required). Discuss the results obtained, which of the three series converges faster?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started