ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 11 Apr 2019 08:42:31 -0500Setting t=0 in a non-symmetric E-Macdonald polynomialhttp://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/ Suppose I have a non-symmetric [E-Macdonald polynomial](https://arxiv.org/abs/math/0601693) indexed by, say, $\mu=(0,1,1)$. Then I can write
from sage.combinat.sf.ns_macdonald import E
E([0,1,1])
and I get a polynomial in three variables and with coefficients in $\mathbb{Q}(q,t)$:
((-t + 1)/(-q*t + 1))*x0*x1 + ((-t + 1)/(-q*t + 1))*x0*x2 + x1*x2
However, I am confused about how I can work with this polynomial. For my purposes, I would like to study the specialization $t=0$. It would be really neat if there were some way to get write something like
Epoly(x_0,x_1,x_2,q,t) =...
so I could easily specialize variables as I go along.
Thu, 11 Apr 2019 02:56:49 -0500http://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/Answer by rburing for <p>Suppose I have a non-symmetric <a href="https://arxiv.org/abs/math/0601693">E-Macdonald polynomial</a> indexed by, say, $\mu=(0,1,1)$. Then I can write</p>
<pre><code>from sage.combinat.sf.ns_macdonald import E
E([0,1,1])
</code></pre>
<p>and I get a polynomial in three variables and with coefficients in $\mathbb{Q}(q,t)$:</p>
<pre><code>((-t + 1)/(-q*t + 1))*x0*x1 + ((-t + 1)/(-q*t + 1))*x0*x2 + x1*x2
</code></pre>
<p>However, I am confused about how I can work with this polynomial. For my purposes, I would like to study the specialization $t=0$. It would be really neat if there were some way to get write something like</p>
<pre><code>Epoly(x_0,x_1,x_2,q,t) =...
</code></pre>
<p>so I could easily specialize variables as I go along.</p>
http://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/?answer=46092#post-id-46092You can find out what you're dealing with by looking at the object's parent:
sage: my_E = E([0,1,1]); my_E
((-t + 1)/(-q*t + 1))*x0*x1 + ((-t + 1)/(-q*t + 1))*x0*x2 + x1*x2
sage: my_E.parent()
Multivariate Polynomial Ring in x0, x1, x2 over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field
So you can [read about multivariate polynomials in the reference manual](http://doc.sagemath.org/html/en/reference/polynomial_rings/polynomial_rings_multivar.html). In this case you can do
sage: q, t = my_E.parent().base_ring().gens()
sage: my_E.map_coefficients(lambda c: c.subs({t : 0}))
x0*x1 + x0*x2 + x1*x2
This last polynomial still belongs to the same ring as `my_E`, but you could change that using the `change_ring()` method if you want. You can also get at the `x`'s:
sage: x = my_E.parent().gens()
sage: x[0]
x0
sage: my_E.subs({x[0] : 0})
x1*x2
Alternatively you can convert the whole thing into the symbolic ring:
sage: var('t')
sage: SR(my_E).subs(t=0)
x0*x1 + x0*x2 + x1*x2
Thu, 11 Apr 2019 03:15:00 -0500http://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/?answer=46092#post-id-46092Comment by joakim_uhlin for <p>You can find out what you're dealing with by looking at the object's parent:</p>
<pre><code>sage: my_E = E([0,1,1]); my_E
((-t + 1)/(-q*t + 1))*x0*x1 + ((-t + 1)/(-q*t + 1))*x0*x2 + x1*x2
sage: my_E.parent()
Multivariate Polynomial Ring in x0, x1, x2 over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field
</code></pre>
<p>So you can <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/polynomial_rings_multivar.html">read about multivariate polynomials in the reference manual</a>. In this case you can do</p>
<pre><code>sage: q, t = my_E.parent().base_ring().gens()
sage: my_E.map_coefficients(lambda c: c.subs({t : 0}))
x0*x1 + x0*x2 + x1*x2
</code></pre>
<p>This last polynomial still belongs to the same ring as <code>my_E</code>, but you could change that using the <code>change_ring()</code> method if you want. You can also get at the <code>x</code>'s:</p>
<pre><code>sage: x = my_E.parent().gens()
sage: x[0]
x0
sage: my_E.subs({x[0] : 0})
x1*x2
</code></pre>
<p>Alternatively you can convert the whole thing into the symbolic ring:</p>
<pre><code>sage: var('t')
sage: SR(my_E).subs(t=0)
x0*x1 + x0*x2 + x1*x2
</code></pre>
http://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/?comment=46096#post-id-46096Big thanks for this very pedagogical answer!Thu, 11 Apr 2019 08:42:31 -0500http://ask.sagemath.org/question/46090/setting-t0-in-a-non-symmetric-e-macdonald-polynomial/?comment=46096#post-id-46096