Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Using Arduino programming a. Name your program file lab6p4 b. Write a program that estimates to within a desired accuracy using an even number of

image text in transcribed
image text in transcribed Using Arduino programming
a. Name your program file lab6p4 b. Write a program that estimates to within a desired accuracy using an even number of terms. c. In setup) create the following table in the format below n pi (estimate) pi (actual) 2 2.66667 3.14159 3.14159 zzzzzz 4 2.8952 6 y-yYYY vvx d. Continue the table until the estimate of t is "accurate" (see parts e, f, and g) e. Define a constant macro for accuracy, setting "accuracy" equal to 0.001 f. Remember the absolute difference function absdiff ) we wrote in class? That function returns the absolute difference between two float inputs. What is the prototype? g. Continue estimating t until it is within 0.001 of the real value of t. How many h. Now change the accuracy to 0.0005. (Two times more accurate.) Now how i. As part of your solution, write the function pies timate ( ) that estimates terms are required to get that accurate an estimate? many terms are required? using an even number of terms. The input parameter is the number of terms (an even integer> 0). The output is an estimate of t with that many terms. For example, if -2, the output would be: 4( 1/3)-2.6667 If n-4, the output would be: 4 (131/5-1/7- 2.8952 Write the proto-type for pi estimate() below j. HINT: To get alternating signs, multiply by (-1). where i is the loop counter k. Do the example by hand for n-6 (with at least 4 decimal places) I. Write a for loop to estimate the value of to n terms, where n is an even integer 15. The value for can be determined by the series equation =4(1--+ 3 5 7 9 +--11 +12- 13 Write a program to approximate the value of using the formula given includ- ing terms up through 1/99

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started