next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > operators > %

% -- a binary operator, usually used for remainder and reduction

Synopsis

Description

The usual meaning for this operator is remainder, or normal form with respect to a Groebner basis.

For integers, the remainder is non-negative.

i1 : 1232132141242345 % 3457834

o1 = 1249597
i2 : (-4)%5

o2 = 1

In polynomial rings, the division algorithm is used.

i3 : A = ZZ[a,b]

o3 = A

o3 : PolynomialRing
i4 : (3*a^3-a*b-4) % (5*a-b)

         3    2
o4 = - 2a  + a b - a*b - 4

o4 : A
i5 : pseudoRemainder(3*a^3-a*b-4, 5*a-b)

       3      2
o5 = 3b  - 25b  - 500

o5 : A
i6 : B = QQ[a,b]

o6 = B

o6 : PolynomialRing
i7 : (3*a^3-a*b-4) % (5*a-b)

      3   3   1  2
o7 = ---*b  - -*b  - 4
     125      5

o7 : B
In more complicated situations, Groebner bases are usually needed. See methods for normal forms and remainder.

See also

Ways to use % :

For the programmer

The object % is a keyword.

This operator may be used as a binary operator in an expression like x%y. The user may install binary methods for handling such expressions with code such as
         X % Y := (x,y) -> ...
where X is the class of x and Y is the class of y.