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

// -- a binary operator, usually used for quotient

Synopsis

Description

For ring elements in the integers, polynomial rings, and other rings, there are two types of division: exact division, whose result is often in a larger field, such as the rationals or a function field, and division with remainder, whose result is in the same ring. In Macaulay2, '/' denotes the first kind of division, while '//' denotes the latter kind. The following example shows the difference between // and /.
i1 : 4/2

o1 = 2

o1 : QQ
i2 : 4//2

o2 = 2
i3 : R = QQ[x];
i4 : (x^2-3)//(x-1)

o4 = x + 1

o4 : R
i5 : (x^2-3)%(x-1)

o5 = -2

o5 : R
i6 : (x^2-3)/(x-1)

      2
     x  - 3
o6 = ------
      x - 1

o6 : frac(R)

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.