Hello All,
I have some polynomials in two varaibles, say u and v, and I want to apply
the map which u to u^-1 and v to v^-1. Sadly, I run to problems insude sage:
With one variable it is OK:
sage: R.<u>=LaurentPolynomialRing(ZZ)
sage: p=u**-1
sage: p.substitute(u=u^-1)
u
but when I go to two variables then it breaks:
sage: R.<u,v>=LaurentPolynomialRing(ZZ,2)
sage: p=u**-1
sage: p.substitute(u=u^-2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-d9f8f61b1503> in <module>()
----> 1 p.substitute(u=u**-Integer(2))
/usr/local/src/sage/sage-5.11/local/lib/python2.7/site-packages/sage/structure/element.so
in sage.structure.element.Element.substitute
(sage/structure/element.c:6349)()
/usr/local/src/sage/sage-5.11/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial.so
in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair.subs
(sage/rings/polynomial/laurent_polynomial.c:10778)()
/usr/local/src/sage/sage-5.11/local/lib/python2.7/site-packages/sage/structure/element.so
in sage.structure.element.RingElement.__imul__
(sage/structure/element.c:14780)()
/usr/local/src/sage/sage-5.11/local/lib/python2.7/site-packages/sage/structure/coerce.so
in sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:8169)()
TypeError: unsupported operand parent(s) for '*': 'Multivariate Laurent
Polynomial Ring in u, v over Rational Field' and 'Multivariate Laurent
Polynomial Ring in u, v over Integer Ring'
If p=u then this is fine, so it is the u^-1 that is causing the problem.
Of course what I really want to do is p.substitute({u:u**-1, v:v**-1})
where o is computed on the fly but if I can even do this then I am stuck.
Does ayone know if I am doing something wrong here or if there is a way
around this?
Cheers,
Andrew
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.