Unit 7 Pivoting

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 17

Unit#_7_Pivoiting

Spring 2017
There are many systems of equations that can be solved with
naive Gauss elimination, there are some pitfalls that must be
explored before writing a general computer program to
implement the method. Although the following material
relates directly to nave Gauss elimination, the information is
relevant for other elimination techniques as well.

Spring 2017
The primary reason that the foregoing technique is called
naive is that during both the elimination and the back-
substitution phases, it is possible that a division by zero can
occur. For example, if we use naive Gauss elimination to solve
the following system then the normalization of the first row
would involve division by a11 = 0.
2x2 + 3x3 = 8
4x + 6x2 + 7x3 = 3
1

2x1 + x2 + 6x3 = 5

Spring 2017
Because computers carry only a limited number of significant
figures round-off errors can occur and must be considered
when evaluating the results.
The problem of round-off error can become particularly
important when large numbers of equations are to be solved.
This is due to the fact that every result is dependent on
previous results. Consequently, an error in the early steps will
tend to propagatethat is, it will cause errors in subsequent
steps.
A rough rule of thumb is that round-off error may be
important when dealing with100 or more equations. In any
event, you should always substitute your answers back into
the original equations to check whether a substantial error
has occurred.

Spring 2017
Well-conditioned systems are those where a small change in
one or more of the coefficients results in a similar small
change in the solution.
Ill-conditioned systems are those where small changes in
coefficients result in large changes in the solution.
An alternative interpretation of ill-conditioning is that a wide
range of answers can approximately satisfy the equations.
Because round-off errors can induce small changes in the
coefficients, these artificial changes can lead to large solution
errors for ill-conditioned systems, as illustrated in the
following example.

Spring 2017
Spring 2017
Spring 2017
Notice that the primary reason for the discrepancy
between the two results is that the denominator
represents the difference of two almost-equal numbers.
At this point, you might suggest that substitution of the
results into the original equations would alert you to the
problem. Unfortunately, for ill-conditioned systems this is
often not the case. Substitution of the erroneous values of
x1 = 8 and x2 = 1 into Eqs. (E9.6.1) and (E9.6.2) yields
8 + 2(1) = 10 = 10
1.1(8) + 2(1) = 10.8 =10.4
Therefore, although x1 = 8 and x2 = 1 is not the true
solution to the original problem, the error check is close
enough to possibly mislead you into believing that your
solutions are adequate.

Spring 2017
Spring 2017
Spring 2017
The nave implementation of Gaussian
Elimination is not robust and can suffer from
severe round-off errors due to:
Dividing by zero
Dividing by small numbers and adding.
Both can be solved with pivoting

Spring 2017
What if at step i, Aii = 0?

Simple Fix: Factored Portion


If Aii = 0
Find Aji 0 j > i Row i

Aii
Swap Row j with i


A ji Row j

Spring 2017
1.25 104 1.25 x1 6.25

12 .5 12.5 2
x 75
Forward Elimination
1.25 104 1.25 x1 6.25
5 5
0 12.5 1.25 10 2
x 75 6.25 10

x1 1.0001
x
2 5 digits 4 . 9999

Spring 2017
1.25 104 1.25 x1 6.25
x1 1.0001
12 .5 12.5 2
x 75 x
2 5 digits 4 . 9999
Forward Elimination
1.25 104 1.25 x1 6.25
5 75 6.25 105
0 12.5 1.25 10 2
x

Rounded to 3 digits
1.25 104 1.25 x1 6.25
5 5
0 1.25 10 x2 6.25 10
x1 0
x
2 3digits 5
Spring 2017
Partial Pivoting to mitigate round-off error

If | Aii | < max | A ji |


j i

Swap row i with arg (max | Aij |)


j i

Adds an O(n) search.


Avoids Small
Multipliers

Spring 2017
swap
1.25 104 1.25 x1 6.25

12.5 12.5 x2 75 12.5 12.5 x1 75
1.25 104 1.25 x 6.25
2
Forward Elimination
12.5 12.5 x1 75

0 1.25 12.5 105 x 6.25 75 105
2

Rounded to 3 digits
12.5 12.5 x1 75
0 1.25 x 6.25
2

x1 1
x
2 3digits 5
Spring 2017
k
Partial Pivoting:
Only row interchange k
Complete (Full) Pivoting
Row and Column interchange
Threshold Pivoting k
Only if prospective pivot is found to
be smaller than a certain threshold k

Spring 2017

You might also like