Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3704 by ruoyu0...@gmail.com: cse raise error with 'Infinity'
object has no attribute 'q'
http://code.google.com/p/sympy/issues/detail?id=3704
I am using 0.7.2
from sympy import *
x,a,b,c,d = symbols("x a b c d", real=True)
p = solve(a*x**3 + b*x**2 + c*x + d, x)
cse(p)
The trackback
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-52-098d029dd026> in <module>()
2 x,a,b,c,d = symbols("x a b c d", real=True)
3 p = solve(a*x**3 + b*x**2 + c*x + d, x)
----> 4 cse(p)
C:\Python26\lib\site-packages\sympy\simplify\cse_main.pyc in cse(exprs,
symbols, optimizations, postprocess)
311 for j, expr in enumerate(reduced_exprs):
312 old = reduced_exprs[j]
--> 313 reduced_exprs[j] = update(expr)
314 hit = hit or (old != reduced_exprs[j])
315 # Make the substitution in all of the subsequent
substitutions.
C:\Python26\lib\site-packages\sympy\simplify\cse_main.pyc in <lambda>(x)
307 update = lambda x: x.xreplace({subtree: sym, 1/subtree:
1/sym})
308 else:
--> 309 update = lambda x: x.subs(subtree, sym)
310 # Make the substitution in all of the target expressions.
311 for j, expr in enumerate(reduced_exprs):
C:\Python26\lib\site-packages\sympy\core\basic.pyc in subs(self, *args,
**kwargs)
870 rv = self
871 for old, new in sequence:
--> 872 rv = rv._subs(old, new)
873 if not isinstance(rv, Basic):
874 break
C:\Python26\lib\site-packages\sympy\core\cache.pyc in wrapper(*args,
**kw_args)
86 except KeyError:
87 pass
---> 88 func_cache_it_cache[k] = r = func(*args, **kw_args)
89 return r
90 return wrapper
C:\Python26\lib\site-packages\sympy\core\basic.pyc in _subs(self, old, new,
**hints)
969 rv = self._eval_subs(old, new)
970 if rv is None:
--> 971 rv = fallback(self, old, new)
972 return rv
973
C:\Python26\lib\site-packages\sympy\core\basic.pyc in fallback(self, old,
new)
956 if not hasattr(arg, '_eval_subs'):
957 continue
--> 958 arg = arg._subs(old, new, **hints)
959 if arg is not args[i]:
960 hit = True
C:\Python26\lib\site-packages\sympy\core\cache.pyc in wrapper(*args,
**kw_args)
86 except KeyError:
87 pass
---> 88 func_cache_it_cache[k] = r = func(*args, **kw_args)
89 return r
90 return wrapper
C:\Python26\lib\site-packages\sympy\core\basic.pyc in _subs(self, old, new,
**hints)
967 return new
968
--> 969 rv = self._eval_subs(old, new)
970 if rv is None:
971 rv = fallback(self, old, new)
C:\Python26\lib\site-packages\sympy\core\mul.pyc in _eval_subs(self, old,
new)
1274 for (b, old_e) in old_c.items():
1275 c_e = c[b]
-> 1276 rat.append(ndiv(c_e, old_e))
1277 if not rat[-1]:
1278 return rv
C:\Python26\lib\site-packages\sympy\core\mul.pyc in ndiv(a, b)
1184 """
1185
-> 1186 if not b.q % a.q or not a.q % b.q:
1187 return int(a/b)
1188 return 0
AttributeError: 'Infinity' object has no attribute 'q'
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.