Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement the programs below in your lab06 directory Description of two projects 1. 7T The number is a mathematical constant approximated at 3.14 A formula
Implement the programs below in your lab06 directory Description of two projects 1. 7T The number is a mathematical constant approximated at 3.14 A formula for computing it is as follows k-0 Write a program called pic that approximates the value of by using the following equation t-4 2k +1 where n is a number entered by the user Your program will first compute as 4( (-1)1) then as 4( (-1P/1 + (-1):/3), then as 4 (-1)/1 1)3(-1)2/5) and so on. For debugging purpose, in each step, print the step number and the value of so far, as follows (with 8 digits after the decimal point) 0 4.00000000 2.66666666 3.46666666 Later for submission, the above is replaced by 0, 10000, 20000, and so on, because we use EPOCH-10000 below. As I taught, we should not use any "magic" numbers in our programs to facilitate bug-free software maintenance. "Magic" here means hard to understand by others without a name Use double (not float) to store the value of pi. Update your program so the output is printed every EPOCH 10000 iteration. How many iterations (up to precision in EPOCH-10000's) does your program take for the value to pi to converge within 10 error (i.e., to stop changing the estimated value even if you increase the user-given output n)? Only when you are ready, use typescript from the script command to report the computer session that computes rat the required precision 107. Do not print any information not required so that your typescript file is about a single-page long Note: If using math.h, you need to link the math library when compiling your program using the gcc option-Im
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