Zeros Matrix using numpy.zeros() | Linear Algebra using Python

Linear Algebra using Python | Zeros Matrix using numpy.zeros(): Here, we are going to learn about creating zeros matrix using numpy.zeros() in Python.
Submitted by Anuj Singh, on May 29, 2020

Zeros Matrix - When all the entries of a matrix are one, then it is called a zeros matrix. It may be of any dimension (MxN).

Properties:

  • The determinant of the matrix is 0.
  • The Rank of any zeros Matrix is 1.

In python, we have an inbuilt function (defined in numpy library) numpy.zeros() to define the zeros matrix. Here is the code with examples.

Python code for zeros matrix using numpy.zeros()

# Linear Algebra Learning 
# Zeros Matrix

import numpy as np

a = np.zeros([3,5])
b = np.zeros([6,6])
c = np.zeros([9,5])

#printing the matrices
print("\n----Zeros Matrix (3x5)----\n",a)
print("\n----Zeros Matrix (9x5)----\n",c)
print("\n----Zeros Matrix (6x6)----\n",b)

Output:

----Zeros Matrix (3x5)----
 [[0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]]

----Zeros Matrix (9x5)----
 [[0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0.]]

----Zeros Matrix (6x6)----
 [[0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0.]]





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





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


© https://www.includehelp.com some rights reserved.