KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just started learning SciPy and am struggling with the most basic features. Consider the following standard vector: In [6]: W=array([[1],[2]]) In [7]: print W [[1] [2]] If I understand it correctly, this should be the SciPy representation of a standard 2x1 mathematical vector, like this: (1) (2) The dot product of this vector should simply be 1*1+2*2=5 . However, this does not work in SciPy: In [16]: dot(W, W) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /home/ingo/<ipython-input-16-961b62a82495> in <module>() ----> 1 dot(W, W) ValueError: objects are not aligned Note that the following works. This should be a vector of the form (1 2) if I am not mistaken. In [9]: V=array([1,2]) In [10]: print V [1 2] In [11]: dot(V, V) Out[11]: 5 What is my misconception? What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel