-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathGroupA_Practical9(python).py
More file actions
35 lines (25 loc) · 921 Bytes
/
GroupA_Practical9(python).py
File metadata and controls
35 lines (25 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
This program is created by ATHARVA PAWAR
Experiment No. 9 : Write a Python Program to compute following computation on matrices :
a)Addition of two matrices
b)Subtraction of two matrices
c)Multiplication of two matrices
d)Transpose of a matix
'''
import numpy
# initializing matrices
x = numpy.array([[1, 2], [4, 5]])
y = numpy.array([[7, 8], [9, 10]])
# using add() to add matrices
print("The element wise addition of matrix is : ")
print(numpy.add(x, y))
# using subtract() to subtract matrices
print("The element wise subtraction of matrix is : ")
print(numpy.subtract(x, y))
# using dot() to multiply matrices
print ("The product of matrices is : ")
print (numpy.dot(x,y))
# using "T" to transpose the matrix
print("The transpose of given matrix is : ")
print(x.T)
# Created by ATHARVA PAWAR