{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/15413","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/15413/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/15413/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/15413/events","html_url":"https://github.com/sympy/sympy/issues/15413","id":372608533,"node_id":"MDU6SXNzdWUzNzI2MDg1MzM=","number":15413,"title":"rootof fails for polynomial with irrational coefficients","user":{"login":"oscarbenjamin","id":1159732,"node_id":"MDQ6VXNlcjExNTk3MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/1159732?v=4","gravatar_id":"","url":"https://api.github.com/users/oscarbenjamin","html_url":"https://github.com/oscarbenjamin","followers_url":"https://api.github.com/users/oscarbenjamin/followers","following_url":"https://api.github.com/users/oscarbenjamin/following{/other_user}","gists_url":"https://api.github.com/users/oscarbenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarbenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarbenjamin/subscriptions","organizations_url":"https://api.github.com/users/oscarbenjamin/orgs","repos_url":"https://api.github.com/users/oscarbenjamin/repos","events_url":"https://api.github.com/users/oscarbenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/oscarbenjamin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-22T17:04:44Z","updated_at":"2018-11-21T06:11:49Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I found this while looking at #15408 \r\n\r\nThe `rootof` function fails for a polynomial with irrational coefficients over the `EX` and `CC domains:\r\n\r\n```julia\r\nIn [10]: rootof(Poly(sqrt(2)*x**3 + x, x), 0)\r\n...\r\n/space/enojb/current/sympy/sympy/sympy/polys/rootoftools.py in __new__(cls, f, x, index, radicals, expand)\r\n    355 \r\n    356         if not dom.is_ZZ:\r\n--> 357             raise NotImplementedError(\"CRootOf is not supported over %s\" % dom)\r\n    358 \r\n    359         root = cls._indexed_root(poly, index)\r\n\r\nNotImplementedError: CRootOf is not supported over EX\r\n\r\nIn [11]: rootof(Poly(sqrt(2)*x**3 + x, x, domain='CC'), 0)\r\n...\r\n/space/enojb/current/sympy/sympy/sympy/polys/domains/complexfield.py in get_exact(self)\r\n    102     def get_exact(self):\r\n    103         \"\"\"Returns an exact domain associated with ``self``. \"\"\"\r\n--> 104         raise DomainError(\"there is no exact domain associated with %s\" % self)\r\n    105 \r\n    106     def gcd(self, a, b):\r\n\r\nDomainError: there is no exact domain associated with CC\r\n```\r\n\r\nI don't know if either of those should be considered a bug in `rootof` but `roots` can find the roots just fine:\r\n```julia\r\nIn [2]: roots(Poly(sqrt(2)*x**3 + x, x))\r\nOut[2]: \r\n⎧        3/4        4 ___        ⎫\r\n⎪      -2   ⋅ⅈ      ╲╱ 2 ⋅√2⋅ⅈ   ⎪\r\n⎨0: 1, ────────: 1, ──────────: 1⎬\r\n⎪         2             2        ⎪\r\n⎩                                ⎭\r\n```"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/440546271","html_url":"https://github.com/sympy/sympy/issues/15413#issuecomment-440546271","issue_url":"https://api.github.com/repos/sympy/sympy/issues/15413","id":440546271,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDU0NjI3MQ==","user":{"login":"cbm755","id":818622,"node_id":"MDQ6VXNlcjgxODYyMg==","avatar_url":"https://avatars0.githubusercontent.com/u/818622?v=4","gravatar_id":"","url":"https://api.github.com/users/cbm755","html_url":"https://github.com/cbm755","followers_url":"https://api.github.com/users/cbm755/followers","following_url":"https://api.github.com/users/cbm755/following{/other_user}","gists_url":"https://api.github.com/users/cbm755/gists{/gist_id}","starred_url":"https://api.github.com/users/cbm755/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbm755/subscriptions","organizations_url":"https://api.github.com/users/cbm755/orgs","repos_url":"https://api.github.com/users/cbm755/repos","events_url":"https://api.github.com/users/cbm755/events{/privacy}","received_events_url":"https://api.github.com/users/cbm755/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T06:11:49Z","updated_at":"2018-11-21T06:11:49Z","author_association":"CONTRIBUTOR","body":"I'd been a few years since I've understood polynomial domains.\r\n\r\nI'll just note this works in Diofant:\r\n```py\r\n>>> RootOf(Poly(sqrt(2)*x**3 + x, x), 1)\r\n      ⎛  ___  3       ⎞\r\nRootOf⎝╲╱ 2 ⋅x  + x, 1⎠\r\n```\r\nCan someone who knows their polynomials track down their fix and see if its appropriate to cherry-pick it?"}}
{"actor":{"display_login":"cbm755"}}