How do I Pass a tuple as an argument for a multivariate polynomial?
I can't find any support documentation on this, but I'm sure it must be possible. To give some context, I'm working on a module for invariant theory which allows for computing matrices acting on polynomials:
Say I define a polynomial
h(x1,x2) = a*x1^2 + b*x1x2 + c*x2^2 in QQ[x1,x2], and an ordered pair
(2-tuple) v = (x1,-x2). How do I pass v such that
h(x1,-x2) ? In other words, I want to assign each coordinate of the tuple v to it's corresponding coordinate of the argument of h. Actually, a generalization to a polynomial in n variables which takes an n-tuple as an argument would be the most helpful. Below is the error that I received when trying to do this:
TypeError Traceback (most recent call last) /home/martin/Sage/sage-4.5.2/<ipython console> in <module>() /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__call__ (sage/symbolic/expression.cpp:15476)() /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/symbolic/callable.pyc in _call_element_(self, _the_element, *args, **kwds) 449 d = dict(zip(map(repr, self.arguments()), args)) 450 d.update(kwds) --> 451 return SR(_the_element.substitute(**d)) /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.substitute (sage/symbolic/expression.cpp:14850)() /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.coerce_in (sage/symbolic/expression.cpp:10193)() /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/structure/parent_old.so in sage.structure.parent_old.Parent._coerce_ (sage/structure/parent_old.c:3288)() /home/martin/Sage/sage-4.5.2/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.coerce (sage/structure/parent.c:7045)() TypeError: no canonical coercion from Ambient free module of rank 2 over the integral domain Multivariate Polynomial Ring in x1, x2 over Rational Field to Callable function ring with arguments (x1, x2)