<s> from . cartan_type import Standard_Cartan <EOL> from sympy . matrices import eye <EOL> from sympy . core . compatibility import range <EOL> class TypeD ( Standard_Cartan ) : <EOL> def __new__ ( cls , n ) : <EOL> if n < <NUM_LIT:3> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return Standard_Cartan . __new__ ( cls , "<STR_LIT:D>" , n ) <EOL> def dimension ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . n <EOL> def basic_root ( self , i , j ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> root = [ <NUM_LIT:0> ] * n <EOL> root [ i ] = <NUM_LIT:1> <EOL> root [ j ] = - <NUM_LIT:1> <EOL> return root <EOL> def simple_root ( self , i ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> if i < n : <EOL> return self . basic_root ( i - <NUM_LIT:1> , i ) <EOL> else : <EOL> root = [ <NUM_LIT:0> ] * n <EOL> root [ n - <NUM_LIT:2> ] = <NUM_LIT:1> <EOL> root [ n - <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> return root <EOL> def positive_roots ( self ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> posroots = { } <EOL> k = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT:0> , n - <NUM_LIT:1> ) : <EOL> for j in range ( i + <NUM_LIT:1> , n ) : <EOL> k += <NUM_LIT:1> <EOL> posroots [ k ] = self . basic_root ( i , j ) <EOL> k += <NUM_LIT:1> <EOL> root = self . basic_root ( i , j ) <EOL> root [ j ] = <NUM_LIT:1> <EOL> posroots [ k ] = root <EOL> return posroots <EOL> def roots ( self ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> return <NUM_LIT:2> * n * ( n - <NUM_LIT:1> ) <EOL> def cartan_matrix ( self ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> m = <NUM_LIT:2> * eye ( n ) <EOL> i = <NUM_LIT:1> <EOL> while i < n - <NUM_LIT:2> : <EOL> m [ i , i + <NUM_LIT:1> ] = - <NUM_LIT:1> <EOL> m [ i , i - <NUM_LIT:1> ] = - <NUM_LIT:1> <EOL> i += <NUM_LIT:1> <EOL> m [ n - <NUM_LIT:2> , n - <NUM_LIT:3> ] = - <NUM_LIT:1> <EOL> m [ n - <NUM_LIT:3> , n - <NUM_LIT:1> ] = - <NUM_LIT:1> <EOL> m [ n - <NUM_LIT:1> , n - <NUM_LIT:3> ] = - <NUM_LIT:1> <EOL> m [ <NUM_LIT:0> , <NUM_LIT:1> ] = - <NUM_LIT:1> <EOL> return m <EOL> def basis ( self ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> return n * ( n - <NUM_LIT:1> ) / <NUM_LIT:2> <EOL> def lie_algebra ( self ) : <EOL> """<STR_LIT>""" <EOL> n = self . n <EOL> return "<STR_LIT>" + str ( <NUM_LIT:2> * n ) + "<STR_LIT:)>" <EOL> def dynkin_diagram ( self ) : <EOL> n = self . n <EOL> diag = "<STR_LIT:U+0020>" * <NUM_LIT:4> * ( n - <NUM_LIT:3> ) + str ( n - <NUM_LIT:1> ) + "<STR_LIT:\n>" <EOL> diag += "<STR_LIT:U+0020>" * <NUM_LIT:4> * ( n - <NUM_LIT:3> ) + "<STR_LIT>" <EOL> diag += "<STR_LIT:U+0020>" * <NUM_LIT:4> * ( n - <NUM_LIT:3> ) + "<STR_LIT>" <EOL> diag += "<STR_LIT:U+0020>" * <NUM_LIT:4> * ( n - <NUM_LIT:3> ) + "<STR_LIT>" <EOL> diag += "<STR_LIT>" . join ( "<STR_LIT:0>" for i in range ( <NUM_LIT:1> , n ) ) + "<STR_LIT:\n>" <EOL> diag += "<STR_LIT:U+0020>" . join ( str ( i ) for i in range ( <NUM_LIT:1> , n - <NUM_LIT:1> ) ) + "<STR_LIT:U+0020>" + str ( n ) <EOL> return diag </s>
