Ask Your Question
1

`roots` doesn't find all roots of a polynomial

asked 2015-12-07 19:44:44 +0100

marmistrz gravatar image

Let's consider the following example:

w = x^4 - (1+3*i)*x^3 - (2-4*i)*x^2 + (6-2*i)*x - 4 - 4*i
p = x^4 + (1-3*i)*x^3 - (4-3*i)*x^2 - (4-2*i)*x + 2*i
solve(w, x)
w.roots()

When using solve, all complex roots are found. When using roots, only two of them. Why?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-07 21:51:50 +0100

tmonteil gravatar image

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)]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-12-07 19:44:44 +0100

Seen: 7,046 times

Last updated: Dec 07 '15