Question: The divide and average method, an old-time iterative method for approximating the square root of any positive number a, can be formulated as Write a

The divide and average method, an old-time iterative method for approximating the square root of any positive number a, can be formulated as

The divide and average method, an old-time iterative method for approximating the

Write a MATLAB code (script) to find the square root of 15 correct to 4 significant figures and use an fprintf statement to write your final answer to the screen.

Hints:

1. Note that a=15 in this case as you are trying to find the square root of 15. Start with an initial value of x. An intelligent initial guess can be x=a/2.

2. Use a while loop to calculate the updated value of x according to the above iterative formula x=(x+(a/x))/2 For example, if you start with x=a/2, i.e., x=7.5 initially, then the next updated value of x calculated by your code inside the while loop should be x=(x+(a/x))/2 = (7.5+ 15/7.5)/2=4.75. Thus, at this stage the current value of x is 4.75 and the old value of x is 7.5. Accordingly calculate the relative error, Ea to properly construct a while loop.

3. Implement the stopping condition for 4 sig figs accuracy and display the last updated value of x as your final answer after you come out of the while loop.

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!