With the help of Matrix().row_insert() method, we can insert a row in a matrix having dimension nxm, where dimension of inserted row is 1xm.
Syntax :
Matrix().row_insert()
Return : Return a new matrix.
Example #1 :
In this example, we are able to insert a row in a matrix by using Matrix().row_insert() method.
# Import all the methods from sympy from sympy import *Â Â # Make a matrix gfg_mat = Matrix([[1, 2], [2, 1]]) Â Â # use the row_insert() method for matrix new_mat = gfg_mat.row_insert(1, Matrix([[3, 4]])) Â Â Â print(new_mat) |
Output :
Matrix([[1, 2], [3, 4], [2, 1]])
Example #2 :
# Import all the methods from sympy from sympy import *Â Â # Make a matrix gfg_mat = Matrix([[1, 2], [2, 1]]) Â Â # use the row_insert() method for matrix new_mat = gfg_mat.row_insert(2, Matrix([[13, 24]])) Â Â Â print(new_mat) |
Output :
Matrix([[1, 2], [2, 1], [13, 24]])

… [Trackback]
[…] Here you will find 56970 more Information to that Topic: geeksforgeeks.org/python-sympy-matrix-row-insert/ […]
… [Trackback]
[…] Read More Information here on that Topic: geeksforgeeks.org/python-sympy-matrix-row-insert/ […]
… [Trackback]
[…] Read More on that Topic: geeksforgeeks.org/python-sympy-matrix-row-insert/ […]