Numerical Method Nonlinear II
Numerical Method Nonlinear II
Characteristics of polynomials
The relation between the roots of a polynomial and its
coefficients is described by Vieta's formulas
f ( x) ax 2 bx c
b c
x1 x2 , x1 x2
a a
An n-by-n matrix
A companion matrix (square matrix)
Example
Suppose we have a polynomial
A special matrix
(5x5) Calculate the
eigenvalues?
polynomial’s
companion matrix
Example
Suppose we have a polynomial f ( x) x 3 7 x 6
0 7 6
A 1 0 0
0 1 0
Eigenvalue
The eigenvalues of matrix A are values of λ that satisfy the
equation
Roots
Step 2: Calculation
x1 = 2, x2 = 3
x1 1, x2 2, x3 3
X1 = 4, x2 = -1, x3 = -3
Example
Newton-Raphson f ( x) 0
Single-equation forme
Newton-Raphson
xi+1 is solution
Newton-Raphson
the two-equation case
u ( x, y ) 0 a first-order
Taylor series
v( x, y ) 0
u ( x, y ) 0
Newton-Raphson
v( x, y ) 0
Newton-Raphson
Input: a continuous function u, v
1. Evaluate u′(x,y), v′(x,y) symbolically
2. Use an initial guess of the root xi, yi to estimate the new value
of the root xi+1, yi+1 as
x 2 y 2 10 2
2 x y 1
1
y
-1
-2
X0= 2 -3
Y0 = -2 -4
-5
-5 -4 -3 -2 -1 0 1 2 3 4 5
Thai Minh Quan - Numerical Methods x 31
Exercise
1. Use the Newton-Raphson method to determine roots of equations
The fzero function is designed to find the real root of a single equation.
A simple representation of its syntax is fzero(function,x0) or fzero(function,[x0 x1])
z = fzero(f,2) z 1.5214
Step 2: Calculation
A [3 6 8 ;0 0 6;0 0 2;]
x1 1, x2 2, x3 3
%
u = [1 0 -7 6] A=
n= 3
A = diag(ones(n-1,1),-1); 0 7 -6
A(1,:) = -u(2:n+1)/u(1); 1 0 0
x = eig(A) 0 1 0
%
2nd method:
c [1 0 7 6] 0 7 6
A 1 0 0
A compan(c) 0 1 0
clc
clear all
close all
%% CALCULATE THE ROOT OF POLYNOMINALS F = X^3 - 7X + 6
u = [1 0 -7 6]
n = 3
A = diag(ones(n-1,1),-1);
A(1,:) = -u(2:n+1)/u(1);
x = eig(A)
clc
clear all
close all
%% CALCULATE THE ROOT OF POLYNOMINALS F = X^3 - 7X + 6
% 2nd method
c = [1 0 -7 6]
A = compan(c)
x = eig(A)
clc
clear all
close all
%% CALCULATE THE ROOT OF POLYNOMINALS F = X^3 - 7X + 6
% 3rd method
syms x
f = x^3 -7*x + 6
c = sym2poly(f)
A = compan(c)
x = eig(A)
clc
clear all
close all
%% CALCULATE THE ROOT OF POLYNOMINALS F = X^3 - 7X + 6
% 4th method
syms x
f = x^3 -7*x + 6
c = sym2poly(f)
x = roots(c)
p = poly(x)
clc
clear all
close all function F = myfun(x)