#16485: "TypeError: keys do not match self's parent" computing variety of
MPolynomialIdeal_singular_repr
---------------------------+------------------------
Reporter: gagern | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.3
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------+------------------------
Old description:
> Trying to compute a variety, I get an error instead. The code snippets
> are from
> [http://git.sagemath.org/sage.git/tree/src/sage/rings/polynomial/multi_polynomial_ideal.py?h=develop&id=6.3.beta3#n2384
> multi_polynomial_ideal as of Sage version 6.3.beta3].
>
> {{{
> sage: Qabcd.<a,b,c,d> = PolynomialRing(QQ, order='lex')
> sage: ideal(2*d^2 - 1, 5*c - 3*d, 5*b + 4*d, a).variety(QQbar)
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call
> last)
> <ipython-input-2-1f88209af548> in <module>()
> ----> 1 ideal(Integer(2)*d**Integer(2) - Integer(1), Integer(5)*c -
> Integer(3)*d, Integer(5)*b + Integer(4)*d, a).variety(QQbar)
>
> sage/local/lib/python2.7/site-
> packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in
> __call__(self, *args, **kwds)
> 602 if not R.base_ring().is_field():
> 603 raise ValueError("Coefficient ring must be a field
> for function '%s'."%(self.f.__name__))
> --> 604 return self.f(self._instance, *args, **kwds)
> 605
> 606 require_field = RequireField
>
> sage/local/lib/python2.7/site-
> packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in
> variety(self, ring)
> 2647 V = []
> 2648 for t in T:
> -> 2649 Vbar = _variety(list(t),[])
> 2650 #Vbar = _variety(list(t.gens()),[])
> 2651
>
> sage/local/lib/python2.7/site-
> packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in _variety(T,
> V, v)
> 2620 vbar[variable] = root
> 2621 Tbar = [ f.subs({variable:root}) for f in T ]
> -> 2622 _variety(Tbar,V,vbar)
> 2623
> 2624 return V
>
> sage/local/lib/python2.7/site-
> packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in _variety(T,
> V, v)
> 2619 vbar = v.copy()
> 2620 vbar[variable] = root
> -> 2621 Tbar = [ f.subs({variable:root}) for f in T ]
> 2622 _variety(Tbar,V,vbar)
> 2623
>
> sage/local/lib/python2.7/site-
> packages/sage/rings/polynomial/multi_polynomial_libsingular.so in
> sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.subs
> (sage/rings/polynomial/multi_polynomial_libsingular.cpp:22728)()
>
> TypeError: keys do not match self's parent
> }}}
New description:
Trying to compute a variety, I get an error instead. The code snippets are
from
[http://git.sagemath.org/sage.git/tree/src/sage/rings/polynomial/multi_polynomial_ideal.py?h=develop&id=6.3.beta3#n2384
multi_polynomial_ideal as of Sage version 6.3.beta3].
{{{
sage: Qabc.<a,b,c> = PolynomialRing(QQ, order='lex')
sage: ideal(c^2-2, b-c, a).variety(QQbar)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-2-…> in <module>()
----> 1 ideal(c**Integer(2)-Integer(2), b-c, a).variety(QQbar)
sage/local/lib/python2.7/site-
packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in
__call__(self, *args, **kwds)
602 if not R.base_ring().is_field():
603 raise ValueError("Coefficient ring must be a field for
function '%s'."%(self.f.__name__))
--> 604 return self.f(self._instance, *args, **kwds)
605
606 require_field = RequireField
sage/local/lib/python2.7/site-
packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in variety(self,
ring)
2647 V = []
2648 for t in T:
-> 2649 Vbar = _variety(list(t),[])
2650 #Vbar = _variety(list(t.gens()),[])
2651
sage/local/lib/python2.7/site-
packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in _variety(T,
V, v)
2620 vbar[variable] = root
2621 Tbar = [ f.subs({variable:root}) for f in T ]
-> 2622 _variety(Tbar,V,vbar)
2623
2624 return V
sage/local/lib/python2.7/site-
packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in _variety(T,
V, v)
2619 vbar = v.copy()
2620 vbar[variable] = root
-> 2621 Tbar = [ f.subs({variable:root}) for f in T ]
2622 _variety(Tbar,V,vbar)
2623
sage/local/lib/python2.7/site-
packages/sage/rings/polynomial/multi_polynomial_libsingular.so in
sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.subs
(sage/rings/polynomial/multi_polynomial_libsingular.cpp:22728)()
TypeError: keys do not match self's parent
}}}
--
Comment (by gagern):
I guess I have an idea as to what's going on here now. The first generator
causes `c` to assume a non-rational value. As a consequence, the second
generator will change its base ring from `QQ` to `QQbar`. The third
generator does not contain `c`, so its base ring remains `QQ`. Now `b` is
chosen as the next variable. Its parent is the ring over `QQbar`, since it
got chosen from the second generator. However, it can't be substituted
into the third generator since the parent for that doesn't match.
I guess one solution would be changing all polynomials to the target ring
up front. I'll try to write a fix for this.
--
Ticket URL: <http://trac.sagemath.org/ticket/16485#comment:3>
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 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-trac.
For more options, visit https://groups.google.com/d/optout.