New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
array arithmetics vs matrix multiplication #571
Comments
personally I would not mention matrix; I don't think adding matrices would help to understand arrays. |
I think the point that @thawn is trying to make is that multiplication ( import numpy
a = numpy.array([1, 2, 3])
b = numpy.array([4, 5, 6])
a * b # element-wise multiplication
>>> array([ 4, 10, 18])
numpy.cross(a, b) # cross product
>>> array([-3, 6, -3]) |
@maxim-belkin that's exactly the point I was trying to make. particularly people who are used to MATLAB, where matrix multiplication is the default for two-dimensional arrays, the behaviour of Python may be surprising. I think one sentence just saying it is not matrix multiplication but element wise multiplication would be sufficient. if you want to be perfect you would also link the words "matrix multiplication" to the documentation of how that works with numpy ;-). |
Ok. It sounds good. Thanks. |
While difference between element-wise multiplication and cross products is significant, I'm not sure we should talk about it while explaining the material. How about we add a note about element-wise multiplication vs cross product to instructor notes? |
Very good idea. So instructors can answer to questions and help to clarify only when needed. |
In section 01-numpy the following statement deals with array arithmetics:
It may be useful to mention that this is different from proper matrix multiplication which can be performed with numpy if you convert the array to a matrix object.
The text was updated successfully, but these errors were encountered: