Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3168 by [email protected]: bug in sqrtdenest
http://code.google.com/p/sympy/issues/detail?id=3168
```
from sympy import *
z = sqrt(2*sqrt(10) + 6*sqrt(2) + 4*sqrt(5) + 12 + 10*sqrt(15) +
30*sqrt(3))
sqrtdenest(z)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sympy/simplify/sqrtdenest.py", line 130, in sqrtdenest
z = _sqrtdenest0(expr)
File "sympy/simplify/sqrtdenest.py", line 199, in _sqrtdenest0
return _sqrtdenest_rec(n)
File "sympy/simplify/sqrtdenest.py", line 248, in _sqrtdenest_rec
d_1 = _sqrtdenest_rec(sqrt(a1 + c_1))
File "sympy/simplify/sqrtdenest.py", line 236, in _sqrtdenest_rec
if expr.base < 0:
AttributeError: 'Mul' object has no attribute 'base'
```
The bug fix is
```
--- a/sympy/simplify/sqrtdenest.py
+++ b/sympy/simplify/sqrtdenest.py
@@ -233,6 +233,8 @@ def _sqrtdenest_rec(expr):
-sqrt(11) - sqrt(7) + sqrt(2) + 3*sqrt(5)
"""
from sympy.simplify.simplify import radsimp, split_surds,
rad_rationalize
+ if not expr.is_Pow:
+ return sqrtdenest(expr)
if expr.base < 0:
return sqrt(-1)*_sqrtdenest_rec(sqrt(-expr.base))
a, b = split_surds(expr.base)
```
It is fixed in https://github.com/sympy/sympy/pull/1131
--
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.