#10981: algebraic real field partial_fraction_decomposition bug
-----------------------+----------------------------------------------------
Reporter: mariah | Owner: AlexGhitza
Type: defect | Status: new
Priority: major | Milestone: sage-5.0
Component: algebra | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-----------------------+----------------------------------------------------
Comment(by spice):
This seems to be a deeper bug than just one in
partial_fraction_decomposition. I've traced it to multiplication in AA,
where some weird stuff is going on:
{{{
sage: P = AA[x](1+x^4); P
x^4 + 1
sage: a1,a2 = P.factor()[0][0],P.factor()[1][0]; a1,a2
(x^2 - 1.414213562373095?*x + 1.000000000000000?, x^2 +
1.414213562373095?*x + 1.000000000000000?)
sage: a1*a2
x^4 + 1.000000000000000?
sage: a1,a2
(x^2 - 1.414213562373095?*x + 1, x^2 + 1.414213562373095?*x + 1)
sage: a1*a2
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/sage/sage-4.7.2.alpha2/devel/sage-dev/sage/<ipython console> in
<module>()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement.__mul__
(sage/structure/element.c:12051)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.Polynomial._mul_
(sage/rings/polynomial/polynomial_element.c:10928)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.Polynomial._mul_karatsuba
(sage/rings/polynomial/polynomial_element.c:16309)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.do_karatsuba
(sage/rings/polynomial/polynomial_element.c:36878)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.do_karatsuba
(sage/rings/polynomial/polynomial_element.c:36759)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement.__mul__
(sage/structure/element.c:12051)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement._mul_
(sage/structure/element.c:12195)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in _mul_(self, other)
2277 sdk = sd.kind()
2278 odk = od.kind()
-> 2279 return type(self)(_mul_algo[sdk, odk](self, other, False))
2280
2281 def _div_(self, other):
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in __init__(self, x)
3384 class AlgebraicReal(AlgebraicNumber_base):
3385 def __init__(self, x):
-> 3386 AlgebraicNumber_base.__init__(self, AA, x)
3387
3388 def __reduce__(self):
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in __init__(self, parent, x)
2186 raise TypeError, "Illegal initializer for algebraic
number"
2187
-> 2188 self._value = self._descr._interval_fast(64)
2189
2190 def _repr_(self):
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in _interval_fast(self, prec)
5660 op = self._op
5661
-> 5662 lv = self._left._interval_fast(prec)
5663 rv = self._right._interval_fast(prec)
5664
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in _interval_fast(self, prec)
3638
3639 def _interval_fast(self, prec):
-> 3640 return self.interval_fast(RealIntervalField(prec))
3641
3642 def interval_exact(self, field):
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/qqbar.pyc in interval_fast(self, field)
2794 """
2795 if field.prec() == self._value.prec():
-> 2796 return field(self._value)
2797 elif field.prec() > self._value.prec():
2798 self._more_precision()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/real_mpfi.so in
sage.rings.real_mpfi.RealIntervalField_class.__call__
(sage/rings/real_mpfi.c:4285)()
/Users/sage/sage-4.7.2.alpha2/local/lib/python2.6/site-
packages/sage/rings/real_mpfi.so in
sage.rings.real_mpfi.RealIntervalFieldElement.__init__
(sage/rings/real_mpfi.c:7725)()
TypeError: Unable to convert number to real interval.
sage:
}}}
As far as I can tell, problems arise if the representation of the
AlgebraicReal element is in term of non-real elements in QQbar.
I've opened a new ticket (#11728) for this, since it goes beyond just
partial_fraction_decomposition().
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10981#comment:1>
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.