#10475: Calling a polynomial over finite non-prime field with named arguments
--------------------------------+-------------------------------------------
Reporter: SimonKing | Owner: AlexGhitza
Type: defect | Status: new
Priority: major | Milestone:
Component: basic arithmetic | Keywords: Conversion, polynomial
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
At [http://groups.google.com/group/sage-
support/browse_thread/thread/9e729cb5d909bd53 sage-support], Thomas
pointed to a bug that boils down as follows:
{{{
sage: F.<x> = GF(4)
sage: P.<y> = F[]
sage: p = P.random_element(5,5)
sage: SR(p)
Traceback (most recent call last):
...
TypeError: __call__() takes exactly 1 positional argument (0 given)
}}}
Reading the `_symbolic_` method, one is pointed to the subs method, which
is
{{{
def subs(self, *x, **kwds):
if len(x) == 1 and isinstance(x[0], dict):
g = self.parent().gen()
if x[0].has_key(g):
return self(x[0][g])
elif len(x[0]) > 0:
raise TypeError, "keys do not match self's parent"
return self
return self.__call__(*x, **kwds)
}}}
and there is the error again:
{{{
sage: p(y=y)
Traceback (most recent call last):
...
TypeError: __call__() takes exactly 1 positional argument (0 given)
}}}
Indeed, the call method of p is
{{{
def __call__(self, a):
cdef ntl_ZZ_pE _a
cdef ZZ_pE_c c_b
K = self._parent.base_ring()
try:
if a.parent() is not K:
a = K.coerce(a)
except (TypeError, AttributeError, NotImplementedError):
return Polynomial.__call__(self, a)
_a = self._parent._modulus.ZZ_pE(list(a.polynomial()))
ZZ_pEX_eval(c_b, self.x, _a.x)
R = K.polynomial_ring()
return K(str(R(ZZ_pE_c_to_list(c_b))))
}}}
So, my patch will change the call method so that the arguments can either
a single positional argument or one named argument (using the variable
name).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10475>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.