Presentation is loading. Please wait.

Presentation is loading. Please wait.

Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function.

Similar presentations


Presentation on theme: "Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function."— Presentation transcript:

1 Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function has zero value). The formulae for the roots of a 2 nd degree polynomial are given below The formulae for the roots of a 3 rd degree polynomial are given below First root (of three)

2 The Matlab program can be used to calculate the roots of an n degree polynomial. Roots of a Polynomial: Example: Find the roots of the given polynomial. >>p=[5 8 6 -6]; roots(p) ans = -1.0604 + 1.0863i -1.0604 - 1.0863i 0.5207 Example: Find the roots of the given polynomial. ans = 1.0043 + 2.7517i 1.0043 - 2.7517i -1.4940 + 0.3852i -1.4940 - 0.3852i 0.9793 >>p=[1 0 4 16 0 -20]; roots(p) All coefficients including those with zero must be specified. Otherwise the polynomial degree will be reduced.

3 NEWTON-RAPHSON ITERATION METHOD ε (error) Solutions of Nonlinear Equations: The Newton-Raphson method, or Newton’s method, is a powerful technique for solving equations numerically. Like so much of the differential calculus, it is based on the simple idea of linear approximation. This method is a method for finding s u ccessively better approximations to the real roots (or zeroes) of a real valued function. f(x) xxixi (İnitial value) f(x i )-0 X i+1 Slope at this point is f ' (x i ) f(x i ) 0 Tangent line Solutions of Nonlinear Equations:

4 Newton-Raphson Example 1: Solutions of Nonlinear Equations: Find one of the θ values, which satisfies the given equation. θff 'ε 1-1.58582.35360.6738 1.67380.43683.6534-0.1196 1.55420.01393.4213-0.0041 1.5501-0.000133.41343.95e-5

5 Solutions of Nonlinear Equations: Newton-Raphson Example 2: Find one of the u values, which satisfies the given equation. uff 'ε 14.38995.4233-0.8094 0.1905-1.48836.62290.2247 0.41520.15697.8429-0.0200 0.39520.000257.7801-3.32e-5

6 Solutions of Nonlinear Equations: clc, clear x=1;xe=0.001*x; niter=20; %---------------------------------------------- for n=1:niter %---------------------------------------------- f=x^2-4+sqrt(x+1); df=2*x+0.5/(sqrt(x+1)); %---------------------------------------------- x1=x x=x1-f/df if abs(x-x1)<xe kerr=0;break end kerr,x clc, clear x=1;xe=0.001*x; niter=20; %---------------------------------------------- for n=1:niter %---------------------------------------------- f=5*x-cos(3*x)-1.6; df=5+3*sin(3*x); %---------------------------------------------- x1=x x=x1-f/df if abs(x-x1)<xe kerr=0;break end kerr,x Newton-Raphson Example 1:Newton-Raphson Example 2: MATLAB CODES x = fzero(@(x)5*x-cos(3*x)-1.6,1)x = fzero(@(x)x^2-4+sqrt(x+1),1) The following changes are made in the program (nr1.m) to solve the problems.

7 Solutions of Nonlinear Equations: Newton-Raphson iteration method is used to solve the nonlinear system of equations. Since there are more than one equations and unknown variables, partial derivatives of the equations with respect to each unkown variable are used in the solution procedure. f 1 (x 1,x 2 )=0 f 2 (x 1,x 2 )=0 Arbitrary initial values for x 1 and x 2 are assigned and the iteration procedure is started by making the necessary changes in the computer program (newtonrn). The variables are stated as x() in the program. Newton-Raphson Example 3: The equation of a circle with center coordinates (3,2) and a radius 5 is given on the right hand side. How do you find the intersection point of this circle and the parabola y=x 2 ?

8 Solutions of Nonlinear Equations: The following changes are made in the program (nr.m) to solve the problem. 1 2 3 1 2 4 9 x y (-1.82, 3.321) (2.643, 6.987) As shown in the figure, there are two valid solution sets. The output solution set is determined by the initial values of the unkown variables. clc, clear x=[1 4] ; fe=[0.01 0.01]; niter1=5;niter2=50; fe=transpose(abs(fe));kerr=1; for n=1:niter2 x %Error Equations--------------------------- a(1,1)=2*(x(1)-3);a(1,2)=2*(x(2)-2); a(2,1)=-2*x(1);a(2,2)=1; b(1)=-((x(1)-3)^2+(x(2)-2)^2-25); b(2)=-(x(2)-x(1)^2); %---------------------------------------------- bb=transpose(b);eps=inv(a)*bb;x=x+transpose(eps); if n>niter1 if abs(eps)<fe kerr=0; break else display ('Roots are not found') end


Download ppt "Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function."

Similar presentations


Ads by Google