Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. >>> U = Matrix([[1, 1], [1, -1], [1, 1], [1, -1]])
  2. >>> U
  3. ⎡1 1 ⎤
  4. ⎢ ⎥
  5. ⎢1 -1⎥
  6. ⎢ ⎥
  7. ⎢1 1 ⎥
  8. ⎢ ⎥
  9. ⎣1 -1⎦
  10. >>> w = Matrix([1, 2, -1, 2])
  11. >>> w
  12. ⎡1 ⎤
  13. ⎢ ⎥
  14. ⎢2 ⎥
  15. ⎢ ⎥
  16. ⎢-1⎥
  17. ⎢ ⎥
  18. ⎣2 ⎦
  19. >>> P = U * (U.T * U)**-1 * U.T
  20. >>> P
  21. ⎡1/2 0 1/2 0 ⎤
  22. ⎢ ⎥
  23. ⎢ 0 1/2 0 1/2⎥
  24. ⎢ ⎥
  25. ⎢1/2 0 1/2 0 ⎥
  26. ⎢ ⎥
  27. ⎣ 0 1/2 0 1/2⎦
  28. >>> (eye(4) - P) * w
  29. ⎡1 ⎤
  30. ⎢ ⎥
  31. ⎢0 ⎥
  32. ⎢ ⎥
  33. ⎢-1⎥
  34. ⎢ ⎥
  35. ⎣0 ⎦
  36. >>> P * w
  37. ⎡0⎤
  38. ⎢ ⎥
  39. ⎢2⎥
  40. ⎢ ⎥
  41. ⎢0⎥
  42. ⎢ ⎥
  43. ⎣2⎦
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement