(self, weylelt)
This method takes input from the user in the form of products of the
        generating reflections, and returns the matrix corresponding to the
        element of the Weyl group.  Since each element of the Weyl group is
        a reflection of some type, there is a corresponding matrix representation.
        This method uses the standard representation for all the generating
        reflections.

        Example
        =======
        >>> from sympy.liealgebras.weyl_group import WeylGroup
        >>> f = WeylGroup("F4")
        >>> f.matrix_form('r2*r3')
        Matrix([
        [1, 0, 0,  0],
        [0, 1, 0,  0],
        [0, 0, 0, -1],
        [0, 0, 1,  0]])
This method takes input from the user in the form of products of the
        generating reflections, and returns the matrix corresponding to the
        element of the Weyl group.  Since each element of the Weyl group is
        a reflection of some type, there is a corresponding matrix representation.
        This method uses the standard representation for all the generating
        reflections.
This method takes input from the user in the form of products of the generating reflections and returns the matrix corresponding to the element of the Weyl group . Since each element of the Weyl group is a reflection of some type there is a corresponding matrix representation . This method uses the standard representation for all the generating reflections .
def matrix_form(self, weylelt):
        """
        This method takes input from the user in the form of products of the
        generating reflections, and returns the matrix corresponding to the
        element of the Weyl group.  Since each element of the Weyl group is
        a reflection of some type, there is a corresponding matrix representation.
        This method uses the standard representation for all the generating
        reflections.

        Example
        =======
        >>> from sympy.liealgebras.weyl_group import WeylGroup
        >>> f = WeylGroup("F4")
        >>> f.matrix_form('r2*r3')
        Matrix([
        [1, 0, 0,  0],
        [0, 1, 0,  0],
        [0, 0, 0, -1],
        [0, 0, 1,  0]])

        """
        elts = list(weylelt)
        reflections = elts[1::3]
        n = self.cartan_type.rank()
        if self.cartan_type.series == 'A':
            matrixform = eye(n+1)
            for elt in reflections:
                a = int(elt)
                mat = eye(n+1)
                mat[a-1, a-1] = 0
                mat[a-1, a] = 1
                mat[a, a-1] = 1
                mat[a, a] = 0
                matrixform *= mat
            return matrixform

        if self.cartan_type.series == 'D':
            matrixform = eye(n)
            for elt in reflections:
                a = int(elt)
                mat = eye(n)
                if a < n:
                    mat[a-1, a-1] = 0
                    mat[a-1, a] = 1
                    mat[a, a-1] = 1
                    mat[a, a] = 0
                    matrixform *= mat
                else:
                    mat[n-2, n-1] = -1
                    mat[n-2, n-2] = 0
                    mat[n-1, n-2] = -1
                    mat[n-1, n-1] = 0
                    matrixform *= mat
            return matrixform

        if self.cartan_type.series == 'G':
            matrixform = eye(3)
            for elt in reflections:
                a = int(elt)
                if a == 1:
                    gen1 = Matrix([[1, 0, 0], [0, 0, 1], [0, 1, 0]])
                    matrixform *= gen1
                else:
                    gen2 = Matrix([[Rational(2, 3), Rational(2, 3), -Rational(1, 3)],
                        [Rational(2, 3), Rational(-1, 3), Rational(2, 3)], [Rational(-1, 3),
                            Rational(2, 3), Rational(2, 3)]])
                    matrixform *= gen2
            return matrixform

        if self.cartan_type.series == 'F':
            matrixform = eye(4)
            for elt in reflections:
                a = int(elt)
                if a == 1:
                    mat = Matrix([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])
                    matrixform *= mat
                elif a == 2:
                    mat = Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])
                    matrixform *= mat
                elif a == 3:
                    mat = Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]])
                    matrixform *= mat
                else:

                    mat = Matrix([[Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2)],
                        [Rational(1, 2), Rational(1, 2), Rational(-1, 2), Rational(-1, 2)],
                        [Rational(1, 2), Rational(-1, 2), Rational(1, 2), Rational(-1, 2)],
                        [Rational(1, 2), Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]])
                    matrixform *= mat
            return matrixform

        if self.cartan_type.series == 'E':
            matrixform = eye(8)
            for elt in reflections:
                a = int(elt)
                if a == 1:
                    mat = Matrix([[Rational(3, 4), Rational(1, 4), Rational(1, 4), Rational(1, 4),
                        Rational(1, 4), Rational(1, 4), Rational(1, 4), Rational(-1, 4)],
                        [Rational(1, 4), Rational(3, 4), Rational(-1, 4), Rational(-1, 4),
                            Rational(-1, 4), Rational(-1, 4), Rational(1, 4), Rational(-1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(3, 4), Rational(-1, 4),
                        Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(3, 4),
                        Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
                        Rational(3, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
                        Rational(-1, 4), Rational(3, 4), Rational(-1, 4), Rational(1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
                        Rational(-1, 4), Rational(-1, 4), Rational(-3, 4), Rational(1, 4)],
                        [Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
                        Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(3, 4)]])
                    matrixform *= mat
                elif a == 2:
                    mat = eye(8)
                    mat[0, 0] = 0
                    mat[0, 1] = -1
                    mat[1, 0] = -1
                    mat[1, 1] = 0
                    matrixform *= mat
                else:
                    mat = eye(8)
                    mat[a-3, a-3] = 0
                    mat[a-3, a-2] = 1
                    mat[a-2, a-3] = 1
                    mat[a-2, a-2] = 0
                    matrixform *= mat
            return matrixform


        if self.cartan_type.series == 'B' or self.cartan_type.series == 'C':
            matrixform = eye(n)
            for elt in reflections:
                a = int(elt)
                mat = eye(n)
                if a == 1:
                    mat[0, 0] = -1
                    matrixform *= mat
                else:
                    mat[a - 2, a - 2] = 0
                    mat[a-2, a-1] = 1
                    mat[a - 1, a - 2] = 1
                    mat[a -1, a - 1] = 0
                    matrixform *= mat
            return matrixform
def matrix_form ( self , weylelt ) : elts = list ( weylelt ) reflections = elts [ 1 : : 3 ] n = self . cartan_type . rank ( ) if self . cartan_type . series == 'A' : matrixform = eye ( n + 1 ) for elt in reflections : a = int ( elt ) mat = eye ( n + 1 ) mat [ a - 1 , a - 1 ] = 0 mat [ a - 1 , a ] = 1 mat [ a , a - 1 ] = 1 mat [ a , a ] = 0 matrixform *= mat return matrixform if self . cartan_type . series == 'D' : matrixform = eye ( n ) for elt in reflections : a = int ( elt ) mat = eye ( n ) if a < n : mat [ a - 1 , a - 1 ] = 0 mat [ a - 1 , a ] = 1 mat [ a , a - 1 ] = 1 mat [ a , a ] = 0 matrixform *= mat else : mat [ n - 2 , n - 1 ] = - 1 mat [ n - 2 , n - 2 ] = 0 mat [ n - 1 , n - 2 ] = - 1 mat [ n - 1 , n - 1 ] = 0 matrixform *= mat return matrixform if self . cartan_type . series == 'G' : matrixform = eye ( 3 ) for elt in reflections : a = int ( elt ) if a == 1 : gen1 = Matrix ( [ [ 1 , 0 , 0 ] , [ 0 , 0 , 1 ] , [ 0 , 1 , 0 ] ] ) matrixform *= gen1 else : gen2 = Matrix ( [ [ Rational ( 2 , 3 ) , Rational ( 2 , 3 ) , - Rational ( 1 , 3 ) ] , [ Rational ( 2 , 3 ) , Rational ( - 1 , 3 ) , Rational ( 2 , 3 ) ] , [ Rational ( - 1 , 3 ) , Rational ( 2 , 3 ) , Rational ( 2 , 3 ) ] ] ) matrixform *= gen2 return matrixform if self . cartan_type . series == 'F' : matrixform = eye ( 4 ) for elt in reflections : a = int ( elt ) if a == 1 : mat = Matrix ( [ [ 1 , 0 , 0 , 0 ] , [ 0 , 0 , 1 , 0 ] , [ 0 , 1 , 0 , 0 ] , [ 0 , 0 , 0 , 1 ] ] ) matrixform *= mat elif a == 2 : mat = Matrix ( [ [ 1 , 0 , 0 , 0 ] , [ 0 , 1 , 0 , 0 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 1 , 0 ] ] ) matrixform *= mat elif a == 3 : mat = Matrix ( [ [ 1 , 0 , 0 , 0 ] , [ 0 , 1 , 0 , 0 ] , [ 0 , 0 , 1 , 0 ] , [ 0 , 0 , 0 , - 1 ] ] ) matrixform *= mat else : mat = Matrix ( [ [ Rational ( 1 , 2 ) , Rational ( 1 , 2 ) , Rational ( 1 , 2 ) , Rational ( 1 , 2 ) ] , [ Rational ( 1 , 2 ) , Rational ( 1 , 2 ) , Rational ( - 1 , 2 ) , Rational ( - 1 , 2 ) ] , [ Rational ( 1 , 2 ) , Rational ( - 1 , 2 ) , Rational ( 1 , 2 ) , Rational ( - 1 , 2 ) ] , [ Rational ( 1 , 2 ) , Rational ( - 1 , 2 ) , Rational ( - 1 , 2 ) , Rational ( 1 , 2 ) ] ] ) matrixform *= mat return matrixform if self . cartan_type . series == 'E' : matrixform = eye ( 8 ) for elt in reflections : a = int ( elt ) if a == 1 : mat = Matrix ( [ [ Rational ( 3 , 4 ) , Rational ( 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( 3 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 3 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 3 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 3 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 3 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 3 , 4 ) , Rational ( 1 , 4 ) ] , [ Rational ( 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( - 1 , 4 ) , Rational ( 3 , 4 ) ] ] ) matrixform *= mat elif a == 2 : mat = eye ( 8 ) mat [ 0 , 0 ] = 0 mat [ 0 , 1 ] = - 1 mat [ 1 , 0 ] = - 1 mat [ 1 , 1 ] = 0 matrixform *= mat else : mat = eye ( 8 ) mat [ a - 3 , a - 3 ] = 0 mat [ a - 3 , a - 2 ] = 1 mat [ a - 2 , a - 3 ] = 1 mat [ a - 2 , a - 2 ] = 0 matrixform *= mat return matrixform if self . cartan_type . series == 'B' or self . cartan_type . series == 'C' : matrixform = eye ( n ) for elt in reflections : a = int ( elt ) mat = eye ( n ) if a == 1 : mat [ 0 , 0 ] = - 1 matrixform *= mat else : mat [ a - 2 , a - 2 ] = 0 mat [ a - 2 , a - 1 ] = 1 mat [ a - 1 , a - 2 ] = 1 mat [ a - 1 , a - 1 ] = 0 matrixform *= mat return matrixform