Skip to content

Commit 9641eca

Browse files
committed
sorted the roots based only on img part
1 parent 4051446 commit 9641eca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8105,7 +8105,7 @@ cdef class Polynomial(CommutativePolynomial):
81058105
....: f2 = x2^3 - fld_out(2)
81068106
....: for algo in (None, 'pari', 'numpy'):
81078107
....: rts = f.roots(ring=fld_out, multiplicities=False)
8108-
....: rts = sorted(rts, key=lambda x: (x.real(), x.imag()))
8108+
....: rts = sorted(rts, key=lambda x: x.imag())
81098109
....: if fld_in == fld_out and algo is None:
81108110
....: print("{} {}".format(fld_in, rts))
81118111
....: for rt in rts:
@@ -8114,9 +8114,9 @@ cdef class Polynomial(CommutativePolynomial):
81148114
Real Field with 53 bits of precision [1.25992104989487]
81158115
Real Double Field [1.25992104989...]
81168116
Real Field with 100 bits of precision [1.2599210498948731647672106073]
8117-
Complex Field with 53 bits of precision [-0.62996052494743... - 1.09112363597172*I, -0.62996052494743... + 1.09112363597172*I, 1.25992104989487]
8118-
Complex Double Field [-0.629960524947... - 1.0911236359717...*I, -0.629960524947... + 1.0911236359717...*I, 1.25992104989...]
8119-
Complex Field with 100 bits of precision [-0.62996052494743658238360530364 - 1.0911236359717214035600726142*I, -0.62996052494743658238360530364 + 1.0911236359717214035600726142*I, 1.2599210498948731647672106073]
8117+
Complex Field with 53 bits of precision [-0.62996052494743... - 1.09112363597172*I, 1.25992104989487, -0.62996052494743... + 1.09112363597172*I]
8118+
Complex Double Field [-0.629960524947... - 1.091123635971722*I, 1.2599210498948736, -0.629960524947... + 1.0911236359717218*I]
8119+
Complex Field with 100 bits of precision [-0.62996052494743658238360530364 - 1.0911236359717214035600726142*I, 1.2599210498948731647672106073, -0.62996052494743658238360530364 + 1.0911236359717214035600726142*I]
81208120
81218121
Note that we can find the roots of a polynomial with algebraic
81228122
coefficients::

0 commit comments

Comments
 (0)