You are on page 1of 34

Numerical Analysis

Lecture8: Iterative Methods


Semester 1 (2022-2023)

Doaa Saleh Mahdi


1
Iterative methods
• Seidel Iteration Method
Seidel Iteration Method
• Jacobi and Gauss-Seidel Methods
Jacobi method
Gauss- Seidel Method
Example

Gauss- Seidel Method


Example
Example
Example
Boundary-Value and
Initial Value Problems
Initial-Value Problems Boundary-Value Problems

 The auxiliary conditions are at • The auxiliary conditions are not at


one point of the one point of the independent
independent variable variable
• More difficult to solve than initial
value problem

x  2 x  x  e 2 t x  2 x  x  e 2t


x(0)  1, x (0)  2.5 x(0)  1, x(2)  1.5
same different

23
Solution of Boundary-Value Problems
Finite Difference Method

Boundary-Value convert
Algebraic
Problems Equations
Find the unknowns y1, y2, y3

y4=0.8
Find y ( x) to solve BVP y3=?
y y1=?
y  2 y  y  x
2
y2=?
y0=0.2
y (0)  0.2, y (1)  0.8
0 0.25 0.5 0.75 1.0 x
x0 x1 x2 x3 x4

24
Solution of Boundary-Value Problems
Finite Difference Method

• Divide the interval into n sub-intervals.


• The solution of the BVP is converted to the
problem of determining the value of function
at the base points.
• Use finite approximations to replace the
derivatives.
• This approximation results in a set of
algebraic equations.
• Solve the equations to obtain the solution of
the BVP.
25
Finite Difference Method
Example
y  2 y  y  x 2
y (0)  0.2, y (1)  0.8 To be
determined
Divide the interval
[0,1 ] into n = 4 y y3=? y4=0.8
intervals y1=?
Base points are y2=?
x0=0
x1=0.25 y0=0.2

x2=.5
x3=0.75 0 0.25 0.5 0.75 1.0 x
x4=1.0 x0 x1 x2 x3 x4

26
Finite Difference Method
Example
y  2 y  y  x 2
y (0)  0.2, y (1)  0.8
Divide the interval Replace
[0,1 ] into n = 4 yi 1  2 yi  yi 1
intervals y  2
central difference formula
h
Base points are y y
y  i 1 i 1 central difference formula
x0=0 2h
x1=0.25 y  2 y  y  x 2
x2=.5 Becomes
x3=0.75 yi 1  2 yi  yi 1 yi 1  yi 1
2  yi  xi 2
h2 2h
x4=1.0

27
Second Order BVP

d2y dy
2
 2  y  x 2
with y (0)  0.2, y (1)  0.8
dx dx
Let h  0.25
Base Points
x0  0, x1  0.25, x2  0.5, x3  0.75, x4  1
dy y ( x  h)  y ( x) yi 1  yi
 
dx h h
d2y y ( x  h)  2 y ( x )  y ( x  h) yi 1  2 yi  yi 1
2
 2

dx h h2
28
Second Order BVP

d2y dy
 2  y  x 2
dx 2 dx
yi 1  2 yi  yi 1 yi 1  yi
2
 2  yi  xi i  1,2,3
2
h h
x0  0, x1  0.25, x2  0.5, x3  0.75, x4  1
y0  0.2, y1  ?, y2  ?, y3  ?, y4  0.8
16 yi 1  2 yi  yi 1   8 yi 1  yi   yi  xi 2

24 yi 1  39 yi  16 yi 1  xi 2
29
Second Order BVP

24 yi 1  39 yi  16 yi 1  xi
2

i 1 24 y2  39 y1  16 y0  x1
2

i2 24 y3  39 y2  16 y1  x2
2

i3 24 y4  39 y3  16 y2  x3
2

 39 24 0   y1   0.252  16(0.2) 
 16  39 24   y    0.5 2 
  2   
 0 16  39  y3  0.752  24(0.8)
Solution y1  0.4791, y2  0.6477, y3  0.7436

30
Summary of the Discretiztion Methods
• Select the base points.
• Divide the interval into n sub-intervals.
• Use finite approximations to replace the
derivatives.
• This approximation results in a set of
algebraic equations.
• Solve the equations to obtain the solution of
the BVP.
31
Remarks
Finite Difference Method :
– Different formulas can be used for approximating
the derivatives.
– Different formulas lead to different solutions. All
of them are approximate solutions.

32
33
Example

34

You might also like