Matrix Operations using Python

In the previous blog ,we have seen what is an array and we have seen why Numpy is used. Let us now perform some matrix operations using numpy.

Let us see arrays first. 

Remember that matrices are strictly 2 dimensional but arrays are N dimensional. Also remember that when you perform operations on numpy arrays, operations are applied element wise. We can see this below.

screenshot-35.pngWe see that a*b is array multiplication and not matrix multiplication. Array multiplication is a element wise multiplication of each element.

Let us now play with some matrices.

screenshot-36.png

Check the picture below. We can see that multiplication of array is not matrix multiplication but individual element multiplication.

We can also find the transpose in the following way.

screenshot-37.png

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: