1 | initial version |
As you can see with the documentation of the roots()
method, (which you can get by typing w.roots?
), " Not all roots are guaranteed to be found.". But you can also set a ring
option to tell that the symbolic expression should be considered as a polynomial over the given ring, and find roots which belong to that ring. You can get all root by chosing the albebraic numbers for the ring:
sage: w.roots(ring=QQbar)
[(-1 + 1*I, 1), (2*I, 1), (1 - 1*I, 1), (1 + 1*I, 1)]
Or numerically, with the complex double field:
sage: w.roots(ring=CDF)
[(-1.0000000000000002 + 1.0000000000000004*I, 1),
(-1.473610092985238e-15 + 2.000000000000001*I, 1),
(1.0000000000000004 - 0.9999999999999997*I, 1),
(1.0000000000000018 + 1.0000000000000038*I, 1)]