Related Articles

Related Articles

Python | sympy.zeros() method
  • Last Updated : 29 Jun, 2019

With the help of sympy.zeros() method, we can create a matrix having dimension nxm and filled with zeros by using sympy.zeros() method.

Syntax : sympy.zeros()
Return : Return a zero matrix.

Example #1 :
In this example, we can see that by using sympy.zero() method, we are able to create the zero matrix having dimension nxn all filled with zeros, where nxm will be pass as a parameter.

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy
from sympy import *
  
# Use sympy.zero() method
mat = zeros(3, 4)
   
print(mat)

chevron_right


Output :

Matrix([
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]])



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy
from sympy import *
  
# Use sympy.zero() method
mat = zeros(2, 4)
   
print(mat)

chevron_right


Output :

Matrix([[0, 0, 0, 0],
[0, 0, 0, 0]])

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :