Ask Questions and get answer about programming
I am new to python and numpy.
How can i create an identity matrix of order 3x3 or 2x2 in python?
numpy has a method eye, from which you can create a identity matrix of of any size. You have to just pass the order of the matrix such as
import numpy as np
# Create a 2x2 identity matrix
a = np.eye(2)
# Create a 3x3 identity matrix
a = np.eye(3)