Exam1_Solutions_Fall_2013_mod

N3 additions and each of the m different 3 n3 2 mn 2

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: systems requires n additions for a total of 3 T he elimination step on the matrix requires 5 . Use the Gaussian Elimination w ith Partial Pivoting and Solution algorithm to solve 2 x1 2 x2 x3 4 x1 4 x2 6 x3 11 4 x1 8 x2 4 x3 4 Show w hat occupies storage in the A m atrix and the ip array initially and after each major step of elimination. A ip -2 1 4 -2 -4 -8 1 6 4 ? ? ? 4 -8 4 3 1/4 -2 5 -1/2 -6 3 ? ? 4 1/4 -8 -6 -1/2 1/3 4 3 4 3 3 ? 4 -8 4 3 1/4 -6 3 3 -1/2 1/3 4 3 4 F or the elimination applied to b 11 w e 4 4 4 4 get it changing to 11 , 10 , 6 , and 4 6 10 4 finally 6 . In the bottom loop w e b3 8 8 8 and x3 2. T hen w e get 4 0 b2 6 3 2 0 so x2 0 . Finally 6 w e get b1 4 (8) 0 4 2 4 so 4 x1 1. 4 6 . Fill in the five blanks in the code for Gaussian Elimination w ith Partial Pivoting and Solution separated from elimination: for k = 1:n choose ipk such that | Aipk ,k | max{| Ai ,k |: i k} if Aipk ,k 0 warning ('Pivot in Gaussian Elimination is zero') end swap Ak ,k ,..., Ak ,n with Aipk ,k ,..., Aipk ,n for i = k+1:n Ai ,k = Ai ,k / Ak ,k for j = k+1:n Ai , j Ai , j Ai ,k Ak , j end end end for k = 1:n swap bk with bipk for i = k+1:n bi bi Ai ,k bk end end for i = n:-1:1 for j = i+1:n bi bi Ai , j x j end xi bi / Ai ,i end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online