Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Polynomial

New issue 1563 by asmeurer: re(RootOf) fails because Poly.has() fails
http://code.google.com/p/sympy/issues/detail?id=1563

>>> a = RootsOf(x**5 - 11*x + 2, x).roots().next()
>>> re(a)
Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "./sympy/core/multidimensional.py", line 127, in wrapper
     return f(*args, **kwargs)
   File "./sympy/core/cache.py", line 85, in wrapper
     func_cache_it_cache[k] = r = func(*args, **kw_args)
   File "./sympy/core/function.py", line 139, in __new__
     evaluated = cls.eval(*args)
   File "./sympy/functions/elementary/complexes.py", line 70, in eval
     elif not term.has(S.ImaginaryUnit) and term.is_real:
   File "./sympy/core/basic.py", line 1240, in has
     if e.has(p):
   File "./sympy/core/basic.py", line 1240, in has
     if e.has(p):
AttributeError: 'tuple' object has no attribute 'has'
>>> Poly(x**5 - 11*x + 2, x).has(I)
Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "./sympy/core/basic.py", line 1240, in has
     if e.has(p):
AttributeError: 'tuple' object has no attribute 'has'

re (as well as im) checks if the argument has I, which runs Poly(x**5 -  
11*x + 2, x).has(I), which fails
because Poly.args contains tuples instead of Basic objects:

>>> Poly(x**5 - 11*x + 2, x).args
((1, -11, 2), ((5,), (1,), (0,)), (x,), grlex)

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to