Advertisement
Guest User

Section 1.9 Question 39

a guest
Feb 20th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. # Section 1.9 Question 39
  2. # Row operations are grouped with others independent of them for this question
  3.  
  4. # Forward phase
  5.  
  6. A = [4 -2 5 -5 7 ; -9 7 -8 0 5 ; -6 4 5 3 9 ; 5 -3 8 -4 7]
  7.  
  8. A([1 4], :) = A([4 1], :) # Switching rows 1 and 4
  9.  
  10. A(1,:) = A(1,:) - A(4,:) # Subtracting row 4 from row 1
  11.  
  12. A(2,:) = A(2,:) + 9*A(1,:) # Adding 9*row 1 to row 2
  13. A(3,:) = A(3,:) + 6*A(1,:) # Adding 6*row 1 to row 3
  14. A(4,:) = A(4,:) - 4*A(1,:) # Subtracting 4*row 1 from row 4
  15.  
  16. A(3,:) = A(3,:) - A(2,:) # Subtracting row 2 from row 3
  17. A(4,:) = A(4,:) + A(2,:) # Adding row 2 to row 4
  18.  
  19. A(2,:) = -1/2*A(2,:) # Scaling row 2 so pivot is 1
  20. A(3,:) = 1/4*A(3,:) # Scaling row 3 so pivot is 1
  21.  
  22. A(4,:) = A(4,:) + 12*A(3,:) # Adding 12*row 3 to row 4
  23.  
  24. # Backward phase
  25.  
  26. A(2,:) = A(2,:) - 19/2*A(3,:) # Subtracting 19/2*row 3 from row 2
  27. A(1,:) = A(1,:) - 3*A(3,:) # Subtracting 3*row 3 from row 1
  28.  
  29. A(1,:) = A(1,:) + A(2,:) # Adding row 1 to row 2
  30.  
  31. # x4 is free, so there are more than one x in the transformation x |-> Ax to yield b
  32. # All solutions take the form below:
  33.  
  34. p = [4 7 1 0]
  35. v = [7/2 9/2 0 1]
  36. x4 = 0
  37. x = p + x4*v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement