Algorithm to compute the rank and a Cartan subalgebra of a matrix Lie   algebra with Mathematica
  We present in this paper a set of routines constructed to compute the rank of a matrix Lie algebra and also to determine a Cartan subalgebra from a given list of elements 
Pablo Alberca Bjerregaard and Candido Martin Gonzalez