Exam1_1013_sol

A ip 3 3 6 5 0 2 2 1 4 6 2 4 12 1 1 12 4 4 3 6 12 2 4

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: 2 3 16 For the elimination applied to b 5 we 8 888 get it changing to 5 , 1 , 20 , and 16 20 1 8 finally 20 . In the bottom loop we b3 4 4 4 and x3 2. Then we get 2 12 b2 20 (4) 2 12 so x2 3 . 4 Finally we get b1 8 2 (3) 4 2 6 so 6 x1 1. 6 6. Fill in the five blanks in the code for Gaussian Elimination with 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 x=b for i = n:-1:1 for j = i+1:n xi xi Ai , j x j end xi bi / Ai ,i end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online