Opened 4 years ago

Closed 4 years ago

#23998 closed defect (duplicate)

Incorrect division

Reported by: pkoprowski Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: number fields Keywords: euclidean division, number field
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Sage incorrectly perform division in (euclidean) rings of algebraic integers. Take:

K.<theta> = QuadraticField(-3)
R = K.OK()

Then $R = \mathbb{Z}\bigl[\frac{1+\sqrt{-3}}{2}\bigr]$ is an Euclidean ring, hence admits division with remainder. Let us take two elements of $R$:

a = R(508*theta); print "a =", a
b = R(1-33*theta); print "b =", b

and divide them:

r = a.mod(b); print "r =", r

The result is $r = 508*\sqrt{-3} = a$ and this is purely wrong as the norms are

print "N(r) =", r.norm()
print "N(b) =", b.norm()

$N(r) = 774192$ and $N(b) = 3268$.

On the other hand, Magma performs the division properly

K<theta> := QuadraticField(-3);
R := RingOfIntegers(K);
a := R!(508*theta); print "a =", a;
b := R!(1-33*theta); print "b =", b;
print "r = ", a mod b;

and returns r = 26*$.2 + 2. Here $.2 is the generator of $R$.

Change History (2)

comment:1 Changed 4 years ago by jdemeyer

Looks like a duplicate of #23971.

comment:2 Changed 4 years ago by jdemeyer

  • Milestone changed from sage-8.1 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.