Python Program to Multiply Two Matrices

Опубликовано: 01 Апрель 2021
на канале: Paul Mansour
220
like

In this example, we will learn to multiply matrices using two different ways: nested loop and, nested list comprehension.
In Python, we can implement a matrix as nested list (list inside a list).

We can treat each element as a row of the matrix.

For example X = [[1, 2], [4, 5], [3, 6]] would represent a 3x2 matrix.

The first row can be selected as X[0]. And, the element in first row, first column can be selected as X[0][0].

Multiplication of two matrices X and Y is defined only if the number of columns in X is equal to the number of rows Y.

If X is a n x m matrix and Y is a m x l matrix then, XY is defined and has the dimension n x l (but YX is not defined). Here are a couple of ways to implement matrix multiplication in Python.


На этой странице сайта вы можете посмотреть видео онлайн Python Program to Multiply Two Matrices длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Paul Mansour 01 Апрель 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 220 раз и оно понравилось like зрителям. Приятного просмотра!