0%
Posted inComputer Science

# Matrix operation in python ###### Matrix operation in python
A matrix is a collection of numbers arranged in the order of rows and columns, and it is delimited by a parenthesis. A Python matrix is a specialized two-dimensional rectangular array of data stored in columns and rows. The data in a matrix can be expressions, symbols, numbers, strings, etc. Matrix is one of the important data structures that can be used in mathematical and scientific calculations.There is a python library called numpy that can be used to do a matrix operation. Numpy is commonly used to do numerical calculations. In numpy matrix operations are also covered by special classes and sub-packages. By skipping multiple for loops, vectorization allows numpy to perform matrix operations more efficiently. The code below is the code to do a several matrix operation (addition, subtraction, division, multiplication, dot product and transposition matrix).
```import numpy

# Two matrices are initialized by value
x = numpy.array([[1, 2], [4, 5]])
y = numpy.array([[7, 8], [9, 10]])

print ("Addition of two matrices: ")