@@ -61,6 +61,79 @@ def dual(self):
61
61
WithBasis = LazyImport ('sage.categories.hopf_algebras_with_basis' , 'HopfAlgebrasWithBasis' )
62
62
63
63
class ElementMethods :
64
+ def convolution_product (h ,a ,b ):
65
+ r"""
66
+ input: h - an element of a Hopf algebra H
67
+ a,b - linear maps from H to H
68
+ output: [a*b](h)
69
+ """
70
+ H = h .parent ()
71
+ out = 0
72
+ for (bimonom ,coef ) in h .coproduct ():
73
+ out += coef * a (H (bimonom [0 ]))* b (H (bimonom [1 ]))
74
+ return out
75
+
76
+ def convolution_power (h , L , n ):
77
+ r"""
78
+ input: h - an element of a Hopf algebra H
79
+ L - linear map from H to H
80
+ n - the convolution power to which to take 'L'
81
+ output: [L^*n](h)
82
+ """
83
+ from sage .categories .tensor import tensor
84
+ H = h .parent ()
85
+ def n_fold_coproduct (h , n ):
86
+ H = h .parent ()
87
+ if n == 0 :
88
+ return H (h .counit ())
89
+ elif n == 1 :
90
+ return h
91
+ elif n == 2 :
92
+ return h .coproduct ()
93
+ else :
94
+ # apply some kind of multilinear recursion
95
+ Hn = tensor ([H ]* n ) # or: tensor([H for i in range(n)])
96
+ terms = []
97
+ hh = n_fold_coproduct (h , n - 1 )
98
+ for (monom ,cof ) in hh :
99
+ h0 = H (monom [0 ]).coproduct ()
100
+ terms += [(tuple ((h00 , h01 ) + monom [1 :]), cof0 * cof ) for ((h00 , h01 ), cof0 ) in h0 ]
101
+ return Hn .sum_of_terms (terms )
102
+ hhh = n_fold_coproduct (h ,n )
103
+ out = H .zero ()
104
+ for term in hhh :
105
+ out += H .prod (L (H (t )) for t in term [0 ]) * term [1 ]
106
+ return out
107
+
108
+ def hopf_power (h ,n = 2 ):
109
+ r"""
110
+ Input:
111
+ h - an element of a Hopf algebra H
112
+ n - the convolution power of the identity morphism to use
113
+ Output:
114
+ the nth convolution power of the identity morphism, applied to h., i.e., [id^*n](h)
115
+
116
+ Remark: for historical reasons (see saga of Frobenius-Schur indicators), the second power deserves special attention.
117
+ we use '2' as the default value for 'n'
118
+ """
119
+ H = h .parent ()
120
+ def Id (x ):
121
+ return x
122
+ def S (x ):
123
+ return x .antipode ()
124
+
125
+ if n < 0 :
126
+ L = S
127
+ else :
128
+ L = Id
129
+
130
+ if n == 0 :
131
+ return H (h .counit ())
132
+ elif abs (n )== 1 :
133
+ return L (h )
134
+ else :
135
+ return h .convolution_power (L ,abs (n ))
136
+
64
137
def antipode (self ):
65
138
"""
66
139
Returns the antipode of self.
@@ -86,6 +159,7 @@ def antipode(self):
86
159
# This choice should be done consistently with coproduct, ...
87
160
# return operator.antipode(self)
88
161
162
+
89
163
class ParentMethods :
90
164
#def __setup__(self): # Check the conventions for _setup_ or __setup__
91
165
# if self.implements("antipode"):
0 commit comments