Python | sympy.diag() method
With the help of
sympy.diag() method, we can create a matrix having dimension nxn and filled with numbers in the diagonal by using
Return : Return a new matrix.
Example #1 :
In this example, we can see that by using
sympy.diag() method, we are able to create a matrix having dimension nxn all filled with numbers in a diagonal as passed in a parameter.
Example #2 :
[3, 0, 0, 0],
[0, 4, 0, 0],
[0, 0, 5, 0],
[0, 0, 0, 8]])
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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course