Integrated Care: Where Clinical Need Intersects Sustainability
Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the...
-
Upload
kathryn-robertson -
Category
Documents
-
view
218 -
download
0
Transcript of Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the...
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 2nd degree polynomial are given below
0cxbxa 2 a2
ca4bbx
2
1
a2
ca4bbx
2
2
The formulae for the roots of a 3rd degree polynomial are given below
0dxcxbxa 23 First root (of three)
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.
06x6x8x5 23
>>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.
020x16x4x 235 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.
NEWTON-RAPHSON ITERATION METHOD
1ii
ii xx
0)x(f)x(f
)x(f)x(fxx ii1ii
)x(f)x(f
xxi
ii1i
)x(f)x(f
xxi
ii1i
ε (error)
)x(f)x(f ii
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 successively better approximations to the real roots (or zeroes) of a real valued function.
f(x)
xxi (İnitial value)
f(xi)-0
Xi+1
Slope at this point is f'(xi)f(xi)
0
1ii xx
Tangent line
Solutions of Nonlinear Equations:
Newton-Raphson Example 1:
Solutions of Nonlinear Equations:
142 Find one of the θ values, which satisfies the given equation.
0)(f 14f 2
11
21
2f
n1n xx,
ff
θ f f ' ε1 -1.5858 2.3536 0.6738
1.6738 0.4368 3.6534 -0.1196
1.5542 0.0139 3.4213 -0.0041
1.5501 -0.00013 3.4134 3.95e-5
-1 0 1 2 3 4 5 6
-5
0
5
10
15
20
25
30
35
40
tet
(tet + 1)1/2 + tet2 - 4
f(tet
)
1.55
Solutions of Nonlinear Equations:
Newton-Raphson Example 2:
6.1)u3cos(u5 Find one of the u values, which satisfies the given equation.
-6 -4 -2 0 2 4 6
-30
-20
-10
0
10
20
30
u
5 u - cos(3 u) - 8/5
f(u)
0)u(f 6.1)u3cos(u5f
)u3sin(35f
n1n xx,
ff
u f f ' ε1 4.3899 5.4233 -0.8094
0.1905 -1.4883 6.6229 0.2247
0.4152 0.1569 7.8429 -0.0200
0.3952 0.00025 7.7801 -3.32e-5
Solutions of Nonlinear Equations:
clc, clearx=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 endendkerr,x
clc, clearx=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 endendkerr,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.
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.
f1(x1,x2)=0
f2(x1,x2)=0ff
2
1
2
1
2
2
1
2
2
1
1
1
ff
xf
xf
xf
xf
Arbitrary initial values for x1 and x2 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:
252y3x 22
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=x2 ?
2
2
221
xyf
252y3xf
1yf
,x2xf
2y2yf
,3x2xf
22
11
Solutions of Nonlinear Equations:
The following changes are made in the program (nr.m) to solve the problem.
1 2 312
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, clearx=[1 4] ; fe=[0.01 0.01];niter1=5;niter2=50;fe=transpose(abs(fe));kerr=1;for n=1:niter2x%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)<fekerr=0; break
elsedisplay ('Roots are not found')
endend
end