Question
(PYTHON LANGUAGE) Compute the value of pi using the Leibniz formula for some number of iterations and examine the convergence to the actual value. Your
(PYTHON LANGUAGE)
Compute the value of pi using the Leibniz formula for some number of iterations and examine the convergence to the actual value.
Your program must meet the following requirements:
2. Your program should contain a function that computes an estimate for the value of pi using the Leibniz formula for some number of terms. The number of terms should be a formal parameter of the function. It should return the result of the calculations. This function may not ask for any input nor print any values.
3. The program should request integer input from the user on the number of terms used in the series calculation, to estimate the value of pi, as powers of ten(10). You may assume that the user will require no more than ten powers of 10 (max: 1010 or ten-billion) terms in the series.
4. The program should call the function, providing a number of terms and show the results for all the powers of ten up to the number requested by the user, as well as the correct result using math.pi.
Objective: Practice using functions, looping and the math module with user input. Description: Compute the value of pi using the Leibniz formula for some number of iterations and examine the convergence to the actual value. Your program must meet the following requirements: 1. Include a multi-line comments at the top of the file with your name, student ID number, course number, and the assignment number. 2. Your program should contain a function that computes an estimate for the value of pi using the Leibniz formula for some number of terms. The number of terms should be a formal parameter of the function. It should return the result of the calculations. This function may not ask for any input nor print any values. 3. The program should request integer input from the user on the number of terms used in the series calculation, to estimate the value of pi, as powers of ten(10). You may assume that the user will require no more than ten powers of 10 (max: 10" or ten-billion) terms in the series. 4. The program should call the function, providing a number of terms and show the results for all the powers of ten up to the number requested by the user, as well as the correct result using math.pi. Hint: Test your code with several values and build up the solution one step at a time. Note: Higher powers of ten will take a long time to compute! Example Output: The following is an example of the input and output. Estimating pi! Please enter the number of powers of ten: 7 10^9 10^1 10^2 1043 10^4 10^5 10^6 10^7 pi -> 4.0 -> 3.8418396189294032 -> 3.1315929035585537 -> 3.140592653839794 -> 3.1414926535908345 -> 3.1415826535897198 -> 3.1415916535897743 -> 3.1415925535897915 -> 3.141592653589793 Thank you! Good-ByeStep 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