Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> t
- matrix([[1],
- [1],
- [0]])
- >>> t.shape
- (3, 1)
- >>> w.shape
- (3, 1)
- >>> np.cross(t,w)
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 1682, in cross
- raise ValueError(msg)
- ValueError: incompatible dimensions for cross product
- (dimension must be 2 or 3)
- >>> np.cross(t.T,w.T)
- array([[-0.74535599, 0.74535599, -0.2981424 ]])
- >>> t
- matrix([[1],
- [1],
- [0]])
- >>> w
- matrix([[-0.2981424 ],
- [-0.59628479],
- [-0.74535599]])
- >>> np.cross(t,w)
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "/usr/lib64/python2.7/site-packages/numpy/core/numeric.py", line 1682, in cross
- raise ValueError(msg)
- ValueError: incompatible dimensions for cross product
- (dimension must be 2 or 3)
- >>> np.cross(t.T,w.T)
- array([[-0.74535599, 0.74535599, -0.2981424 ]])
- >>> w.shape
- (3, 1)
- >>> t.shape
- (3, 1)
- >>> A = np.matrix([[0,1],[0,0]])
- >>> A
- matrix([[0, 1],
- [0, 0]])
- >>> x = np.matrix([1,2]).T
- >>> x
- matrix([[1],
- [2]])
- >>> A * x
- matrix([[2],
- [0]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement