Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Section 1.9 Question 39
- # Row operations are grouped with others independent of them for this question
- # Forward phase
- A = [4 -2 5 -5 7 ; -9 7 -8 0 5 ; -6 4 5 3 9 ; 5 -3 8 -4 7]
- A([1 4], :) = A([4 1], :) # Switching rows 1 and 4
- A(1,:) = A(1,:) - A(4,:) # Subtracting row 4 from row 1
- A(2,:) = A(2,:) + 9*A(1,:) # Adding 9*row 1 to row 2
- A(3,:) = A(3,:) + 6*A(1,:) # Adding 6*row 1 to row 3
- A(4,:) = A(4,:) - 4*A(1,:) # Subtracting 4*row 1 from row 4
- A(3,:) = A(3,:) - A(2,:) # Subtracting row 2 from row 3
- A(4,:) = A(4,:) + A(2,:) # Adding row 2 to row 4
- A(2,:) = -1/2*A(2,:) # Scaling row 2 so pivot is 1
- A(3,:) = 1/4*A(3,:) # Scaling row 3 so pivot is 1
- A(4,:) = A(4,:) + 12*A(3,:) # Adding 12*row 3 to row 4
- # Backward phase
- A(2,:) = A(2,:) - 19/2*A(3,:) # Subtracting 19/2*row 3 from row 2
- A(1,:) = A(1,:) - 3*A(3,:) # Subtracting 3*row 3 from row 1
- A(1,:) = A(1,:) + A(2,:) # Adding row 1 to row 2
- # x4 is free, so there are more than one x in the transformation x |-> Ax to yield b
- # All solutions take the form below:
- p = [4 7 1 0]
- v = [7/2 9/2 0 1]
- x4 = 0
- x = p + x4*v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement