{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/11745","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/11745/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/11745/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/11745/events","html_url":"https://github.com/sympy/sympy/issues/11745","id":183815131,"number":11745,"title":"TypeError: __new__() missing 1 required positional argument: 'cond' with solve","user":{"login":"asmeurer","id":71486,"avatar_url":"https://avatars.githubusercontent.com/u/71486?v=3","gravatar_id":"","url":"https://api.github.com/users/asmeurer","html_url":"https://github.com/asmeurer","followers_url":"https://api.github.com/users/asmeurer/followers","following_url":"https://api.github.com/users/asmeurer/following{/other_user}","gists_url":"https://api.github.com/users/asmeurer/gists{/gist_id}","starred_url":"https://api.github.com/users/asmeurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmeurer/subscriptions","organizations_url":"https://api.github.com/users/asmeurer/orgs","repos_url":"https://api.github.com/users/asmeurer/repos","events_url":"https://api.github.com/users/asmeurer/events{/privacy}","received_events_url":"https://api.github.com/users/asmeurer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sympy/sympy/labels/solvers","name":"solvers","color":"0000FF"},{"url":"https://api.github.com/repos/sympy/sympy/labels/solvers.solve","name":"solvers.solve","color":"0000FF"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-18T22:03:58Z","updated_at":"2016-10-23T07:25:59Z","closed_at":null,"body":"Reported at https://stackoverflow.com/questions/40082924/error-when-using-sympys-solver-on-polynomials-with-complex-coefficients-4th-de\r\n\r\n```\r\nimport sympy as sym\r\nfrom sympy import I\r\nsym.init_printing()\r\n\r\nk = sym.Symbol('k')\r\nt, sigma ,k0, L , V = sym.symbols('t, sigma, k0, L,V')\r\n\r\nx4 = ( -t**2 + 2*I * t / sigma**2 + 1/sigma**4)\r\nx3 = ( -2*I * t * k0 / sigma**2 - 2*k0 / sigma**4)\r\nx2 = ( L**2 + k0 **2 / sigma **4 + t**2 * V - 2 * I * t * V / sigma**2 -V/sigma**4)\r\nx1 = (2*I * V * k0 / sigma**2 + 2*k0 * V / sigma **4)\r\nx0 = (2*I*k0*t*V / sigma**2 - k0 **2 *V / sigma**4)\r\n\r\nexpr = x4 * k**4 + x3 * k**3 + x2 * k**2 + x1 * k + x0\r\nexpr2 = expr.subs({k0 :2 , sigma : .2 , L : 1, V:1})\r\n\r\nsym.solvers.solve(expr2,k)\r\n```\r\n\r\ngives\r\n\r\n```\r\nTraceback (most recent call last):\r\n\r\n  File \"<ipython-input-4-e1ce7d8c9531>\", line 1, in <module>\r\n    sols = sym.solvers.solve(expr2,k)\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/solvers    /solvers.py\", line 1125, in solve\r\n    solution = nfloat(solution, exponent=False)\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/function.py\",     line 2465, in nfloat\r\n    return type(expr)([nfloat(a, n, exponent) for a in expr])\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/function.py\",     line 2499, in nfloat\r\n    lambda x: isinstance(x, Function)))\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/basic.py\",     line 1087, in xreplace\r\n    value, _ = self._xreplace(rule)\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/basic.py\",     line 1095, in _xreplace\r\n    return rule[self], True\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/rules.py\",     line 59, in __getitem__\r\n    return self._transform(key)\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/function.py\",     line 2498, in <lambda>\r\n    lambda x: x.func(*nfloat(x.args, n, exponent)),\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/function.py\",     line 2465, in nfloat\r\n    return type(expr)([nfloat(a, n, exponent) for a in expr])\r\n\r\n  File \"/usr/local/lib/python2.7/dist-packages/sympy/core/function.py\",     line 2465, in nfloat\r\n    return type(expr)([nfloat(a, n, exponent) for a in expr])\r\n\r\nTypeError: __new__() takes exactly 3 arguments (2 given)\r\n```\r\n\r\nIn Python 3 the error is\r\n\r\n```\r\nTypeError: __new__() missing 1 required positional argument: 'cond'\r\n```\r\n\r\nwhich suggests that the object is a Piecewise. The code in question should be using `expr.func` instead of `type(expr)`, but even then, it isn't passing in the `args` correctly. "},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/255573810","html_url":"https://github.com/sympy/sympy/issues/11745#issuecomment-255573810","issue_url":"https://api.github.com/repos/sympy/sympy/issues/11745","id":255573810,"user":{"login":"asmeurer","id":71486,"avatar_url":"https://avatars.githubusercontent.com/u/71486?v=3","gravatar_id":"","url":"https://api.github.com/users/asmeurer","html_url":"https://github.com/asmeurer","followers_url":"https://api.github.com/users/asmeurer/followers","following_url":"https://api.github.com/users/asmeurer/following{/other_user}","gists_url":"https://api.github.com/users/asmeurer/gists{/gist_id}","starred_url":"https://api.github.com/users/asmeurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmeurer/subscriptions","organizations_url":"https://api.github.com/users/asmeurer/orgs","repos_url":"https://api.github.com/users/asmeurer/repos","events_url":"https://api.github.com/users/asmeurer/events{/privacy}","received_events_url":"https://api.github.com/users/asmeurer/received_events","type":"User","site_admin":false},"created_at":"2016-10-23T07:25:59Z","updated_at":"2016-10-23T07:25:59Z","body":"Yes. "}}
{"actor":{"display_login":"asmeurer"}}