{"issue":{"milestone":null,"title":"sqrt matching in sqrtdenest","created_at":"2011-11-30T19:19:39Z","user":{"login":"pernici","id":759243,"url":"https://api.github.com/users/pernici","avatar_url":"https://secure.gravatar.com/avatar/06e8f668ca62cbe8a49b53bede84dec1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"06e8f668ca62cbe8a49b53bede84dec1"},"updated_at":"2011-12-30T04:40:51Z","state":"open","labels":[],"id":2405936,"pull_request":{"patch_url":"https://github.com/sympy/sympy/pull/792.patch","html_url":"https://github.com/sympy/sympy/pull/792","diff_url":"https://github.com/sympy/sympy/pull/792.diff"},"closed_at":null,"html_url":"https://github.com/sympy/sympy/issues/792","body":"In master  on my computer `sqrtdenest` does not denest this example (appearing with XFAIL in test_sqrtdenest.py)\r\n\r\n```\r\n>>> sqrtdenest(sqrt(16-2*sqrt(29)+2*sqrt(55-10*sqrt(29))))\r\nsqrt(-2*sqrt(29) + 2*sqrt(-10*sqrt(29) + 55) + 16)\r\n```\r\n\r\nThe reason is that `expr.match(sqrt(a + b * sqrt(r)))` does\r\nnot guarantee that `sqrt(r)` contains the deepest sqrt; on my computer\r\n\r\n```\r\n>>> a, b, r = Wild('a'), Wild('b'), Wild('r')\r\n>>> expr = sqrt(-2*sqrt(29) + 2*sqrt(-10*sqrt(29) + 55) + 16)\r\n>>> expr.match(sqrt(a + b * sqrt(r)))\r\n{r_: 29, b_: -2, a_: 2*sqrt(-10*sqrt(29) + 55) + 16}\r\n```\r\n\r\nI fixed this problem using `sqrt_depth` to find the depth of `sqrt` in an expression.\r\n\r\nIn this pull request `sqrtdenest`  denests arbitrary denestable square root of a constant and up to \r\nthree square roots of rationals; it also denests some deeply nested radicals.","number":792,"url":"https://api.github.com/repos/sympy/sympy/issues/792","comments":93,"assignee":null},"comment":{"created_at":"2011-12-30T04:40:50Z","user":{"login":"smichr","id":90703,"url":"https://api.github.com/users/smichr","avatar_url":"https://secure.gravatar.com/avatar/61e106a28e171b4407171702b182759f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"61e106a28e171b4407171702b182759f"},"updated_at":"2011-12-30T04:40:50Z","id":3310832,"body":"I've already made the changes and they are in my sqden branch.","url":"https://api.github.com/repos/sympy/sympy/issues/comments/3310832"},"action":"created"}