
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
partial pivoting example on numerical analysis
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Gaussian Elimination with Partial Pivoting Example
Apply Gaussian elimination with partial pivoting to A =
and solve^ Ax^ =^ b
for b =
Solution:
Apply Gaussian elimination with partial pivoting to A using the compact storage mode where the multipliers (= elements of L) are stored in A in the locations of A that are to be made zero.The elements of L are in red. Note that when one interchanges rows of the current A, one must also interchange rows of the current L. For example, in the step at the third arrow, below, we switch the second and fourth rows of A 2 and L 2. No row interchanges are required for A 3 , so we have skipped pivoting for A 3.
λ A 1 1 | 1 2 − 4 3 2 | 2 5 − 6 10 3 | − 2 − 7 3 − 21 4 | 2 8 − 5 38
λ P 1 A 1 2 | 2 5 − 6 10 1 | 1 2 − 4 3 3 | − 2 − 7 3 − 21 4 | 2 8 − 5 38
λ L 2 and A 2 2 | 2 5 − 6 10 1 | 1 / 2 − 1 / 2 − 1 − 2 3 | − 1 − 2 − 3 − 11 4 | 1 3 1 28
λ P 2 L 2 and P 2 A 2 2 | 2 5 − 6 10 4 | 1 3 1 28 3 | − 1 − 2 − 3 − 11 1 | 1 / 2 − 1 / 2 − 1 − 2
λ L 3 and A 3 2 | 2 5 − 6 10 4 | 1 3 1 28 3 | − 1 − 2 / 3 − 7 / 3 23 / 3 1 | 1 / 2 − 1 / 6 − 5 / 6 8 / 3
λ L 4 and A 4 2 | 2 5 − 6 10 4 | 1 3 1 28 3 | − 1 − 2 / 3 − 7 / 3 23 / 3 1 | 1 / 2 − 1 / 6 5 / 14 − 1 / 14
So U = A 4 =
and^ L^ =^ L^4 =
P will have a one in columns 2, 4 , 3 and 1, in that order, (see λ ) so P =
. The per-
mutation vector, p, describing the matrix P is p = [2 4 3 1]. P A = A(p, :) =
Here A(p, :) uses Matlab notation. LU = P A can be checked.
To solve Ax = b note that P Ax = P b = ̂b or LU x = ̂b. Therefore we can solve Ax = b in three steps:
(1) Let ̂b = P b =
(2) Solve Lw = ̂b using forward substitution. We get w =
(3) Solve U x = w using back substitution. We get x =