Errors when Adding Matrices
- زمان مطالعه 0 دقیقه
- سطح خیلی سخت
دانلود اپلیکیشن «زوم»
این درس را میتوانید به بهترین شکل و با امکانات عالی در اپلیکیشن «زوم» بخوانید
متن انگلیسی درس
Let’s talk a bit more about scalers scalers are more peculiar than higher dimension objects because
they are single numbers.
We didn’t talk about it but you know very well how to add two scalars together right five plus five
Ten minus four equal six.
You also know that in order to add vectors and matrices together their forms must match.
We are not allowed to add vectors of different length and matrices with different dimensions.
Such operations are not permitted in linear algebra and Python knows that.
For instance if I try to add a two by three Matrix with a two by two Matrix we will get this message
operands could not be broadcast together with shapes and we will be shown the operands respective shapes.
Similarly if I try to add two vectors with different lengths I will receive the same error.
Mathematically these operations don’t make sense so they cannot be executed.
OK there is one exception because of how arrays work in Python and many other languages we can actually
add scalars to matrices and vectors for instance.
If I add one to the Matrix M1 you can see that one was added element wise.
In other words each element was increased by one.
Similarly if I add 1 to the vector V1 it will be added element wise.
Mathematically this operation is not allowed as the shapes are different but in programming or at least
in Python it works.
It was very important to be aware of this peculiarity probably some of you may have already tried it
and found out that it yields a result.
The result has a meaning in terms of arrays but not in terms of linear algebra.
That is also one of the big differences between the concepts of d arrays and tensors.
مشارکت کنندگان در این صفحه
تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.
🖊 شما نیز میتوانید برای مشارکت در ترجمهی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.