| 1 | initial version |
The two entities may appear identical when printed, but they are different objects:
k.mod(n) computes the remainder of division and is equivalent to k % n;mod(k,n) creates an object representing the residue class of k modulo n, that is, $k + n\mathbb Z$.Take a look:
sage: ZZ(10).mod(3)
1
sage: type( ZZ(10).mod(3) )
<class 'sage.rings.integer.Integer'>
sage: r = mod(10,3)
1
sage: type( r )
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
sage: r.modulus()
3
sage: r.lift()
1
| 2 | No.2 Revision |
The two entities may appear identical when printed, but they are different objects:
k.mod(n) computes the remainder of division and is equivalent to k % n;mod(k,n) creates an object representing the residue class of k modulo n, that is, $k + n\mathbb Z$.Take a look:
sage: ZZ(10).mod(3)
1
sage: type( ZZ(10).mod(3) )
<class 'sage.rings.integer.Integer'>
sage: r = mod(10,3)
mod(10,3); print(r)
1
sage: type( r )
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
sage: r.modulus()
3
sage: r.lift()
1
| 3 | No.3 Revision |
The two entities may appear identical when printed, but they are different objects:
k.mod(n) computes the (integer) remainder of division and is equivalent to k % n;mod(k,n) creates an object representing the residue class of k modulo n, that is, $k + n\mathbb Z$.Take a look:
sage: ZZ(10).mod(3)
1
sage: type( ZZ(10).mod(3) )
<class 'sage.rings.integer.Integer'>
sage: r = mod(10,3); print(r)
1
sage: type( r )
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
sage: r.modulus()
3
sage: r.lift()
1
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.