Changes between Version 7 and Version 9 of Ticket #24378


Ignore:
Timestamp:
12/15/17 11:13:41 (4 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24378

    • Property Summary changed from Doctest failures related to sympy CRootOf to complex_root_of uses inexact index
  • Ticket #24378 – Description

    v7 v9  
    1 When `gmpy2` is installed:
     1When numerically evaluating `complex_root_of(a, k)`, the index `k` is passes as real number:
     2{{{
     3sage: complex_root_of(x^8-1, 7).n(2)
     4---------------------------------------------------------------------------
     5IndexError                                Traceback (most recent call last)
     6<ipython-input-4-4eba84b7c14c> in <module>()
     7----> 1 complex_root_of(x**Integer(8)-Integer(1), Integer(7)).n(Integer(2))
     8
     9/home/patchbot/sage-patchbot/src/sage/structure/element.pyx in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)()
     10    863             0.666666666666667
     11    864         """
     12--> 865         return self.numerical_approx(prec, digits, algorithm)
     13    866
     14    867     N = deprecated_function_alias(13055, n)
     15
     16/home/patchbot/sage-patchbot/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36209)()
     17   5818         kwds = {'parent': R, 'algorithm': algorithm}
     18   5819         try:
     19-> 5820             x = x._convert(kwds)
     20   5821         except TypeError: # numerical approximation for real number failed
     21   5822             pass          # try again with complex
     22
     23/home/patchbot/sage-patchbot/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)()
     24   1257         sig_on()
     25   1258         try:
     26-> 1259             res = self._gobj.evalf(0, kwds)
     27   1260         finally:
     28   1261             sig_off()
     29
     30/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.pyc in _evalf_(self, poly, index, parent, algorithm)
     31   2920         print("index: {}".format(index))
     32   2921         print("type(index): {}".format(type(index)))
     33-> 2922         sobj = CRootOf(Poly(poly._sympy_()), int(index))
     34   2923         return sobj.n(ceil(prec*3/10))._sage_()
     35   2924
     36
     37/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sympy/polys/rootoftools.pyc in __new__(cls, f, x, index, radicals, expand)
     38    130         if index < -degree or index >= degree:
     39    131             raise IndexError("root index out of [%d, %d] range, got %d" %
     40--> 132                              (-degree, degree - 1, index))
     41    133         elif index < 0:
     42    134             index += degree
     43
     44IndexError: root index out of [-8, 7] range, got 8
     45}}}
     46
     47When `gmpy2` is installed, the index is even passed as complex number:
    248{{{
    349sage -t --long src/sage/functions/other.py