@@ -674,6 +674,32 @@ def parametric(self, coords):
674674 def basis_vectors (self ):
675675 return tuple (self .basis )
676676
677+ def _build_basis_base_symbol (self , base_index ):
678+ """ Build a symbol used for the `base_rep` from the given tuple """
679+ symbol_str = '*' .join ([str (self .basis [i ]) for i in base_index ])
680+ return Symbol (symbol_str , commutative = False )
681+
682+ def _build_basis_blade_symbol (self , base_index ):
683+ """ Build a symbol used for the `blade_rep` from the given tuple """
684+ if self .wedge_print :
685+ symbol_str = '^' .join ([str (self .basis [i ]) for i in base_index ])
686+ else :
687+ sub_str = []
688+ root_str = []
689+ for i in base_index :
690+ basis_vec_str = str (self .basis [i ])
691+ split_lst = basis_vec_str .split ('_' )
692+ if len (split_lst ) != 2 :
693+ raise ValueError ('!!!!Incompatible basis vector ' + basis_vec_str + ' for wedge_print = False!!!!' )
694+ else :
695+ sub_str .append (split_lst [1 ])
696+ root_str .append (split_lst [0 ])
697+ if all_same (root_str ):
698+ symbol_str = root_str [0 ] + '_' + '' .join (sub_str )
699+ else :
700+ raise ValueError ('!!!!No unique root symbol for wedge_print = False!!!!' )
701+ return Symbol (symbol_str , commutative = False )
702+
677703 def _build_bases (self ):
678704 r"""
679705 The bases for the multivector (geometric) algebra are formed from
@@ -728,24 +754,7 @@ def _build_bases(self):
728754 blades = []
729755 super_scripts = []
730756 for base_index in grade_index :
731- if self .wedge_print :
732- symbol_str = ('' .join ([str (self .basis [i ]) + '^' for i in base_index ]))[:- 1 ]
733- else :
734- sub_str = []
735- root_str = []
736- for i in base_index :
737- basis_vec_str = str (self .basis [i ])
738- split_lst = basis_vec_str .split ('_' )
739- if len (split_lst ) != 2 :
740- raise ValueError ('!!!!Incompatible basis vector ' + basis_vec_str + ' for wedge_print = False!!!!' )
741- else :
742- sub_str .append (split_lst [1 ])
743- root_str .append (split_lst [0 ])
744- if all_same (root_str ):
745- symbol_str = root_str [0 ] + '_' + '' .join (sub_str )
746- else :
747- raise ValueError ('!!!!No unique root symbol for wedge_print = False!!!!' )
748- blade_symbol = Symbol (symbol_str , commutative = False )
757+ blade_symbol = self ._build_basis_blade_symbol (base_index )
749758 blades .append (blade_symbol )
750759 self .blades_lst .append (blade_symbol )
751760 self .blades .append (blades )
@@ -774,8 +783,7 @@ def _build_bases(self):
774783 for grade_index in self .indexes :
775784 bases = []
776785 for base_index in grade_index :
777- symbol_str = ('' .join ([str (self .basis [i ]) + '*' for i in base_index ]))[:- 1 ]
778- base_symbol = Symbol (symbol_str , commutative = False )
786+ base_symbol = self ._build_basis_base_symbol (base_index )
779787 bases .append (base_symbol )
780788 self .bases_lst .append (base_symbol )
781789 self .bases .append (bases )
0 commit comments