NM unit 2
NM unit 2
Method
Chapter 2
3x+2y+7z = 4 10x-7y+3z+5u=6
2x+3y+z = 5 -6x+8y-z-4u=5
3x+4y+z = 7 3x+y+4z+11u=2
5x-9y-2z+4u = 7
Pitfalls of Elimination Methods
– Division by zero. It is possible that during both elimination and back-substitution
phases a division by zero can occur.
– Round-off errors.
– Ill-conditioned systems. Systems where small changes in coefficients result in
large changes in the solution. Alternatively, it happens when two or more
equations are nearly identical, resulting a wide ranges of answers to
approximately satisfy the equations. Since round off errors can induce small
changes in the coefficients, these changes can lead to large solution errors.
Slight change of – Singular systems. When two equations are identical, we would loose one degree
coefficient a21 from 1.1
of freedom and be dealing with the impossible case of n-1 equations for n
to 1.05, the result is
changed dramatically unknowns. For large sets of equations, it may not be obvious however. The fact
that the determinant of a singular system is zero can be used and tested by
computer algorithm after the elimination stage. If a zero diagonal element is
created, calculation is terminated.
Partial Pivoting / Complete Pivoting Method
– Solve using gauss elimination
0.0003 x +3.0000y = 2.0001
1.0000 x+1.0000y =1.0000
Techniques for Improving Solutions
– Use of more significant figures.
– Pivoting. If a pivot element is zero, normalization step leads to division by zero.
The same problem may arise, when the pivot element is close to zero. Problem
can be avoided:
– Partial pivoting. Switching the rows so that the largest element is the pivot element.
– Complete pivoting. Searching for the largest element in all rows and columns then
switching.
Gauss-Jordan Method
– We begin by writing the system as an augmented matrix
x = 1,
y = -1,
z=2
Solve the system
2x - 2 y + z = 13
2x + 3y + 4z = 20
3x - y + 3z = 10
2x + y + 4z = 12
8x - 3y + 2z = 20
4x + 11y - z = 33
Gauss-Jordan Method to find inverse metrix
– To find the inverse to an nxn matrix A:
– Adjoin the identity matrix I to the right side of A, thereby producing a matrix of the
form [A|I]
– Apply row operations to this matrix until the left side is reduced to I. If successful,
these operations will convert the right side to A-1, so that the final matrix will have
the form [I|A-1]
Find the inverse matrix of following metrix using Gauss-Jordan Method.
– Do row operations to get upper triangle form – Continue doing row operations to get 0’s
in columns above the pivots:
2. Read the order of the matrix ‘n’ and read the coefficients of the linear equations.
3. Do for k=1 to n
End for l
Set a[k][k] = 1
Do for i=1 to n
End for j
End for i
End for k
4. Do for m=1 to n
x[m] = a[m][n+1]
Display x[m]
End for m
5. Stop
Let’s take an example
Factorization Method
– LU Decomposition
– The LU decomposition is useful when one needs to solve Ax = b, when A is fixed
and there are many different b’s.
– First one determines L and U using Gaussian elimination. Then one writes
Ax = b
(LU)x = L(Ux) = b
we let
y = Ux,
And first solve, Ly = b
For y be forward substitution. We then solve, Ux = y
Solving Method
– Given
[A][X] = B
– New x1 is substituted to calculate x2 and x3, The procedure is repeated until the
convergence criterion is satisfied.
1 − 3 x 2 + 5 x3 With an initial guess of
x1 =
12 x1 1
28 − x1 − 3x3 x = 0
x2 = 2
5 x3 1
76 − 3x1 − 7 x 2
x3 =
After Iteration #1 13
x1 0.5000 Substituting the x values into the After Iteration #2
x = 4.9000 equations x1 0.14679
2 x = 3.7153
x3 3.0923 1 − 3(4.9000) + 5(3.0923)
x1 = = 0.14679 2
12 x3 3.8118
28 − (0.14679) − 3(3.0923)
x2 = = 3.7153
5
76 − 3(0.14679) − 7(4.900)
x3 = = 3.8118
13
Repeating more iterations, the following values are obtained
x1 0.99919 x1 1
The solution obtained x = 3.0001 is close to the exact solution of x = 3 .
2 2
x3 4.0001 x3 4
Eigen value and Eigen vector
Eigen value and Eigen vector using Power method
– Power method is one of the most well suited iterative approach for machine
computations.
– With this, the numerically greatest eigen value and the corresponding eigen
vector can be computed to analyze different engineering problems.
– Solving polynomials, systems of equations and differential equations, with
applications to physics, geology, civil engineering, mechanical engineering,
machine learning etc
Power Method to find dominant eigen value