Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # DSL Practical 3
- # @author: xCircle (Pranav)
- import numpy as np
- m1 = np.array([[1,2,3], [4,5,6], [7,8,9]])
- m2 = np.array( [[7,8,9], [1,2,3], [4,5,6]])
- print("Addition of m1 m2")
- print(np.add(m1,m2)) # Add two matrices
- print("Subtraction of m1 m2")
- print(np.subtract(m1,m2)) # Subtract two matrices
- print("Multiplication of m1 m2")
- print(np.multiply(m1,m2)) # Multiply two matrices
- print("Division of m1 m2")
- print(np.divide(m1,m2)) # Divide two matrices
- print("Transpose of m1")
- print(m1.T) # Transpose of a matrix
Advertisement
Add Comment
Please, Sign In to add comment