On Thu, Dec 8, 2011 at 10:56 AM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote:
> On 2011-12-04 14:34, Nicolas M. Thiery wrote:
>> On Sun, Dec 04, 2011 at 03:56:39AM -0800, Dima Pasechnik wrote:
>>>    unless I missed something,
>>>    your 
>>> http://combinat.sagemath.org/doc/thematic_tutorials/demo-symmetric-functions.html
>>>    lacks any information as to how to take any symmetric polynomial, and
>>>    expand it  in some basis of symmetric functions.
>>
>> Indeed: this tutorial is very incomplete. Someone should stand up and
>> take the time to gather all the bits of docs from here and there, and
>> merge a nice and clean tutorial on Symmetric functions into Sage.
>>
>>>    Is it even possible with the combinat functionality?
>>
>> It definitely is. Here is a story without subtitles (please ask for
>> those if needed:
>>
>>     sage: S = SymmetricFunctions(QQ)
>>     sage: m = S.m()
>>     sage: e = S.e()
>>     sage: f = e[3,2,1]
>>     sage: f_as_poly = f.expand(3); f_as_poly
>>     x0^3*x1^2*x2 + x0^2*x1^3*x2 + x0^3*x1*x2^2 + 3*x0^2*x1^2*x2^2 + 
>> x0*x1^3*x2^2 + x0^2*x1*x2^3 + x0*x1^2*x2^3
>>     sage: f_as_poly.parent()
>>     Multivariate Polynomial Ring in x0, x1, x2 over Rational Field
>>
>>     sage: f_in_m = m.from_polynomial(f_as_poly); f_in_m
>>     3*m[2, 2, 2] + m[3, 2, 1]
>>
>>     sage: f_in_e = e(f_in_m)
>>     sage: f_in_e
>>     e[3, 2, 1] - 3*e[4, 1, 1] - 2*e[4, 2] + 13*e[5, 1] - 18*e[6]
>>
>> Oops, but we don't get the original symmetric function f! Actually
>> this is perfectly correct since we lost information by only expanding
>> in 3 variables:
>>
>>     sage: f_in_e.expand(3) == f.expand(3)
>>
>> If one kills all terms with parts larger than 3 (since
>> e_4=e_5=e_6=...=0 in three variables).
> So I think this illustrates exactly Dima's sentiment that Sage doesn't
> have functionality to write a given symmetric polynomial in terms of
> elementary symmetric polynomials.  Maybe it's technically possible, but
> surely not easy!

> Also, it's not clear to me even what e[3,2,1] means.  How do Sage's
> elementary symmetric functions relate to
> http://en.wikipedia.org/wiki/Elementary_symmetric_polynomial#Examples

You can get the symmetric polynomials on that page by expanding Sage's
elementary symmetric functions out in a finite number of variables.

sage: e = SymmetricFunctions(QQ).e()
sage: e[1].expand(4)
x0 + x1 + x2 + x3
sage: e[2].expand(4)
x0*x1 + x0*x2 + x1*x2 + x0*x3 + x1*x3 + x2*x3
sage: e[3].expand(4)
x0*x1*x2 + x0*x1*x3 + x0*x2*x3 + x1*x2*x3
sage: e[4].expand(4)
x0*x1*x2*x3

e[3,2,1] represents the product e[3]*e[2]*[1]:

sage: e[3]*e[2]*e[1]
e[3, 2, 1]

To get a symmetric function from a polynomial, you use the
"from_polynomial" method as Nicolas mentioned.  The only awkward part
is that this method only exists for the the monomial basis.  (It would
be easy to add a method to the other bases which converted the
polynomial to the monomial basis and then to itself, but that doesn't
exist yet.)

sage: m = SymmetricFunctions(QQ).m()
sage: f = e[2].expand(4); f
x0*x1 + x0*x2 + x1*x2 + x0*x3 + x1*x3 + x2*x3
sage: f_in_e = e(m.from_polynomial(f)); f_in_e
e[2]
sage: f_in_e.expand(4)
x0*x1 + x0*x2 + x1*x2 + x0*x3 + x1*x3 + x2*x3

--Mike

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to