Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Programming in C The number is a mathematical constant approximated at 3.14. A formula for computing it is as follows: 14 4 ka 2k +1
Programming in C
The number is a mathematical constant approximated at 3.14. A formula for computing it is as follows: 14 4 ka 2k +1 Write a program called pic that approximates the value of x by using the following equation: 1=4 (-1) 2k +1 where n is a number entered by the user. Your program will first computer as 41 (-1)/1) then as 41(-1)/1+ (-1)/3), then as 41 (-1)/1+ (-1)/3 + (-1)/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 1: 2.66666666 2: 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 (ie, 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 x at the required precision 107. Do not print any information not required so that your typescript file is about a single-page longStep 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