(self)
return m
Returns the Cartan matrix for D_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]>).

        Example
        =======
        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType('D4')
        >>> c.cartan_matrix()
            Matrix([
            [ 2, -1,  0,  0],
            [-1,  2, -1, -1],
            [ 0, -1,  2,  0],
            [ 0, -1,  0,  2]])
Returns the Cartan matrix for D_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]>).
Returns the Cartan matrix for D_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 ] > ) .
def cartan_matrix(self):
        """
        Returns the Cartan matrix for D_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]>).

        Example
        =======
        >>> from sympy.liealgebras.cartan_type import CartanType
        >>> c = CartanType('D4')
        >>> c.cartan_matrix()
            Matrix([
            [ 2, -1,  0,  0],
            [-1,  2, -1, -1],
            [ 0, -1,  2,  0],
            [ 0, -1,  0,  2]])

        """

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