'The Cartan matrix for C_n
The Cartan matrix matrix for a Lie algebra is
generated by assigning an ordering to the simple
roots, (alpha[1], ...., alpha[l]).  Then the ijth
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
Examples
>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType(\'C4\')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -1],
[ 0,  0, -2,  2]])'

def cartan_matrix(self):

    n = self.n
    m = (2 * eye(n))
    i = 1
    while (i < (n - 1)):
        m[(i, (i + 1))] = (-1)
        m[(i, (i - 1))] = (-1)
        i += 1
    m[(0, 1)] = (-1)
    m[((n - 1), (n - 2))] = (-2)
    return m
