Week-4 Nonlinear Itraration

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

Numerical Methods

Week-4
Solution of Nonlinear System
Iterative Methods
SZABIST, Karachi

1
Nonlinear Iterations
Many methods are available to solve nonlinear equations:
Bisection Method
False position Method
Fixed point iterations
Seidel Method
Newton’s Method or Newton Raphson Method
Secant Method
Bisection Method
• The Bisection method is one of the simplest
• To use the Bisection method, one needs an initial
interval that is known.
• The method systematically reduces the interval. It
does this by dividing the interval into two equal
parts, performs a simple test and based on the result
of the test, half of the interval is thrown away.
• The procedure is repeated until the desired interval
size is obtained.
Bisection Method
ab
c
2

or If f(b)*f(c)<0 then replace a=c, otherwise b=c


Bisection Method
Example-1(Bisection Method)
Find the root of:

f ( x)  x  3x  1 in the interval : [0,1]


3

* f(x) is continuous
* f( 0 )  1, f (1)  1  f (a) f (b)  0
 Bisection method can be used to find the root
Example-1(Bisection Method)
c= (a+b)
Iteration a b f(c)
2

1 0 1 0.5 -0.375

2 0 0.5 0.25 0.266

3 0.25 0.5 .375 -7.23E-3

4 0.25 0.375 0.3125 9.30E-2


5 0.3125 0.375 0.34375 9.37E-3
Example-2 (Bisection Method)
False Position Method

or If f(b)*f(c)<0 then replace a=c, otherwise b=c

• Example:
False Position Method
Example (FPM)
Fixed Point Iteration

pk 1  g1 ( pk , qk )
qk 1  g 2 ( pk , qk )
Convergence

g1 g1
( p, q )  ( p, q )  1
x y

g 2 g 2
( p, q )  ( p, q )  1
x y
Fixed Point Iteration
Q) For the given nonlinear system with ( p0 , q0 )  (1.1, 2)
and compute the next 3 iterations.
8x  4 x2  y 2  1 2x  x2  y 2  4 y  3
x  g1 ( x, y )  , y  g 2 ( x, y ) 
8 4

8 pk  4 pk 2  qk 2  1 2 pk  pk 2  qk 2  4qk  3
pk 1  , qk 1 
8 4
Convergence:
1  p  q / 4  0.6  1
1 p 2  q
  0.05  1
2 2
Fixed Point Iteration

8 p0  4 p0 2  q0 2  1 2 p0  p0 2  q0 2  4q0  3
@ k 0 p1  , q1 
8 4
p1  1.12, q1  1.9975

8 p1  4 p12  q12  1 2 p1  p12  q12  4q1  3


@ k 1 p2  , q2 
8 4
p2  1.1165, q2  1.9963

Find p3,q3 ?
Seidel Iteration
pk 1  g1 ( pk , qk )

qk 1  g 2 ( pk 1 , qk )

Convergence

g1 g1
( p, q )  ( p, q )  1
x y

g 2 g 2
( p, q )  ( p, q )  1
x y
Seidel Iteration
Q) For the given nonlinear system with ( p0 , q0 )  (1.1, 2)
and compute the next 3 iterations.
8x  4 x2  y 2  1 2x  x2  y 2  4 y  3
x  g1 ( x, y )  , y  g 2 ( x, y ) 
8 4

8 pk  4 pk 2  qk 2  1 2 pk 1  pk 12  qk 2  4qk  3
pk 1  , qk 1 
8 4
Convergence:
1  p  q / 4  0.6  1
1 p 2  q
  0.05  1
2 2
Seidel Iteration

8 p0  4 p0 2  q0 2  1 2 p1  p12  q0 2  4q0  3
@ k 0 p1  , q1 
8 4
p1  1.12, q1  1.9964

8 p1  4 p12  q12  1 2 p2  p2 2  q12  4q1  3


@ k 1 p2  , q2 
8 4
p2  1.1165, q2  1.99663

Find p3,q3 ?
Newton Method
Given an initial guess of the root x0, Newton-
Raphson method uses information about the
function and its derivative at that point to find
a better guess of the root.
Assumptions:
– f(x) is continuous and the first derivative is known
– An initial guess x0 such that f’(x0)≠0 is given

f ( xn )
xn 1  xn 
f ( xn )
Newton Method
Find a zero of the function f(x)  x 3  2 x 2  x  3 , x0  4
f ' (x)  3 x 2  4 x  1
f ( x0 ) 33
Iteration1 : x1  x0   4 3
f ' ( x0 ) 33
f ( x1 ) 9
Iteration 2 : x2  x1   3   2.4375
f ' ( x1 ) 16
f ( x2 ) 2.0369
Iteration 3 : x3  x2   2.4375   2.2130
f ' ( x2 ) 9.0742
Newton Method

k xk f(xk) f’(xk) xk+1


(Iteration)
0 4 33 33 3

1 3 9 16 2.4375

2 2.4375 2.0369 9.0742 2.2130

3 2.2130 0.2564 6.8404 2.1756

4 2.1756 0.0065 6.4969 2.1746


Secant Method

f ( xn 1 )[ xn 1  xn ]
xn  2  xn 1 
f ( xn 1 )  f ( xn )

• Example:
f ( x)  x5  x 3  3
initail point
x0  1 and x1  1.1
Secant Method

xn f(xn) xn+1

-1.0000 1.0000 -1.1000

-1.1000 0.0585 -1.1062

-1.1062 0.0102 -1.1052

-1.1052 0.0001 -1.1052


Secant Method
• Try it

f ( x)  x  2 x  0.5
2

initail point
x0  0 and x1  1
Jacobian Matrix
Example (Jacobian)
Newton Method
Example (Newton’s Method)
Example (Newton’s Method)
Example (Newton’s Method)
Example-1
• Solve the following system of equations:
y  x 2  0.5  x  0
x 2  5 xy  y  0
Initial guess x  1, y  0

 y  x 2  0.5  x   2x 1 1  1
F  2 , F '    , X0   
 x  5 xy  y  2 x  5 y  5 x  1 0
Example-1
Iteration1 :
 y  x 2  0.5  x   0.5  2x 1 1  1 1 
F  2 
   , F '     
 x  5 xy  y   1   2 x  5 y  5 x  1  2  6 
1
1 1 1   0.5 1.25
X1        1   0.25
0   2  6     
Iteration 2 :
0.0625  1.5 1 
F   , F '  1.25  7.25
 - 0.25   
1
1.25  1.5 1  0.0625 1.2332
X2       - 0.25   0.2126
 0 . 25  1 . 25  7 . 25    
Example-2
y  x2 1 x  0
x2  2 y2  y  0
Initial guess x  0, y  0

 y  x 2  1  x 2 x  1 1  0 
F  2 , F '    , X0   
 x  2y  y 
2
 2x  4 y  1 0 

Iteration 0 1 2 3 4 5
_____________________________________________________________
0   1  0.6  0.5287  0.5257  0.5257
Xk 0  0  0.2   0.1969   0.1980   0.1980 
           
Example-3

Use Newton' s Method to find a root of :


f ( x )  e  x  x, f ' ( x )  e  x  1 initial point x0  1

f ( xk )
xk f ( xk ) f ' ( xk )
f ' ( xk )
1.0000 - 0.6321 - 1.3679 0.4621
0.5379 0.0461 - 1.5840 - 0.0291
0.5670 0.0002 - 1.5672 - 0.0002
0.5671 0.0000 - 1.5671 - 0.0000

You might also like