Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
( 8 points ) The Babylonian method for approximating S 2 is based on the idea that if we guess a value, say x ,
points The Babylonian method for approximating is based on the idea that if we guess a value, say and then will be an underestimate of and vice versa. Hence the average of these two numbers provide a better estimate. One can repeat this averaging to get a close approximation to within some required accuracy. The algorithm is presented below: while eps end return Write a MATLAB userdefined function named mysqrt that takes a single positive real valued argument, say and computes using the Babylonian method described above. For eps you can use epssingle Use "help eps" to learn more about this function. Write a MATLAB script file that uses a while loop to repeatedly prompt the user to enter a positive real value number, say and a if S is negative it outputs "Invalid input!" and asks the user to reenter the number, b if is positive it outputs: The square root of is where is mysqritS c if is it stops and outputs "Goodbye!".
points The Babylonian method for approximating is based on the idea that if we guess
a value, say and then will be an underestimate of and vice versa. Hence the
average of these two numbers provide a better estimate. One can repeat this averaging to get a
close approximation to within some required accuracy. The algorithm is presented below:
while eps
end
return
Write a MATLAB userdefined function named mysqrt that takes a single positive
real valued argument, say and computes using the Babylonian method described
above. For eps you can use epssingle Use "help eps" to learn more about this
function.
Write a MATLAB script file that uses a while loop to repeatedly prompt the user to
enter a positive real value number, say and
a if S is negative it outputs "Invalid input!" and asks the user to reenter the number,
b if is positive it outputs:
The square root of is
where is mysqritS
c if is it stops and outputs "Goodbye!".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started