In [6]:
from sympy.abc import*
from sympy import *
from sympy import MatrixSymbol, Identity
init_printing(use_latex=True) #For good look equations

A = Matrix([[a,b,c],[d,e,f],[g,h,i]])
A


Out[6]:
$$\left[\begin{matrix}a & b & c\\d & e & f\\g & h & i\end{matrix}\right]$$

In [7]:
det(A)


Out[7]:
$$a e i - a f h - b d i + b f g + c d h - c e g$$

In [ ]:
f = Matrix([cos(th), sin(th), 0])
g = Matrix([0, 0, 1])
xvector = [x,y,th]

In [43]:
lie_bracket(f,g,xvector)


Out[43]:
$$\left[\begin{matrix}- \sin{\left (\theta \right )}\\\cos{\left (\theta \right )}\\0\end{matrix}\right]$$

In [44]:
span = bracket_span([f,g],xvector)
span


rank = 3
Out[44]:
$$\left [ \left[\begin{matrix}\cos{\left (\theta \right )}\\\sin{\left (\theta \right )}\\0\end{matrix}\right], \quad \left[\begin{matrix}0\\0\\1\end{matrix}\right], \quad \left[\begin{matrix}- \sin{\left (\theta \right )}\\\cos{\left (\theta \right )}\\0\end{matrix}\right]\right ]$$

In [48]:
span = list2matrix(span)
span


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-48-e6e465d597bb> in <module>()
----> 1 span = list2matrix(span)
      2 span

<ipython-input-41-ff45f2523816> in list2matrix(listm)
    167     mn = len(listm)
    168     for i in range(mn):
--> 169         span[i] = span[i].T
    170     matrix_span = Matrix(span).T
    171     return matrix_span

AttributeError: 'cos' object has no attribute 'T'