Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. >>> t
  2. matrix([[1],
  3. [1],
  4. [0]])
  5. >>> t.shape
  6. (3, 1)
  7. >>> w.shape
  8. (3, 1)
  9. >>> np.cross(t,w)
  10. Traceback (most recent call last):
  11. File "<stdin>", line 1, in <module>
  12. File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 1682, in cross
  13. raise ValueError(msg)
  14. ValueError: incompatible dimensions for cross product
  15. (dimension must be 2 or 3)
  16. >>> np.cross(t.T,w.T)
  17. array([[-0.74535599, 0.74535599, -0.2981424 ]])
  18. >>> t
  19. matrix([[1],
  20. [1],
  21. [0]])
  22. >>> w
  23. matrix([[-0.2981424 ],
  24. [-0.59628479],
  25. [-0.74535599]])
  26. >>> np.cross(t,w)
  27. Traceback (most recent call last):
  28. File "<stdin>", line 1, in <module>
  29. File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 1682, in cross
  30. raise ValueError(msg)
  31. ValueError: incompatible dimensions for cross product
  32. (dimension must be 2 or 3)
  33. >>> np.cross(t.T,w.T)
  34. array([[-0.74535599, 0.74535599, -0.2981424 ]])
  35. >>> w.shape
  36. (3, 1)
  37. >>> t.shape
  38. (3, 1)
  39. >>> A = np.matrix([[0,1],[0,0]])
  40. >>> A
  41. matrix([[0, 1],
  42. [0, 0]])
  43. >>> x = np.matrix([1,2]).T
  44. >>> x
  45. matrix([[1],
  46. [2]])
  47. >>> A * x
  48. matrix([[2],
  49. [0]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement