Question: Redo Problem 1 with a while-loop with the header function [piEstimate, nIterations] = myWhilePi(tol) which takes a user-specified tolerance (tol) and uses a while loop

Redo Problem 1 with a while-loop with the header

function [piEstimate, nIterations] = myWhilePi(tol)

which takes a user-specified tolerance (tol) and uses a while loop with the Archimedes algorithm to iterate until the estimate of pi converges to within tol.

Redo Problem 1 with a while-loop with the header function [piEstimate, nIterations]

= myWhilePi(tol) which takes a user-specified tolerance (tol) and uses a while

Problem 1: (5 Points) Write a function with the header: function [p|Estimate, piError] myForPi(n1terations) = which uses a for-loop and the Archimedes method below to estimate the value of pi (yoU rt us iisoh) I. Let A = 1 and N 6 2. Repeat the following nlterations times a. Replace N by 2N b. Replace A by [2- sqrt(4- AA2) A(1/2) C. Let L = NA/2 d. Let UL/sqrt(1 -AA2/2) e. Let p-Estimate = (U + L)/2 f. Let pError=(U-L)/2 3. Return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!