In [2]:
from sympy import *
from IPython.display import display
init_printing(use_latex='mathjax')
In [3]:
A=Matrix([[1,3,5,0,0,3],[0,0,2,1,2,1],[2,6,12,1,2,7]])
display(A)
$$\left[\begin{matrix}1 & 3 & 5 & 0 & 0 & 3\\0 & 0 & 2 & 1 & 2 & 1\\2 & 6 & 12 & 1 & 2 & 7\end{matrix}\right]$$
In [4]:
A.rref()
Out[4]:
$$\left ( \left[\begin{matrix}1 & 3 & 0 & - \frac{5}{2} & -5 & \frac{1}{2}\\0 & 0 & 1 & \frac{1}{2} & 1 & \frac{1}{2}\\0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right], \quad \left [ 0, \quad 2\right ]\right )$$
In [5]:
B=Matrix([[1,3,5,0,0,3,0],[0,0,2,1,2,1,0],[2,6,12,1,2,7,0]])
display(B)
display(B.rref())
$$\left[\begin{matrix}1 & 3 & 5 & 0 & 0 & 3 & 0\\0 & 0 & 2 & 1 & 2 & 1 & 0\\2 & 6 & 12 & 1 & 2 & 7 & 0\end{matrix}\right]$$
$$\left ( \left[\begin{matrix}1 & 3 & 0 & - \frac{5}{2} & -5 & \frac{1}{2} & 0\\0 & 0 & 1 & \frac{1}{2} & 1 & \frac{1}{2} & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right], \quad \left [ 0, \quad 2\right ]\right )$$
In []: