0% found this document useful (0 votes)
68 views4 pages

Walchand Institute of Technology, Solapur Information Technology

The document is an assignment from Archana Vivekanand Soma, a student at Walchand Institute of Technology, for their Machine Learning course. The assignment involves performing matrix operations using NumPy, including adding, subtracting, multiplying matrices, and calculating the rank of a matrix. Code examples are provided to add, subtract, and multiply matrices and calculate the rank of a matrix using NumPy functions.

Uploaded by

08Archanasoma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

Walchand Institute of Technology, Solapur Information Technology

The document is an assignment from Archana Vivekanand Soma, a student at Walchand Institute of Technology, for their Machine Learning course. The assignment involves performing matrix operations using NumPy, including adding, subtracting, multiplying matrices, and calculating the rank of a matrix. Code examples are provided to add, subtract, and multiply matrices and calculate the rank of a matrix using NumPy functions.

Uploaded by

08Archanasoma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Walchand Institute of Technology, Solapur

INFORMATION TECHNOLOGY
COURSE:  MACHINE LEARNING
  CLASS: B.E. [I.T.] -20-21
(SEM-II)
Name: Archana Vivekanand Soma
Roll No: 08
Assignment 2
Problem Statement: To Perform Matrix Operations such as Matrix Addition,
Matrix Subtraction, Matrix Multiplication, and  Rank of matrix.

1)Addition of Matrix:

import numpy as np

matrix_a = np.array([[1, 1, 1],

[1, 1, 1],

[1, 1, 2]])

matrix_b = np.array([[1, 3, 1],

[1, 3, 1],

[1, 3, 8]])

np.add(matrix_a, matrix_b)

1
Walchand Institute of Technology, Solapur
INFORMATION TECHNOLOGY
COURSE:  MACHINE LEARNING
  CLASS: B.E. [I.T.] -20-21
(SEM-II)
Name: Archana Vivekanand Soma
Roll No: 08
Assignment 2

2)Substraction of Matrix:

import numpy as np

matrix_a = np.array([[1, 1, 1],


[1, 1, 1],
[1, 1, 2]])

matrix_b = np.array([[1, 3, 1],


[1, 3, 1],
[1, 3, 8]])

2
Walchand Institute of Technology, Solapur
INFORMATION TECHNOLOGY
COURSE:  MACHINE LEARNING
  CLASS: B.E. [I.T.] -20-21
(SEM-II)
Name: Archana Vivekanand Soma
Roll No: 08
Assignment 2
np.subtract(matrix_a, matrix_b)

3)Multiplication of Matrix:

import numpy as np
matrix_a = np.array([[1, 1],
[1, 2]])
matrix_b = np.array([[1, 3],
[1, 2]])

np.dot(matrix_a, matrix_b)

3
Walchand Institute of Technology, Solapur
INFORMATION TECHNOLOGY
COURSE:  MACHINE LEARNING
  CLASS: B.E. [I.T.] -20-21
(SEM-II)
Name: Archana Vivekanand Soma
Roll No: 08
Assignment 2

4)Rank of Matrix:

import numpy as np
matrix = np.array([[1, 1, 1],
[1, 1, 10],
[1, 1, 15]])

np.linalg.matrix_rank(matrix)

You might also like