Menu

[solved] – Question 9063

3. With considering the following algorithm for computing pi:

I. Set a = 1, b = 1/sqrt(2), t = 1/4 and x = 1

II. Repeat the following commands until the difference between a and b is within some desired accuracy:

y = a
a = (a + b)/2
b = sqrt(b*y)
t = t – x*(y – a)^2
x = 2*x

III. From the resulting values of a, b and t, an estimate of pi is

Pi_est = ((a + b)^2)/(4*t)

How many repeats are needed to estimate pi to an accuracy of 1e-8? 1e-15?

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *