Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

""" 

Homogeneous symmetric functions 

 

By this we mean the basis formed of the complete homogeneous 

symmetric functions `h_\lambda`, not an arbitrary graded basis. 

""" 

from __future__ import absolute_import 

#***************************************************************************** 

# Copyright (C) 2007 Mike Hansen <mhansen@gmail.com> 

# 2012 Mike Zabrocki <mike.zabrocki@gmail.com> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# 

# This code is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

# General Public License for more details. 

# 

# The full text of the GPL is available at: 

# 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

#################################### 

# # 

# Homogeneous Symmetric Functions # 

# # 

#################################### 

from . import multiplicative, classical 

from sage.combinat.partition import Partition 

 

class SymmetricFunctionAlgebra_homogeneous(multiplicative.SymmetricFunctionAlgebra_multiplicative): 

def __init__(self, Sym): 

""" 

A class of methods specific to the homogeneous basis of 

symmetric functions. 

 

INPUT: 

 

- ``self`` -- a homogeneous basis of symmetric functions 

- ``Sym`` -- an instance of the ring of symmetric functions 

 

TESTS:: 

 

sage: h = SymmetricFunctions(QQ).e() 

sage: h == loads(dumps(h)) 

True 

sage: TestSuite(h).run(skip=['_test_associativity', '_test_distributivity', '_test_prod']) 

sage: TestSuite(h).run(elements = [h[1,1]+h[2], h[1]+2*h[1,1]]) 

""" 

classical.SymmetricFunctionAlgebra_classical.__init__(self, Sym, "homogeneous", 'h') 

 

def _dual_basis_default(self): 

r""" 

Returns the dual basis to ``self``. 

 

INPUT: 

 

- ``self`` -- a homogeneous basis of symmetric functions 

- ``scalar`` -- optional input which specifies a function ``zee`` 

on partitions. The function ``zee`` determines the scalar 

product on the power sum basis with normalization 

`\langle p_\mu, p_\mu \rangle = \mathrm{zee}(mu)`. 

(default: uses standard ``zee`` function) 

- ``scalar_name`` -- specifies the name of the scalar function 

(optional) 

- ``prefix`` -- optional input, specifies the prefix to be 

used to display the basis. 

 

OUTPUT: 

 

The dual basis of the homogeneous basis with respect to the 

standard scalar product (the monomial basis). If a function 

``zee`` is specified, the dual basis is with respect to the 

modified scalar product. 

 

EXAMPLES:: 

 

sage: m = SymmetricFunctions(QQ).m() 

sage: h = SymmetricFunctions(QQ).h() 

sage: h.dual_basis() == m 

True 

 

sage: zee = lambda x : 2 

sage: hh = h.dual_basis(zee); hh 

Dual basis to Symmetric Functions over Rational Field in the homogeneous basis 

sage: hh[2,1].scalar(h[2,1]) 

1 

sage: hh[2,2].scalar(h[2,2]) 

4 

 

TESTS:: 

 

sage: h._dual_basis_default() is h.dual_basis() 

True 

""" 

return self.realization_of().m() 

 

def coproduct_on_generators(self, i): 

r""" 

Returns the coproduct on `h_i`. 

 

INPUT: 

 

- ``self`` -- a homogeneous basis of symmetric functions 

- ``i`` -- a nonnegative integer 

 

OUTPUT: 

 

- the sum `\sum_{r=0}^i h_r \otimes h_{i-r}` 

 

EXAMPLES:: 

 

sage: Sym = SymmetricFunctions(QQ) 

sage: h = Sym.homogeneous() 

sage: h.coproduct_on_generators(2) 

h[] # h[2] + h[1] # h[1] + h[2] # h[] 

sage: h.coproduct_on_generators(0) 

h[] # h[] 

""" 

def P(i): return Partition([i]) if i else Partition([]) 

T = self.tensor_square() 

return T.sum_of_monomials( (P(j), P(i-j)) for j in range(i+1) ) 

 

 

class Element(classical.SymmetricFunctionAlgebra_classical.Element): 

def omega(self): 

r""" 

Return the image of ``self`` under the omega automorphism. 

 

The *omega automorphism* is defined to be the unique algebra 

endomorphism `\omega` of the ring of symmetric functions that 

satisfies `\omega(e_k) = h_k` for all positive integers `k` 

(where `e_k` stands for the `k`-th elementary symmetric 

function, and `h_k` stands for the `k`-th complete homogeneous 

symmetric function). It furthermore is a Hopf algebra 

endomorphism and an involution, and it is also known as the 

*omega involution*. It sends the power-sum symmetric function 

`p_k` to `(-1)^{k-1} p_k` for every positive integer `k`. 

 

The images of some bases under the omega automorphism are given by 

 

.. MATH:: 

 

\omega(e_{\lambda}) = h_{\lambda}, \qquad 

\omega(h_{\lambda}) = e_{\lambda}, \qquad 

\omega(p_{\lambda}) = (-1)^{|\lambda| - \ell(\lambda)} 

p_{\lambda}, \qquad 

\omega(s_{\lambda}) = s_{\lambda^{\prime}}, 

 

where `\lambda` is any partition, where `\ell(\lambda)` denotes 

the length (:meth:`~sage.combinat.partition.Partition.length`) 

of the partition `\lambda`, where `\lambda^{\prime}` denotes the 

conjugate partition 

(:meth:`~sage.combinat.partition.Partition.conjugate`) of 

`\lambda`, and where the usual notations for bases are used 

(`e` = elementary, `h` = complete homogeneous, `p` = powersum, 

`s` = Schur). 

 

:meth:`omega_involution()` is a synonym for the :meth:`omega()` 

method. 

 

OUTPUT: 

 

- the image of ``self`` under the omega automorphism 

 

EXAMPLES:: 

 

sage: h = SymmetricFunctions(QQ).h() 

sage: a = h([2,1]); a 

h[2, 1] 

sage: a.omega() 

h[1, 1, 1] - h[2, 1] 

sage: e = SymmetricFunctions(QQ).e() 

sage: e(h([2,1]).omega()) 

e[2, 1] 

""" 

e = self.parent().realization_of().e() 

return self.parent()(e._from_element(self)) 

 

omega_involution = omega 

 

def expand(self, n, alphabet='x'): 

""" 

Expand the symmetric function ``self`` as a symmetric polynomial 

in ``n`` variables. 

 

INPUT: 

 

- ``n`` -- a nonnegative integer 

 

- ``alphabet`` -- (default: ``'x'``) a variable for the expansion 

 

OUTPUT: 

 

A monomial expansion of ``self`` in the `n` variables 

labelled by ``alphabet``. 

 

EXAMPLES:: 

 

sage: h = SymmetricFunctions(QQ).h() 

sage: h([3]).expand(2) 

x0^3 + x0^2*x1 + x0*x1^2 + x1^3 

sage: h([1,1,1]).expand(2) 

x0^3 + 3*x0^2*x1 + 3*x0*x1^2 + x1^3 

sage: h([2,1]).expand(3) 

x0^3 + 2*x0^2*x1 + 2*x0*x1^2 + x1^3 + 2*x0^2*x2 + 3*x0*x1*x2 + 2*x1^2*x2 + 2*x0*x2^2 + 2*x1*x2^2 + x2^3 

sage: h([3]).expand(2,alphabet='y') 

y0^3 + y0^2*y1 + y0*y1^2 + y1^3 

sage: h([3]).expand(2,alphabet='x,y') 

x^3 + x^2*y + x*y^2 + y^3 

sage: h([3]).expand(3,alphabet='x,y,z') 

x^3 + x^2*y + x*y^2 + y^3 + x^2*z + x*y*z + y^2*z + x*z^2 + y*z^2 + z^3 

sage: (h([]) + 2*h([1])).expand(3) 

2*x0 + 2*x1 + 2*x2 + 1 

sage: h([1]).expand(0) 

0 

sage: (3*h([])).expand(0) 

3 

""" 

if n == 0: # Symmetrica crashes otherwise... 

return self.counit() 

condition = lambda part: False 

return self._expand(condition, n, alphabet) 

 

# Backward compatibility for unpickling 

from sage.structure.sage_object import register_unpickle_override 

register_unpickle_override('sage.combinat.sf.homogeneous', 'SymmetricFunctionAlgebraElement_homogeneous', SymmetricFunctionAlgebra_homogeneous.Element)