CPB20203 Chapter1
CPB20203 Chapter1
Chapter 1 1
Learning Outcomes (LO):
1. Know how to calculate root of non-linear equations
using Bisection, Newton Raphson and Secant
method.
2. Know how to calculate solution of system of linear
equations using Gaussian elimination, L-U
decomposition and Gauss-Seidel method.
Chapter 1 2
1.1 Non-linear equations
The objectives in this chapter is to find the roots
of nonlinear equations of the form = 0,
which is frequently encountered in scientific
world. Here we will learn several methods to
solve it.
Chapter 1 3
a) Bisection method
S2: Calculate =
Chapter 1 4
b) If > 0, set = and return
to S2.
c) If = 0, the root equals ,
terminate the computation.
Chapter 1 5
Example (page 23)
Chapter 1 6
b) Newton-Raphson method
This method uses a straight line approximation
to the function whose zero we wish to find,
which is the tangent to the curve.
= −
Chapter 1 7
Example (page 29)
Chapter 1 8
c) Secant method
−
= −
−
Example:
Find the root of = − 3 + 2. Start with
initial values = −2.6 and = −2.4.
Calculate until − = 0.
Chapter 1 9
Solution:
= −2.6 → −2.6 = −7.7760
= −2.4 → −2.4 = −4.6240
−
= −
−
−4.6240 −2.4 − −2.6
= −2.4 −
−4.6240 − −7.7760
= −2.1066
− = 0.29340
= −2.1066 → −2.1066 = −1.0288
Chapter 1 10
−
= −
−
−1.0288 −2.1066 − −2.4
= −2.1066 −
−1.0288 − −4.6240
= −2.0226
− = 0.083958
= −2.0266 → −2.0266 = −0.20686
Continue for , , …
Summary is in the table:
Chapter 1 11
i ( ) −
1 -2.4 -2.6 −4.6240 −7.7760 0.2
6 ? ? ? ? ?
Chapter 1 12
1.2 System of Linear Equations
In mathematics, a system of linear equations (or linear system) is
a collection of two or more linear equations involving the same
set of variables. For example,
Chapter 1 13
A general system of m linear equations with n unknowns can be
written as:
Chapter 1 14
where A is an m×n matrix, x is a column vector with n
entries, and b is a column vector with m entries.
Chapter 1 15
a) Gauss Elimination
This is one of the technique to solve linear systems. The basic procedure
follows a specific sequence of steps and only uses elementary row operations.
Elementary row operation are applied to the augmented matrix to yield an
equivalent linear system:
a) Interchange: the order of two rows can be changed
↔
b) Scaling: multiplying a row by a nonzero constant (m)
→
c) Replacement: the row can be replaced by the sum of that row and a
multiple of any row:
→ +
Where = multiple of row that is to be subtracted from row
=−
Chapter 1 16
The original matrix will then converted into an upper triangular
matrix. Then, back substitution can be used to find .
Chapter 1 17
2. Next, do the row replacement for row 2 and 3.
2 1 -1 4
4
+ =− = − = −2 0 -1 4 2
2
3
+ =− =− 0 -1/2 5/2 1.5
2
Chapter 1 18
3. Next, do replacement for row 3.
Operation Multiple (m) ( ) ( ) ( )
2 1 -1 4
0 -1 4 2
1
−2 1 0 0 1/2 0.5
+ =− =− =−
−1 2
4. Do back substitution:
1
= 0.5 → =1
2
− + 4 = 2 → − = 2 − 4 1 = −2 → =2
2 + − =4→2 +2−1=4→ = 1.5
Chapter 1 19
So, the full solutions:
1.5
= 2
1
Chapter 1 20
b) LU Decomposition
This methods separate the time-consuming elimination
of the matrix A using the concept of factorization.
Matrix A is factorize into the product of a lower
triangular matrix L that has 1’s along the main diagonal
and an upper triangular matrix U with nonzero diagonal
elements: A = LU
Chapter 1 21
Chapter 1 22
Chapter 1 23
Chapter 1 24
Chapter 1 25
Chapter 1 26
c) Gauss-Seidel
The most commonly used iterative method, which
employs initial guess and then iterates to obtain refined
estimates of the solution. Well-suited for large number
of equations.
Chapter 1 27
Chapter 1 28
Chapter 1 29
Chapter 1 30
Example:
Chapter 1 31
Chapter 1 32
End of Chapter 1
Chapter 1 33