1 | initial version |
Defining the function you need only takes a few lines:
def all_complex_roots(a, n):
"""
Return all complex `n`-th roots of `a`.
"""
x = polygen(QQbar)
return (x^n - a).roots(multiplicities=False)
It is then ready to be used!
sage: all_complex_roots(1, 4)
[-1, 1, -1*I, 1*I]