filmov
tv
Python Tutorial - Python Numpy Array Multiplication

Показать описание
This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.
In python we will import numpy as np
parentheses, bracket to start the matrix, then another bracket to enter the first row. After each row close with a bracket. At the end close the entire matrix with one more bracket and finally close your parentheses
This is what the array will look like when you print it out
We will save this 3x3 array as x
Here we are reshaping our x matrix to be a one long matrix that is 1 row by 9 columns
This is important to do sometimes because In matrix multiplication, the dimensions need to line up. An easy way to remember how to know if the dimensions will work is to look at the number of columns of the first matrix (or second dimension number) and the number of rows of the second matrix (or first dimension number). Those numbers need to be the same for it to work
Now I have defined a y matrix so we can see multiplication.
Notice the x is shaped (3,3) and the y is (3,2) since 3=3 we can do this multiplication, but only if we do x first then y
To multiply you can use the @ symbol.
There you have it, that is how you multiply matrices or arrays in python
#PythonMarathon #LearnPython #PythonTutorial Learn Python:
Video Equipment:
Other:
Комментарии