Repository: sympy/sympy

Issue:
ValueError: solve((1 - x - I)**4, x)
```
>>> solve((1 - x - I)**4, x)
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    print(solve(e, x))
  File "/home/eward/se/sympy/solvers/solvers.py", line 1178, in solve
    solution = _solve(f[0], *symbols, **flags)
  File "/home/eward/se/sympy/solvers/solvers.py", line 1661, in _solve
    soln = roots(poly, **solvers)
  File "/home/eward/se/sympy/polys/polyroots.py", line 1017, in roots
    for currentroot in _try_decompose(f):
  File "/home/eward/se/sympy/polys/polyroots.py", line 915, in _try_decompose
    for currentroot in _try_heuristics(factors[0]):
  File "/home/eward/se/sympy/polys/polyroots.py", line 961, in _try_heuristics
    result += roots_quartic(f)
  File "/home/eward/se/sympy/polys/polyroots.py", line 315, in roots_quartic
    roots([1, e, g], multiple=True)]
ValueError: not enough values to unpack (expected 2, got 1)
```

Since [1, e, g] is a quadratic, `roots_quartic` is expecting two results on line 315. `roots` does not behave as expected if `e` is not expanded first:

```
>>> e = -12*I - 3*(-4 + 4*I)**2/8
>>> expand(e)
0
>>> roots([1, e, 0], multiple=True)
[0]
>>> roots([1, expand(e), 0], multiple=True)
[0, 0]
```

Discussion:
sympy-bot: :white_check_mark:

Hi, I am the [SymPy bot](https://github.com/sympy/sympy-bot) (v147). I'm here to help you write a release notes entry. Please read the [guide on how to write release notes](https://github.com/sympy/sympy/wiki/Writing-Release-Notes).



Your release notes are in good order.

Here is what the release notes will look like:
* polys
  * Fixed issue with solving quartic polynomial with complex coefficients. ([#17482](https://github.com/sympy/sympy/pull/17482) by [@oscargus](https://github.com/oscargus))

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. <details><summary>Click here to see the pull request description that was parsed.</summary>

    <!-- Your title above should be a short description of what
    was changed. Do not include the issue number in the title. -->

    #### References to other Issues or PRs
    <!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
    format, e.g. "Fixes #1234". See
    https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
    write a comment on that issue linking back to this pull request once it is
    open. -->

    Fixes #17454 

    #### Brief description of what is fixed or changed
    Added `_mexpand` at a carefully selected position (thanks @ethankward ).

    #### Other comments
    I also speculatively added a few more `_mexpand` and removed some redundant computations (not restoring the previously `_mexpand`:ed result). All tests seems to pass, but for `solve(((1 - x - sqrt(2)*I)**3*(1 + x - sqrt(2)*I)).expand(), x)` the results went from:
    ```
    [Piecewise((1/2 - sqrt(2)*I/2 - sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2 - sqrt((-2 + 2*sqrt(2)*I)**2/2 + (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3)) + 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2, Eq(7 - 4*sqrt(2)*I + 3*(-2 + 2*sqrt(2)*I)**4/256 - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256), 0)), (1/2 - sqrt(2)*I/2 - sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)))/2 - sqrt((-2 + 2*sqrt(2)*I)**2/2 + (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))) + 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)) - 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))/2, True)),
     Piecewise((1/2 - sqrt(2)*I/2 + sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2 - sqrt((-2 + 2*sqrt(2)*I)**2/2 + 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3) - (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3)))/2, Eq(7 - 4*sqrt(2)*I + 3*(-2 + 2*sqrt(2)*I)**4/256 - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256), 0)), (1/2 - sqrt(2)*I/2 + sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)))/2 - sqrt((-2 + 2*sqrt(2)*I)**2/2 + 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)) - 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))))/2, True)),
     Piecewise((1/2 - sqrt(2)*I/2 + sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2 + sqrt((-2 + 2*sqrt(2)*I)**2/2 + 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3) - (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3)))/2, Eq(7 - 4*sqrt(2)*I + 3*(-2 + 2*sqrt(2)*I)**4/256 - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256), 0)), (1/2 - sqrt(2)*I/2 + sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)))/2 + sqrt((-2 + 2*sqrt(2)*I)**2/2 + 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)) - 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))))/2, True)),
     Piecewise((1/2 + sqrt((-2 + 2*sqrt(2)*I)**2/2 + (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3)) + 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2 - sqrt(2)*I/2 - sqrt((-2 + 2*sqrt(2)*I)**2/4 - 2*(-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**(1/3))/2, Eq(7 - 4*sqrt(2)*I + 3*(-2 + 2*sqrt(2)*I)**4/256 - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256), 0)), (1/2 + sqrt((-2 + 2*sqrt(2)*I)**2/2 + (-20 - 4*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/4)/sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))) + 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)) - 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3))/2 - sqrt(2)*I/2 - sqrt((-2 + 2*sqrt(2)*I)**2/4 + 2*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3) - 2*(-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)/(3*((-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/16 - (-2 + 2*sqrt(2)*I)**6/4096 + sqrt((-7 + (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256) - 3*(-2 + 2*sqrt(2)*I)**4/256 + 4*sqrt(2)*I)**3/27 + (-(-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/8 + (-2 + 2*sqrt(2)*I)**6/2048 - (-2 + 2*sqrt(2)*I)**2*(7 - 4*sqrt(2)*I - (-2 + 2*sqrt(2)*I)*(-5/2 - sqrt(2)*I/2 + 3*(-2 + 2*sqrt(2)*I)**3/256))/8)**2/4) + (-10 - 2*sqrt(2)*I + (-2 + 2*sqrt(2)*I)**3/8)**2/16)**(1/3)))/2, True))]
    ```
    to

    ```
    [1/2 - sqrt(2)*I/2 - sqrt(-1 - 2*sqrt(2)*I)/2 - sqrt(-2 - 4*sqrt(2)*I - 10/sqrt(-1 - 2*sqrt(2)*I) - 2*sqrt(2)*I/sqrt(-1 - 2*sqrt(2)*I))/2,
     1/2 - sqrt(2)*I/2 + sqrt(-1 - 2*sqrt(2)*I)/2 - sqrt(-2 - 4*sqrt(2)*I + 2*sqrt(2)*I/sqrt(-1 - 2*sqrt(2)*I) + 10/sqrt(-1 - 2*sqrt(2)*I))/2,
     1/2 - sqrt(2)*I/2 + sqrt(-1 - 2*sqrt(2)*I)/2 + sqrt(-2 - 4*sqrt(2)*I + 2*sqrt(2)*I/sqrt(-1 - 2*sqrt(2)*I) + 10/sqrt(-1 - 2*sqrt(2)*I))/2,
     1/2 + sqrt(-2 - 4*sqrt(2)*I - 10/sqrt(-1 - 2*sqrt(2)*I) - 2*sqrt(2)*I/sqrt(-1 - 2*sqrt(2)*I))/2 - sqrt(2)*I/2 - sqrt(-1 - 2*sqrt(2)*I)/2]
    ```
    and at least for this example it is much faster, despite spending time with `_mexpand`.

    #### Release Notes

    <!-- Write the release notes for this release below. See
    https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
    on how to write release notes. The bot will check your release notes
    automatically to see if they are formatted correctly. -->

    <!-- BEGIN RELEASE NOTES -->
    * polys
        * Fixed issue with solving quartic polynomial with complex coefficients.
    <!-- END RELEASE NOTES -->


</details><p>

ethankward: What about the underlying issue where `roots` only returns 1 value?
oscargus: I've fixed that as well now. Turned out that the polynomial should have any zero roots after a while, but with "complicated" coefficients eventually simplifying to zero those were not properly stored.
codecov[bot]: # [Codecov](https://codecov.io/gh/sympy/sympy/pull/17482?src=pr&el=h1) Report
> Merging [#17482](https://codecov.io/gh/sympy/sympy/pull/17482?src=pr&el=desc) into [master](https://codecov.io/gh/sympy/sympy/commit/0f0939e4fa0d18ad392a468c0082c75b1a868fd1?src=pr&el=desc) will **increase** coverage by `9.311%`.
> The diff coverage is `85%`.

```diff
@@              Coverage Diff              @@
##            master    #17482       +/-   ##
=============================================
+ Coverage   65.397%   74.708%   +9.311%     
=============================================
  Files          632       632               
  Lines       164357    164357               
  Branches     38579     38581        +2     
=============================================
+ Hits        107485    122789    +15304     
+ Misses       50782     36182    -14600     
+ Partials      6090      5386      -704
```

oscargus: I removed the `_mexpand`s since it is the general problem with this. For some expressions it gets better (as the one above), but for some, originally simple expressions, it gets worse.

Still, a  bit of cleanup of redundant operations etc and the bug is fixed without the need to expand.
oscarbenjamin: Like the associated issue #17454 this doesn't need to hold up the 1.5 release.
czgdp1807: It looks like the PR successfully fixes the associated issue. @oscargus If you don't mind, can I continue this in a new PR?
czgdp1807: ping @oscargus 
oscarbenjamin: Note the comment here: https://github.com/sympy/sympy/pull/17482#discussion_r319374900

Patch:
diff --git a/sympy/polys/polyroots.py b/sympy/polys/polyroots.py
index d47e348526..d2d2ee7e79 100644
--- a/sympy/polys/polyroots.py
+++ b/sympy/polys/polyroots.py
@@ -122,7 +122,7 @@ def roots_cubic(f, trig=False):
     """
     if trig:
         a, b, c, d = f.all_coeffs()
-        p = (3*a*c - b**2)/3/a**2
+        p = (3*a*c - b**2)/(3*a**2)
         q = (2*b**3 - 9*a*b*c + 27*a**2*d)/(27*a**3)
         D = 18*a*b*c*d - 4*b**3*d + b**2*c**2 - 4*a*c**3 - 27*a**2*d**2
         if (D > 0) == True:
@@ -161,11 +161,11 @@ def roots_cubic(f, trig=False):
         u1 = S.One
         u2 = Rational(-1, 2) + coeff
         u3 = Rational(-1, 2) - coeff
-        a, b, c, d = S(1), a, b, c
-        D0 = b**2 - 3*a*c
-        D1 = 2*b**3 - 9*a*b*c + 27*a**2*d
+        b, c, d = a, b, c  # a, b, c, d = S.One, a, b, c
+        D0 = b**2 - 3*c  # b**2 - 3*a*c
+        D1 = 2*b**3 - 9*b*c + 27*d  # 2*b**3 - 9*a*b*c + 27*a**2*d
         C = root((D1 + sqrt(D1**2 - 4*D0**3))/2, 3)
-        return [-(b + uk*C + D0/C/uk)/3/a for uk in [u1, u2, u3]]
+        return [-(b + uk*C + D0/C/uk)/3 for uk in [u1, u2, u3]]  # -(b + uk*C + D0/C/uk)/3/a
 
     u2 = u1*(Rational(-1, 2) + coeff)
     u3 = u1*(Rational(-1, 2) - coeff)
@@ -306,14 +306,14 @@ def roots_quartic(f):
         a2 = a**2
         e = b - 3*a2/8
         f = _mexpand(c + a*(a2/8 - b/2))
-        g = _mexpand(d - a*(a*(3*a2/256 - b/16) + c/4))
         aon4 = a/4
+        g = _mexpand(d - aon4*(a*(3*a2/64 - b/4) + c))
 
-        if f is S.Zero:
+        if f.is_zero:
             y1, y2 = [sqrt(tmp) for tmp in
                       roots([1, e, g], multiple=True)]
             return [tmp - aon4 for tmp in [-y1, -y2, y1, y2]]
-        if g is S.Zero:
+        if g.is_zero:
             y = [S.Zero] + roots([1, 0, e, f], multiple=True)
             return [tmp - aon4 for tmp in y]
         else:
@@ -322,10 +322,6 @@ def roots_quartic(f):
             if sols:
                 return sols
             # Ferrari method, see [1, 2]
-            a2 = a**2
-            e = b - 3*a2/8
-            f = c + a*(a2/8 - b/2)
-            g = d - a*(a*(3*a2/256 - b/16) + c/4)
             p = -e**2/12 - g
             q = -e**3/108 + e*g/3 - f**2/8
             TH = Rational(1, 3)
@@ -362,7 +358,7 @@ def _ans(y):
 
             # sort it out once they know the values of the coefficients
             return [Piecewise((a1, Eq(p, 0)), (a2, True))
-                for a1, a2 in zip(_ans(y1), _ans(y2))]
+                    for a1, a2 in zip(_ans(y1), _ans(y2))]
 
 
 def roots_binomial(f):
@@ -549,12 +545,12 @@ def roots_quintic(f):
     disc_bar = alpha_bar**2 - 4*beta_bar
 
     l0 = quintic.l0(theta)
+    Stwo = S(2)
+    l1 = _quintic_simplify((-alpha + sqrt(disc)) / Stwo)
+    l4 = _quintic_simplify((-alpha - sqrt(disc)) / Stwo)
 
-    l1 = _quintic_simplify((-alpha + sqrt(disc)) / S(2))
-    l4 = _quintic_simplify((-alpha - sqrt(disc)) / S(2))
-
-    l2 = _quintic_simplify((-alpha_bar + sqrt(disc_bar)) / S(2))
-    l3 = _quintic_simplify((-alpha_bar - sqrt(disc_bar)) / S(2))
+    l2 = _quintic_simplify((-alpha_bar + sqrt(disc_bar)) / Stwo)
+    l3 = _quintic_simplify((-alpha_bar - sqrt(disc_bar)) / Stwo)
 
     order = quintic.order(theta, d)
     test = (order*delta.n()) - ( (l1.n() - l4.n())*(l2.n() - l3.n()) )
@@ -915,7 +911,12 @@ def roots(f, *gens,
         if f.is_multivariate:
             raise PolynomialError('multivariate polynomials are not supported')
 
-    def _update_dict(result, currentroot, k):
+    def _update_dict(result, zeros, currentroot, k):
+        if currentroot == S.Zero:
+            if S.Zero in zeros:
+                zeros[S.Zero] += k
+            else:
+                zeros[S.Zero] = k
         if currentroot in result:
             result[currentroot] += k
         else:
@@ -1006,18 +1007,18 @@ def _try_heuristics(f):
         dom = f.get_domain()
         if not dom.is_Exact and dom.is_Numerical:
             for r in f.nroots():
-                _update_dict(result, r, 1)
+                _update_dict(result, zeros, r, 1)
         elif f.degree() == 1:
-            result[roots_linear(f)[0]] = 1
+            _update_dict(result, zeros, roots_linear(f)[0], 1)
         elif f.length() == 2:
             roots_fun = roots_quadratic if f.degree() == 2 else roots_binomial
             for r in roots_fun(f):
-                _update_dict(result, r, 1)
+                _update_dict(result, zeros, r, 1)
         else:
             _, factors = Poly(f.as_expr()).factor_list()
             if len(factors) == 1 and f.degree() == 2:
                 for r in roots_quadratic(f):
-                    _update_dict(result, r, 1)
+                    _update_dict(result, zeros, r, 1)
             else:
                 if len(factors) == 1 and factors[0][1] == 1:
                     if f.get_domain().is_EX:
@@ -1030,17 +1031,17 @@ def _try_heuristics(f):
                             result = roots(f)
                             if not result:
                                 for currentroot in _try_decompose(f):
-                                    _update_dict(result, currentroot, 1)
+                                    _update_dict(result, zeros, currentroot, 1)
                         else:
                             for r in _try_heuristics(f):
-                                _update_dict(result, r, 1)
+                                _update_dict(result, zeros, r, 1)
                     else:
                         for currentroot in _try_decompose(f):
-                            _update_dict(result, currentroot, 1)
+                            _update_dict(result, zeros, currentroot, 1)
                 else:
                     for currentfactor, k in factors:
                         for r in _try_heuristics(Poly(currentfactor, f.gen, field=True)):
-                            _update_dict(result, r, k)
+                            _update_dict(result, zeros, r, k)
 
     if coeff is not S.One:
         _result, result, = result, {}


Test patch:
diff --git a/sympy/polys/tests/test_polyroots.py b/sympy/polys/tests/test_polyroots.py
index f8c0611cde..56a61e5ad6 100644
--- a/sympy/polys/tests/test_polyroots.py
+++ b/sympy/polys/tests/test_polyroots.py
@@ -710,3 +710,7 @@ def test_roots_composite():
 def test_issue_19113():
     eq = cos(x)**3 - cos(x) + 1
     raises(PolynomialError, lambda: roots(eq))
+
+
+def test_issue_17454():
+    assert roots([1, -3*(-4 - 4*I)**2/8 + 12*I, 0], multiple=True) == [0, 0]
diff --git a/sympy/solvers/tests/test_solvers.py b/sympy/solvers/tests/test_solvers.py
index 7dbc09582b..c2100197c6 100644
--- a/sympy/solvers/tests/test_solvers.py
+++ b/sympy/solvers/tests/test_solvers.py
@@ -2382,6 +2382,11 @@ def test_issue_6819():
     assert solve(a*b**x - c*d**x, x) == [log(c/a)/log(b/d)]
 
 
+def test_issue_17454():
+    x = Symbol('x')
+    assert solve((1 - x - I)**4, x) == [1 - I]
+
+
 def test_issue_21852():
     solution = [21 - 21*sqrt(2)/2]
     assert solve(2*x + sqrt(2*x**2) - 21) == solution