# elementary symmetric functions

Hi, this is a continuation (though self-contained) on a previous question I luckily received an answer for;

For those of you experts that know Maxima, I essentially want to do the following (to a polynomial);

elem([2,f1,f2],elem([2,e1,e2],x+y+a+b,[x,y]),[a,b])


which results in: (x+y)+(a+b) = e1 + f1, where Sage would (which is what I'm trying to do) return e[1] + f[1].

This is what I tried (among others), mostly from the above referenced link;

P.<x,y>=PolynomialRing(QQ['a','b'])
[a,b]=P.base_ring().gens()
S=SymmetricFunctions(P.base_ring())
exy=S.elementary()
f=x+y+a+b
exy._prefix='exy'
o=exy(S.from_polynomial(f))
P2.<a,b>=PolynomialRing(QQ['x','y'])
[x,y]=P2.base_ring().gens()
S2.SymmetricFunctions(P2.base_ring())
eab=S2.elementary()
eab._prefix='eab'
oo=eab(S2.from_polynomial(o)); oo


I was hoping to see: eab[1]+exy[1], but here an error is thrown saying that the polynomial is not symmetric. I've tried also (trying) to establish a base ring QQ['x','y','a','b'] and then subrings but that also doesn't seem to work for me.

I think Sage is great and I'm sure there's something equivalent to the very simple task done in Maxima. For instance, this

maxima.eval('elem:2')
oo=maxima.eval('elem([2,f1,f2],elem([2,e1,e2],x+y+a+b,[x,y]),[a,b])')


does return the proper answer, e1+f1, but I cannot use this result because I need to process it further with Sage and have not found a way to translate this Maxima type of object to a Sage polynomial - especially since the parsing seems to bring up errors for larger equations and my real equations are extremely large.

Thanks all, again!

edit retag close merge delete

Sort by » oldest newest most voted

This is a bit more subtle. Here is a way.

sage: P.<x,y>=PolynomialRing(QQ['a','b'])
sage: BR = P.base_ring()
sage: S1 = SymmetricFunctions(QQ).e()
sage: S2 = SymmetricFunctions(BR).e()
sage: a,b = BR.gens()
sage: f = x+y+a+b
sage: step1 = S2.from_polynomial(f);step1
(a+b)*e[] + e[1]
sage: sum(S1(i).tensor(S1.from_polynomial(c)) for i, c in step1)
e[] # e[1] + e[1] # e[]


The key point to understand is that you need to explain sage in what your answer lives. Here it is the tensor product of symmetric functions with themselves.

EDIT: I have changed the answer above to use the elementary basis.

more

Hello, and thank you again!!

-use the elementary basis, exy=Sym.elementary(); exy._prefix='exy' and eab=Sym2.elementary(); eab._prefix='eab'?

-provide a way to distinguish between the two spaces in the tensor product? What I mean is, for my real equation c1+c2+...+(x*y)+(x+y)+(a+b)+... + (a*b*x*y) == c1 + c2 + ... + exy[2] + exy[1] + eab[1] + ... + exy[2]*eab[2] == c1 + c2 + ... + exy2 + exy1 + eab1 + ... exy2*eab2, with the result not indexed and c1, c2, etc are constants? By the way, your result (to me) is understood as 1 \otimes e1 + f1 \otimes 1, but I would need it as e1 + f1.

Thanks so much!

( 2015-05-25 13:23:02 -0500 )edit

Could you please also upvote my answers (just above the "accept" button). There is no way to have e_1 + f_1 as this has not meaning other than in the tensor product. By the way, the tensor product is a perfectly normal algebra, in which you can do many things.

( 2015-05-25 14:00:24 -0500 )edit

Hi, I need >15 pts to upvote - so it says... Thanks for all the help but I guess I'll have to rely on Maxima. The math aspect makes sense, and tensor algebra isn't an issue, but I fail in being able to work with Sage. It will be interesting to learn the differences between the Sage and Maxima! Maybe I'll figure out some alternative in Sage later. Thanks!

( 2015-05-25 14:08:50 -0500 )edit

What do you want to do with the result ? What is not working as you would like ?

( 2015-05-25 14:52:43 -0500 )edit

Well I have a huge rational expression of polynomials, p = N/D each term in variables r11,r12,r21,r22,z1,z2,Q and if I put it in terms of symmetric functions, such as r11+r21 = e1 = fn(Q,z1,b1),r12+r22 = f1 = fn(Q,z2,b2), then I can greatly simplify p. Further reduction occurs with these symmetry relations, r11*r21 = e2 = B1 and r12*r22 = f2 =B2. I then take the resulting p and exchange z's for A's with z1^2=A1 and z2^2=A2. This results in a polynomial in only A1,A2,B1,B2,Q` and is much simpler, as I've done this in Maxima. Further processing involves parameterization, etc. Hope that's clearly explained...

( 2015-05-25 16:04:46 -0500 )edit