Math 105 Computer Assignment 3
Due Mon 10/29, 5pm
Implement algorithm 6.1 that accomplishes Gaussian elimination with row swap-
ping.
INPUT : number of unknowns n; and the argument matrix A = [aij], where
1 i n and 1 j n+ 1
OUTPUT : solution x1;x2;:::;xn
Step 1: For i = 1 to n-1 do steps 2 - 4
Step 2: Let p be the smallest integer with i p n and api6= 0.
If no integer p can be found then output ( ’no unique solution’) STOP
Step 3: If p6= i then perform. swap the p-th row and i-th row
Step 4: For j = i+ 1;:::n do steps 5 and 6
Step 5: Set mj;i = aji=aii
Step 6: Perform. (Ej mjiEi) ! Ej where Ej represents j-th row or j-th
equation
Step 7: If ann = 0 then OUTPUT ( ’no unique solution exists’); STOP
Step 8: Set xn = an;n+1=ann.
Step 9: For i = n 1;:::1 Set xi =