Question

oad Assignm 15 preactivities 201: E in cassactivit
0 0
Add a comment Improve this question Transcribed image text
Answer #1

  function [value]=my_sqrt(x1,e)

A=input('Enter a number you want to know the approximation of the square root of: ');
x=input('Enter your initial guess for the square root: ');
e=input('Enter the convergence you want: ');
xold=x;
diff=10*e;
while diff>=e
  Y=xold^2/A;
  xnew=xold*(Y+3)/(3*Y+1);
  diff=abs(xold-xnew);
  xold=xnew;
end
value=xnew;

Add a comment
Know the answer?
Add Answer to:
(loops, conditional) Edmond Halley (of comet fame) invented a fast algorithm for computing the squareroot of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. One interesting property of a Fibonacci sequence is that the ratio of the values of...

    4. One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approaches a number called "the golden ratio". Create a program that accepts the first two numbers of a Fibonacci sequence as user input and then calculates additional values in the sequence until the ratio of adjacent values converges to within 0.001 You can do this in a while loop by comparing the ratio of element k to element k...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT