# Comparing Minimum from Matrices | Linear Algebra using Python

Linear Algebra using Python | Comparing Minimum from Matrices: Here, we are going to learn about the comparing minimum from matrices and its implementation in Python.
Submitted by Anuj Singh, on June 08, 2020

Prerequisites:

Learn: how to find the minimum value from comparison of each element in two matrices using an inbuilt function in the numpy library?

Syntax:

```numpy.minimum(Matrix_M1, Matrix_M2)
```

Return:

A matrix of same dimension with given matrix containing minimum value at each entry among both matrices.

## Python code for comparing minimum from matrices

```# Linear Algebra Learning Sequence
# Minimum Value Comparing

import numpy as np

M = np.array([[2,3,4], [4,4,8], [4,8455,7], [4,8,99] ])
MM = np.array([[2,3,46], [4,44,8], [4,8,7], [4,8,9] ])

print("\n\n---Matrix A---\n", M)
print("\n\n---Matrix B---\n", MM)
print('\n\n---minimum value comparasion : ', np.minimum(M,MM))
```

Output:

```
---Matrix A---
[[   2    3    4]
[   4    4    8]
[   4 8455    7]
[   4    8   99]]

---Matrix B---
[[ 2  3 46]
[ 4 44  8]
[ 4  8  7]
[ 4  8  9]]

---minimum value comparasion :  [[2 3 4]
[4 4 8]
[4 8 7]
[4 8 9]]
```

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates