Question

Predict the roots of the polynomial f(x)=x^3-6x^2+11x-6 writing a code. Show your code and print the...

Predict the roots of the polynomial f(x)=x^3-6x^2+11x-6 writing a code. Show your code and print the iterative steps. Use a) Fixed Point Iteration and b) Newton Raphson. The initial values and the convergence criteria are up to you.

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

Fixed Point Iteration:

clear;
clc;

g=[1 -6 11 -6];

x1 = 0;
x2 = g(x1);

iterations = 0;% # iteration counter

ezplot(g,[0,1]);
hold on
ezplot('x',[[0,1]])

while (abs(x2-x1) > 1e-5 && iterations<100)
plot([x1 x1], [x1 x2], 'k-')
plot([x1 x2], [x2 x2], 'k--')
%pause
iterations = iterations + 1;
x1 = x2;
x2 = g(x1);
end
iterations
[x1 x2]

Newton Raphson:


clear all
close all
clc

f=[1 -6 11 -6]

df=@(x) -sin(x)-3

a=0; b=1;
x=a;
for i=1:1:100
x1=x-(f(x)/df(x));
x=x1;
end
sol=x;
fprintf('Approximate Root is %.15f',sol)
a=0;b=1;
x=a;
er(5)=0;
for i=1:1:5
x1=x-(f(x)/df(x));
x=x1;
er(i)=x1-sol;
end
plot(er)
xlabel('Number of iterations')
ylabel('Error')
title('Error Vs. Number of iterations')

Add a comment
Know the answer?
Add Answer to:
Predict the roots of the polynomial f(x)=x^3-6x^2+11x-6 writing a code. Show your code and print the...
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
  • Predict the roots of the polynomial f(x)=x^3-6x^2+11x-6 writing a code. Show your code and print ...

    Predict the roots of the polynomial f(x)=x^3-6x^2+11x-6 writing a code. Show your code and print the iterative steps. Use a) Fixed Point Iteration and b) Newton Raphson. The initial values and the convergence criteria are up to you.

  • Consider the following function with a real variable, x: ?(?) = ?3 - 3?2 + 6?...

    Consider the following function with a real variable, x: ?(?) = ?3 - 3?2 + 6? + 10 a. Write a Python function for the derivative of f(x) that takes x and returns the derivative of f(x). Take the derivative of f(x) analytically with respect to x before writing the function. b. Write a Python code that approximately finds the real root, x0, of f(x) such that f(x0)~0 using the Newton-Raphson method. The code is expected to get an initial...

  • 4) (16 points) The function f(x)= x? – 2x² - 4x+8 has a double root at...

    4) (16 points) The function f(x)= x? – 2x² - 4x+8 has a double root at x = 2. Use a) the standard Newton-Raphson, b) the modified Newton-Raphson to solve for the root at x = 2. Compare the rate of convergence using an initial guess of Xo = 1,2. 5) (14 points) Determine the roots of the following simultaneous nonlinear equations using a) fixed-point iteration and b) the Newton-Raphson method: y=-x? +x+0,75 y + 5xy = r? Employ initial...

  • 6) Use MATLAB and Newton-Raphson method to find the roots of the function, f(x) = x-exp...

    6) Use MATLAB and Newton-Raphson method to find the roots of the function, f(x) = x-exp (0.5x) and define the function as well as its derivative like so, fa@(x)x^2-exp(.5%), f primea@(x) 2*x-.5*x"exp(.5%) For each iteration, keep the x values and use 3 initial values between -10 & 10 to find more than one root. Plot each function for x with respect to the iteration #.

  • 2) (15 points) a) Determine the roots of f(x)=-12 – 21x +18r? - 2,75x' graphically. In...

    2) (15 points) a) Determine the roots of f(x)=-12 – 21x +18r? - 2,75x' graphically. In addition, determine the first root of the function with b) bisection and c) false-position. For (b) and (c), use initial guesses of x, =-land x, = 0, and a stopping criterion of 1%. 3) (25 points) Determine the highest real root of f(x) = 2x – 11,7x² +17,7x-5 a) Graphically, b) Fixed-point iteration method (three iterations, x, = 3) c) Newton-Raphson method (three iterations,...

  • 2. (a) Suppose we have to find the root xof x); that is, we have to solve )0. Fixed-point methods do this by re-writing the equation in the form x·= g(x*) , and then using the iteration scheme : g...

    2. (a) Suppose we have to find the root xof x); that is, we have to solve )0. Fixed-point methods do this by re-writing the equation in the form x·= g(x*) , and then using the iteration scheme : g(x) Show this converges (x-→x. as n→o) provided that K < 1 , for all x in some interval x"-a < x < x*+a ( a > 0 ) about the rootx 6 points] (b) Newton's method has the form of...

  • Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* -...

    Please MATLAB for all coding with good commenting. (20) Consider the function f(x) = e* - 3x. Using only and exactly the four points on the graph off with x-coordinates -1,0, 1 and 2, use MATLAB's polyfit function to determine a 3' degree polynomial that approximates f on the interval (-1, 2]. Plot the function f(x) and the 360 degree polynomial you have determined on the same set of axes. f must be blue and have a dashed line style,...

  • 2. [10 pts ] Use fixed-point iteration to determine a solution accurate to within 10-3 for f(x) x...

    2. [10 pts ] Use fixed-point iteration to determine a solution accurate to within 10-3 for f(x) x - cos(x)/2, for x in [ 0,1]. Use your calculator to calculate values, but be sure to show what values are being calculated. (a) show the function g(o) that you use: (b) show the initial value po that you use: (c) show the computations for the successive values of the pi until convergence: 2. [10 pts ] Use fixed-point iteration to determine...

  • 2. Consider the root finding problem f(3) = e* (1 - 2) (a) Show that by...

    2. Consider the root finding problem f(3) = e* (1 - 2) (a) Show that by using the Newton-Raphson method, the problem can be written as the fixed-point iteration In+1 = g(en) where -1+1-12- g() = 1-2-2 (10 marks) (b) Using the initial guess to = 0.8,find 11, 12, 13. (10 marks) (c) Find (1) and determine the rate of convergence to the root 1 = 1. (10 marks) (d) Using the initial guess 10 = 0.4 produces the sequence...

  • Function driver and script file please 4) The polynomial f (x)-0.0074x*-0.284x3+ 3.355x2 12.183x +5 has a...

    Function driver and script file please 4) The polynomial f (x)-0.0074x*-0.284x3+ 3.355x2 12.183x +5 has a real root between 15 and 20. Apply the Newton-Raphson method to this function using an initial guess of xo-16.15. Explain your results. 5) Use the roots MATLAB function to find the roots of the polynomial x x-1-0. Compare your answer to the answer you derived in in question 1. 6) Write the following set of equations below in matrix form. Use MATLAB to solve...

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
Active Questions
ADVERTISEMENT