# S.from_polynomial(f) -- convert a polynomial to symmetric functions BUT with a parameter

I thought I'd ask a variation of an earlier question that was unanswered.

I use:

P.<x,y>=PolynomialRing(QQ)
S=SymmetricFunctions(QQ)
S.inject_shorthands()
f=x+y
e(S.from_polynomial(f))


resulting in e (or x+y)

So that works, but when I try to do that for a polynomial with parameters, say

f=x+y+a+b


it complains that a and b are not defined. If I add them to the ring I get e, but I suspect this is equivalent now to x+y+a+b (I didn't check because it should be e+a+b).

Do I need to keep the ring defined the same but define maybe S as;

S = SymmetricFunctions(QQ[x,y]) ?

This causes the error claiming that the function is not a symmetric polynomial.

By the way, I know I could use something like,

a=maxima.eval('elem([2,e1,e2],(x+y+a+b)/2,[x,y])')


to get e1/2 + (a+b)/2, but I then can't use eval or sage_evalon the result because there are parsing errors for larger equations, e.g. python complains about the use of '^' instead of '**' for exponentiation, etc. My other posted question, http://ask.sagemath.org/question/2672..., is in direct relation to this phenomena.

edit retag close merge delete

Sort by » oldest newest most voted you just have to work over a base ring which is not QQ

sage: P.<x,y>=PolynomialRing(QQ['a'])
sage: a = P.base_ring().gen()
sage: f = x + y + a
sage: S=SymmetricFunctions(P.base_ring())
sage: S.from_polynomial(f)
a*m[] + m

more

Thanks! I've got what you've done, including other bases. This is exactly what I asked for!

Now I will try to get it to work for two pairs of symmetric variables, e.g., x&y AND a&b. I'll try defining another base ring, though I feel I'll need to also redefine the returned 'functions', e.g. m[] or m with another letter.... like n[] and n... I think exy=S.elementary(); exy._prefix='exy' etc. I'll try this today, and hopefully I won't have to ask again - unless it is on the tip of your tongue already ;)