Question

Write code to approximate √25 3 by applying the a) bisection method and b) false position...

Write code to approximate √25 3 by applying the a) bisection method and b) false position method to the equation ?^3 = 25. Code the algorithms. Choose the starting guesses. Determine the result accurate to at least to 5 sig figs.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You havent specified the format in which cody expects the code to be. So here is a code which asks for a and b and displays the root with a suitable message

a)Bisection

clear
f=@(x)x^3-25;
a=input('Enter a of interval[a,b]:');
b=input('Enter b of interval[a,b]:');
if f(a)*f(b)>=0
fprintf('Wrong choice of interval!!Exiting\n')
return
else
c0=0;
c=100;
while(abs(c-c0)>10^-5)
c0=c;
c=(a+b)/2;
if f(a)*f(c)<0
b=c;
else
a=c;
end
end
end
fprintf('Root found=%.5f\n',c)

b)false position

clear
f=@(x)x^3-25;
a=input('Enter a of interval[a,b]:');
b=input('Enter b of interval[a,b]:');
if f(a)*f(b)>=0
fprintf('Wrong choice of interval!!Exiting\n')
return
else
c0=0;
c=100;
while(abs(c-c0)>10^-5)
c0=c;
c=(a+b)/2;
if f(a)*f(c)<0
b=c;
else
a=c;
end
end
end
fprintf('Root found=%.5f\n',c)

Add a comment
Know the answer?
Add Answer to:
Write code to approximate √25 3 by applying the a) bisection method and b) false position...
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
  • Write code to approximate 3 Squareroot 7 (cubic square of 7) by applying the a) bisection...

    Write code to approximate 3 Squareroot 7 (cubic square of 7) by applying the a) bisection method and b)false position methods to the equation x^3 - 7 = 0. You choose the starting guesses-these will be the Cody input. Determine the result accurate to at least to 5 sig figs!

  • Please only provide the false position method algorithm and ignore the bisection method Problem 4.7 Write...

    Please only provide the false position method algorithm and ignore the bisection method Problem 4.7 Write an algorithm in MATLAB to find the root of f(x) = x4 - 8x3 - 35x2 + 450x - 1001 using the bisection method and the false-position method with xt = 4.5 and xu = 6 until the approximate relative error drops below 1.0%.

  • 3. Write a code to find 3 roots of the function f(x) 2r3-4x2 -22x +24 for the interval I-5, 5] co...

    3. Write a code to find 3 roots of the function f(x) 2r3-4x2 -22x +24 for the interval I-5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot a graph of f(x) and determine proper intervals and initial guesses for a) and b), respectively. 3. Write a code to find 3 roots of the function f(x) 2x3-4x2 -22x +24 for the interval [-5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot...

  • 3. Write a code to find 3 roots of the function f(x)-2x3-4x2-22x+24 for the interval -5, 5] consi...

    3. Write a code to find 3 roots of the function f(x)-2x3-4x2-22x+24 for the interval -5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot agraph of f(x) and determine proper intervals and initial guesses for a) and b), respectively 3. Write a code to find 3 roots of the function f(x)-2x3-4x2-22x+24 for the interval -5, 5] considering the following methods a) Bisection Method b) Newton's Method Hint: Plot agraph of f(x) and determine proper intervals...

  • A. Implement the False-Position (FP) method for solving nonlinear equations in one dimension. The...

    A. Implement the False-Position (FP) method for solving nonlinear equations in one dimension. The program should be started from a script M-file. -Prompt the user to enter lower and upper guesses for the root. .Use an error tolerance of 107. Allow at most 1000 iterations The code should be fully commented and clear " 1. Use your FP and NR codes and appropriate initial guesses to find the root of the following equation between 0 and 5. Plot the root...

  • (25 pts) Use the method of false position, with initial guesses po = 1 and p1...

    (25 pts) Use the method of false position, with initial guesses po = 1 and p1 compute p2, P3, P4, rational (integer divided by integer) approximations of V13. Also give a graphical description of this method generating your approximations = 5, to (25 pts) Use the method of false position, with initial guesses po = 1 and p1 compute p2, P3, P4, rational (integer divided by integer) approximations of V13. Also give a graphical description of this method generating your...

  • Iteration count on the bisection method: We learnt that the bisection method is a kind of...

    Iteration count on the bisection method: We learnt that the bisection method is a kind of bracketing method to estimate the roots of an equation. Each iteration involved reducing the interval in which the root lies. How many iterations, n, will be required to attain an accuracy of 10-a starting from an interval      [xl, xu] Write out a general formula for n in terms of a, xl, and xu. Use this formulae to estimate n for these specific cases: (a)...

  • Need solution for question 5.6 using python? tation to within e, 5.11 Determine the real root...

    Need solution for question 5.6 using python? tation to within e, 5.11 Determine the real root of x 80: (a) analytically and (b) with the false-position method to within e, = 2.5%. Use initial guesses of 2.0 and 5.0. Compute the estimated error Ea and the true error after each 1.0% teration 5.2 Determine the real root of (x) 5r - 5x2 + 6r -2 (a) Graphically (b) Using bisection to locate the root. Employ initial guesses of 5.12 Given...

  • Not in C++, only C code please In class, we have studied the bisection method for...

    Not in C++, only C code please In class, we have studied the bisection method for finding a root of an equation. Another method for finding a root, Newton's method, usually converges to a solution even faster than the bisection method, if it converges at all. Newton's method starts with an initial guess for a root, xo, and then generates successive approximate roots X1, X2, .... Xj, Xj+1, .... using the iterative formula: f(x;) X;+1 = x; - f'(x;) Where...

  • Please solve in MATLAB and provide screenshots of the code and a copy of the code....

    Please solve in MATLAB and provide screenshots of the code and a copy of the code. DO PART B ONLY. Chapter 5, Problem 16P 12 Bookmarks Show all steps: OFF Problem Water is flowing in a trapezoidal channel at a rate of Q= 20 m3/s. The critical depth y for such a channel must satisfy the equation 0 = 1-2B - ZA? where g=9.81 m/s2, Ac = the cross-sectional area (m2), and B = the width of the channel at...

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
ADVERTISEMENT