Python | sympy.eye() method
With the help of sympy.eye() method, we can find the identity matrix by using sympy.eye() method.
Syntax :
sympy.eye()
Return : Return an identity matrix.
Example #1 :
In this example, we can see that by using sympy.eye() method, we are able to find identity matrix having dimension nxn, where n will be pass as a parameter.
# import sympy from sympy import * # Use sympy.eye() method mat = eye(3) print(mat) |
Output :
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
Example #2 :
# import sympy from sympy import * # Use sympy.eye() method mat = eye(5) print(mat) |
Output :
Matrix([
[1, 0, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]])
Recommended Posts:
- class method vs static method in Python
- Python | os.dup() method
- Python | next() method
- Python | set() method
- Python | os.ctermid() method
- Python | os.strerror() method
- Python | os.getppid() method
- Python | os.sched_rr_get_interval() method
- Python | os.uname() method
- Python | os.getpid() method
- Python | os.getlogin() method
- Python | os.getenv() method
- Python PIL | ImagePalette() Method
- Python | os.listdir() method
- Python | os.system() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



