Professional Documents
Culture Documents
Lecture 3
NMs for Nonlinear Equations and Systems
Yingxu Wang, Prof., PhD, PEng, FWIF, FICIC, SMIEEE, SMACM
Visiting Professor: MIT (2012), Stanford Univ. (2008), UC Berkeley (2008), Oxford Univ. (1995)
President, International Institute of Cognitive Informatics and Cognitive Computing (ICIC)
1. Introduction
1. Introduction
2. The bisection method
3 The regula falsi method
3.
4. Newtons method
5. The secant method
6. The Newton-Raphson method for
f SNLEs
S
7. MATLAB applications in NLE analyses
y
8. Summary
f ( x, y ) 0
...
f ( x1 , x2 ,,...,, xn ) 0
A system of nonlinear equations (SNLE) is a set of
multiple simultaneous nonlinear functions, m n, i.e.:
f1 ( x1 , x2 ,..., xn ) 0
f ( x , x ,,...,, x ) 0
2 1 2
n
...
f m ( x1 , x2 ,,...,, xn ) 0
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-3
SNLE
Bracketing
g methods
Open
p methods
- Newtons method
- The secant method
1. Introduction
2. The bisection method
3 Th
3.
The regula
l falsi
f l i method
th d
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
Stop condition
= (b - a)) / 2 <
tolerance or
f(x(i))
( ( )) < tolerance < tolerance
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-7
bi
fprintf ('%3i %11.6f %11.6f %11.6f %11.6f %11.6f\n', i, a, b, xN, FxN, toli)
if FxN == 0
fprintf ('An exact solution x = %11.6f was found', xN)
break
end
Solution for 1
1--D Functions with Multiple Roots
Iterative Solutions for Multiple Roots
function [[Roots]] = MultiRoots ((Fun,, Xmin,, Xmax))
i = 1;
Inc = 0.1;
A = Xmin;
B = A + Inc;
while B <= Xmax
if Fun(A)*Fun(B) < 0
% Check for a sign change
R t (i :)) = fzero
Roots(i,
f
(F
(Fun,
[A
[A, B])
B]); % Fi
Find
d the
th ith roott
i = i + 1;
end
A = B;
B = A + Inc;
end
Application of MultiRoots
>> Fun
u = @ ((x)) cos(
cos(x)) * cos
cosh(x)
( ) + 1;;
>> Xmin = 0; Xmax = 5;
>> Roots = MultiRoots (Fun, Xmin, Xmax)
Roots =
1.8751
4.6841
>> Fun = @ (x) cos(x) * cosh(x) + 1;
>> Xmin = -8; Xmax = 8;
>> Roots = MultiRoots (Fun, Xmin, Xmax)
Roots =
-7.8548
-4.6941
-1.8751
1.8751
4.6941
7.8548
1. Introduction
2. The bisection method
3.
3 The
Th regula
l falsi
f l i method
th d
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
Existence
E istence of root
f(x) is continuous in [a, b] f(a)f(b) < 0 x0, f(x0) = 0
Convergence
- Always exists
- Converges relative faster
than the bisection method
method.
Stop condition
= ((b - a)) / 2 < tolerance
or f(x(i)) < tolerance
x b
ba
The ith numerical solution is given when f (xi ) 0, i.e.:
xi
ai f (bi ) bi f (ai )
f (bi ) f (ai )
ai f (bi ) bi f (ai )
xi
f (bi ) f (ai )
4. Newtons Method
1. Introduction
2. The bisection method
3 The regula falsi method
3.
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
Stop condition
xi 1 xi
i) Relative error:
xi
ii) Tolerance: f ( xi )
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-22
f ( xi )
xi
,
f '( x i )
x i 1 x i
xi
f ( xi )
xi 1 xi
f '( xi )
x
i1
Applications of NewtonRoot
1. Introduction
2. The bisection method
3 The regula falsi method
3.
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
Stop conditions
xi1 xi
i) Relative
R l ti error:
xi
ii)) Tolerance: f (xi )
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-29
f ( x i 1 ) f ( x i )
f ( xi ) 0
,
x i 1 x i
x i x i 1
o b ta in : x i 1 x i
f ( x i ) ( x i 1 x i )
,
f ( x i 1 ) f ( x i )
x i 1 x i
xi
f ( x i 1 ) f ( x i )
R e la tio n to N e w to n ' s M e th o d : f '( x i ) lim
.
x 0
x i 1 x i
f ( xi )( xi 1 xi )
xi 1 xi
f ( xi 1 ) f ( xi )
x i1 x i
xi
Applications of SecantRoot
6. The Newton
Newton--Raphson Method for
Systems of Nonlinear Equations
1. Introduction
2. The bisection method
3 The
3.
Th regula
l falsi
f l i method
th d
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
f (x )
f 2 ( x1 , x 2 ,..., x n ) 0
Given an SNLE:
, let x =[ x1 x 2 ... x n ]T , F = 2
...
mn
...
f m ( x1 , x 2 ,..., x n ) 0
x
f
(
)
m
i 1
i
x
x
x i (F i )T / J T x i J \ Fi ,
i
x
f1
x
1
f 2
F
x1
where J
x
...
f
m
x1
f1
x2
...
f 2
x2
...
...
f m
x2
...
...
f1
xn
f 2
xn
...
f m
x n
1-D
D Newton'
Newton s method
cf . 1
f ( xi )
x i 1 x i
f '(( x i )
x J\F
x = 3.0312, y = 2.3859
x0 x y0 y z0 z
2
A simplified
i lifi d case for
f
Lab 2.
Velocity: v
d d d
x
y
z
i.e. : v Jd
where
h the
h jacobian
j bi matrix
i iis J = [J x , J y , J z ]
J x d x0 x 2 y0 y 2 z0 z 2
x
x
y0 y
J
y
2
2
2
y
x
0 0 0
z0 z
J d
2
2
2
z z
x
x
0 0 0
x0 x
x0 x y0 y z0 z
2
0
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-37
f 2 ( x1 , y1 )
f1 ( x1 , y1 )
f 2 ( x1 , y1 )
f1 ( x1 , y1 )
x
x
J ( f1 ( x1 , y1 ) , f 2 ( x1 , y1 ) )
a n d th e J a c o b ia n : J ( f1 ( x1 , y1 ) , f 2 ( x1 , y1 ) ) d e t
f1
x
f2
x
f1
y
f2
y
xi 1 xi x
i 1
i
y
y
y
x = 3.0312, y = 2.3859
ENGG407 - Numerical Methods in Engineering, Dr. Y. Wang, 22/09/14 L3-39
1. Introduction
2. The bisection method
3 The regula falsi method
3.
4. Newtons method
5. The secant method
6. The Newton-Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8 Summary
8.
Syntax
Algorithm
A combination of bisection, secant, and inverse quadratic
interpolation methods.
Descriptions of the function
- An anonymous function
- A user-defined function
- A string of math expression
Syntax
8. Summary
1. Introduction
2. The bisection method
3 The regula falsi method
3.
4. Newtons method
5. The secant method
6 The Newton-Raphson
6.
Ne ton Raphson method for SNLEs
7. MATLAB applications in NLE analyses
8. Summaryy
Summary of Lecture 3
Lecture 3. NMs for Nonlinear Equations and Systems
Approaches to solve NLEs/SNLEs
- Bracketing methods
- Open methods
- MATLAB functions
Newtons method
- Conceptual model
- Mathematical model / Algorithm
- MATLAB implementations
Further Reading