The following algorithm is found on a web page* for
computing pi:
• step 1. Set a = 1, b = 1/sqrt(2), t = 1/4 and x = 1
• step 2. Repeat the following commands until the
difference between a and b is within some desired
accuracy (for example 1.0e-8):
y = a;
a = (a + b)/2;
b = sqrt(b*y);
t = t - x*(y - a)^2;
x = 2*x;
step 3. 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 or ?
Using the tic and toc function to record the elapsed time
of this algorithm.
(tips: you can use vpa(pi,n) function to get more accurate
pi value with n digits. For example, vpa(pi,30) =
3.14159265358979323846264338328 )

 

in Word Problem Answers by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Related questions

1 answer
asked Mar 14, 2012 in Geometry Answers by anonymous | 1.8k views
1 answer
asked Oct 8, 2019 in Pre-Algebra Answers by anonymous | 2.1k views
0 answers
1 answer
asked Dec 5, 2014 in Statistics Answers by raj | 774 views
1 answer
0 answers
asked May 17, 2013 in Geometry Answers by anonymous | 511 views
Welcome to MathHomeworkAnswers.org, where students, teachers and math enthusiasts can ask and answer any math question. Get help and answers to any math problem including algebra, trigonometry, geometry, calculus, trigonometry, fractions, solving expression, simplifying expressions and more. Get answers to math questions. Help is always 100% free!
87,516 questions
100,279 answers
2,420 comments
732,291 users