Opened 4 years ago

Last modified 4 years ago

#24378 closed defect

Doctest failures related to sympy CRootOf — at Version 7

Reported by: jdemeyer Owned by:
Priority: blocker Milestone: sage-8.2
Component: symbolics Keywords:
Cc: rws, charpent Merged in:
Authors: Ralf Stephan Reviewers:
Report Upstream: N/A Work issues:
Branch: u/rws/doctest_failures_related_to_sympy_crootof (Commits, GitHub, GitLab) Commit: a93662faed523eb117f4ce0197b3178855849fd2
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

When gmpy2 is installed:

sage -t --long src/sage/functions/other.py
**********************************************************************
File "src/sage/functions/other.py", line 2862, in sage.functions.other.Function_crootof
Failed example:
    c.n()
Exception raised:
    Traceback (most recent call last):
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 517, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 920, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.functions.other.Function_crootof[1]>", line 1, in <module>
        c.n()
      File "sage/structure/element.pyx", line 865, in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)
        return self.numerical_approx(prec, digits, algorithm)
      File "sage/symbolic/expression.pyx", line 5824, in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36286)
        x = x._convert(kwds)
      File "sage/symbolic/expression.pyx", line 1259, in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)
        res = self._gobj.evalf(0, kwds)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.py", line 2920, in _evalf_
        sobj = CRootOf(Poly(poly._sympy_()), int(index))
      File "sage/rings/complex_number.pyx", line 1058, in sage.rings.complex_number.ComplexNumber.__int__ (build/cythonized/sage/rings/complex_number.c:10918)
        raise TypeError("can't convert complex to int; use int(abs(z))")
    TypeError: can't convert complex to int; use int(abs(z))
**********************************************************************
File "src/sage/functions/other.py", line 2864, in sage.functions.other.Function_crootof
Failed example:
    c.n(100)
Exception raised:
    Traceback (most recent call last):
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 517, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 920, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.functions.other.Function_crootof[2]>", line 1, in <module>
        c.n(Integer(100))
      File "sage/structure/element.pyx", line 865, in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)
        return self.numerical_approx(prec, digits, algorithm)
      File "sage/symbolic/expression.pyx", line 5824, in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36286)
        x = x._convert(kwds)
      File "sage/symbolic/expression.pyx", line 1259, in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)
        res = self._gobj.evalf(0, kwds)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.py", line 2920, in _evalf_
        sobj = CRootOf(Poly(poly._sympy_()), int(index))
      File "sage/rings/complex_number.pyx", line 1058, in sage.rings.complex_number.ComplexNumber.__int__ (build/cythonized/sage/rings/complex_number.c:10918)
        raise TypeError("can't convert complex to int; use int(abs(z))")
    TypeError: can't convert complex to int; use int(abs(z))
**********************************************************************
File "src/sage/functions/other.py", line 2866, in sage.functions.other.Function_crootof
Failed example:
    (c^6 + c + 1).n(100) < 1e-25
Exception raised:
    Traceback (most recent call last):
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 517, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 920, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.functions.other.Function_crootof[3]>", line 1, in <module>
        (c**Integer(6) + c + Integer(1)).n(Integer(100)) < RealNumber('1e-25')
      File "sage/structure/element.pyx", line 865, in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)
        return self.numerical_approx(prec, digits, algorithm)
      File "sage/symbolic/expression.pyx", line 5824, in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36286)
        x = x._convert(kwds)
      File "sage/symbolic/expression.pyx", line 1259, in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)
        res = self._gobj.evalf(0, kwds)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.py", line 2920, in _evalf_
        sobj = CRootOf(Poly(poly._sympy_()), int(index))
      File "sage/rings/complex_number.pyx", line 1058, in sage.rings.complex_number.ComplexNumber.__int__ (build/cythonized/sage/rings/complex_number.c:10918)
        raise TypeError("can't convert complex to int; use int(abs(z))")
    TypeError: can't convert complex to int; use int(abs(z))
**********************************************************************
File "src/sage/functions/other.py", line 2908, in sage.functions.other.Function_crootof._evalf_
Failed example:
    complex_root_of(x^2-2, 1).n()
Exception raised:
    Traceback (most recent call last):
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 517, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 920, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.functions.other.Function_crootof._evalf_[0]>", line 1, in <module>
        complex_root_of(x**Integer(2)-Integer(2), Integer(1)).n()
      File "sage/structure/element.pyx", line 865, in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)
        return self.numerical_approx(prec, digits, algorithm)
      File "sage/symbolic/expression.pyx", line 5824, in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36286)
        x = x._convert(kwds)
      File "sage/symbolic/expression.pyx", line 1259, in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)
        res = self._gobj.evalf(0, kwds)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.py", line 2920, in _evalf_
        sobj = CRootOf(Poly(poly._sympy_()), int(index))
      File "sage/rings/complex_number.pyx", line 1058, in sage.rings.complex_number.ComplexNumber.__int__ (build/cythonized/sage/rings/complex_number.c:10918)
        raise TypeError("can't convert complex to int; use int(abs(z))")
    TypeError: can't convert complex to int; use int(abs(z))
**********************************************************************
2 items had failures:
   3 of   5 in sage.functions.other.Function_crootof
   1 of   3 in sage.functions.other.Function_crootof._evalf_
    [622 tests, 4 failures, 17.27 s]  
sage -t --long src/sage/interfaces/sympy.py
**********************************************************************
File "src/sage/interfaces/sympy.py", line 617, in sage.interfaces.sympy._sympysage_crootof
Failed example:
    (sols[0]+1)._sage_().n()
Exception raised:
    Traceback (most recent call last):
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 517, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 920, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.sympy._sympysage_crootof[6]>", line 1, in <module>
        (sols[Integer(0)]+Integer(1))._sage_().n()
      File "sage/structure/element.pyx", line 865, in sage.structure.element.Element.n (build/cythonized/sage/structure/element.c:8131)
        return self.numerical_approx(prec, digits, algorithm)
      File "sage/symbolic/expression.pyx", line 5824, in sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:36286)
        x = x._convert(kwds)
      File "sage/symbolic/expression.pyx", line 1259, in sage.symbolic.expression.Expression._convert (build/cythonized/sage/symbolic/expression.cpp:10663)
        res = self._gobj.evalf(0, kwds)
      File "/home/patchbot/sage-patchbot/local/lib/python2.7/site-packages/sage/functions/other.py", line 2920, in _evalf_
        sobj = CRootOf(Poly(poly._sympy_()), int(index))
      File "sage/rings/complex_number.pyx", line 1058, in sage.rings.complex_number.ComplexNumber.__int__ (build/cythonized/sage/rings/complex_number.c:10918)
        raise TypeError("can't convert complex to int; use int(abs(z))")
    TypeError: can't convert complex to int; use int(abs(z))
**********************************************************************
1 item had failures:
   1 of   8 in sage.interfaces.sympy._sympysage_crootof
    [218 tests, 1 failure, 3.27 s]

Change History (7)

comment:1 Changed 4 years ago by jdemeyer

  • Cc charpent added

comment:2 Changed 4 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from Doctest failures related to sympy to Doctest failures related to sympy CRootOf

comment:3 Changed 4 years ago by rws

  • Branch set to u/rws/doctest_failures_related_to_sympy_crootof

comment:4 follow-up: Changed 4 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to a93662faed523eb117f4ce0197b3178855849fd2
  • Status changed from new to needs_review

That exact arguments are made inexact is a bug in itself. But that they are made complex (EDIT: in some machines) is beyond me.


New commits:

a93662f24378: Doctest failures related to sympy
Last edited 4 years ago by rws (previous) (diff)

comment:5 Changed 4 years ago by jdemeyer

Do you have an idea why this depends on the system?

comment:6 in reply to: ↑ 4 Changed 4 years ago by jdemeyer

Replying to rws:

That exact arguments are made inexact is a bug in itself. But that they are made complex (EDIT: in some machines) is beyond me.

Do you know where this happens? It seems to me that it is Pynac doing this.

comment:7 Changed 4 years ago by jdemeyer

  • Description modified (diff)
Note: See TracTickets for help on using tickets.