Ask Your Question
1

Substitute elementary symmetric functions in a polynomial

asked 2016-02-17 11:36:12 -0600

giomasce gravatar image

Suppose I do the following:

sage: SF=SymmetricFunctions(QQ)
sage: poly=SF.e()(SF.from_polynomial(x^2+y^2))
sage: poly
e[1, 1] - 2*e[2]

Now I would like to substitute e[1, 1] in that expression. However:

sage: poly.subs({SF.e()[1, 1]: 1})
e[1, 1] - 2*e[2]

Does not do what I want (in fact it does not do anything). Is there a way to substitute a specific elementary polynomial?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-02-17 12:40:20 -0600

tmonteil gravatar image

updated 2016-02-17 12:40:45 -0600

Looking at the source code, the problem seems to be that the subs method requires to be able to count the number of generators of the parent of poly (i.e. Symmetric Functions over Rational Field in the elementary basis), which is infinite.

Since this parent does not provide any ngens method (that is supposed to count the number of generators), the subs method just returns poly unmodified.

So, you have to write your own. I am not completely sure, but i can suggest the following approach: you can have a look at the map_item method of poly. Since you basically want to replace e[1,1] by e[0] (=1), you can do:

sage: def substitution(item, coeff):
....:    if item == Partition([1, 1]):
....:        return (Partition([0]), coeff)
....:    else:
....:        return (item, coeff)

sage: poly.map_item(substitution)
e[] - 2*e[2]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-02-17 11:36:12 -0600

Seen: 59 times

Last updated: Feb 17 '16