Question: 3 . 1 3 The divide and average method, an old - time method for approximating the square root of any positive number a ,
The divide and average method, an oldtime method
for approximating the square root of any positive number a
can be formulated as
x x ax
Write a wellstructured Mfile function based on the
while...break loop structure to implement this algo
rithm. Use proper indentation so that the structure is clear. At
each step estimate the error in your approximation as
epsi
x new x old
x new
Repeat the loop until epsi is less than or equal to a specified
value. Design your program so that it returns both the result
and the error. Make sure that it can evaluate the square root
of numbers that are equal to and less than zero. For the latter
case, display the result as an imaginary number. For exam
ple, the square root of would return i Test your program
by evaluating a and for epsi times
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
