<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>% -- a binary operator, usually used for remainder and reduction</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_^.html">next</a> | <a href="__sl_sl.html">previous</a> | <a href="_^.html">forward</a> | <a href="__sl_sl.html">backward</a> | <a href="_operators.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_operators.html" title="">operators</a> > <a href="__pc.html" title="a binary operator, usually used for remainder and reduction">%</a></div> <hr/> <div><h1>% -- a binary operator, usually used for remainder and reduction</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>x % y</tt></div> </dd></dl> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>The usual meaning for this operator is remainder, or normal form with respect to a Gröbner basis.<p/> For integers, the remainder is non-negative.<table class="examples"><tr><td><pre>i1 : 1232132141242345 % 1000000 o1 = 242345</pre> </td></tr> <tr><td><pre>i2 : (-4)%5 o2 = 1</pre> </td></tr> </table> <p/> In polynomial rings, the division algorithm is used.<table class="examples"><tr><td><pre>i3 : A = ZZ[a,b] o3 = A o3 : PolynomialRing</pre> </td></tr> <tr><td><pre>i4 : (3*a^3-a*b-4) % (5*a-b) 3 2 o4 = - 2a + a b - a*b - 4 o4 : A</pre> </td></tr> <tr><td><pre>i5 : pseudoRemainder(3*a^3-a*b-4, 5*a-b) 3 2 o5 = 3b - 25b - 500 o5 : A</pre> </td></tr> <tr><td><pre>i6 : B = QQ[a,b] o6 = B o6 : PolynomialRing</pre> </td></tr> <tr><td><pre>i7 : (3*a^3-a*b-4) % (5*a-b) 3 3 1 2 o7 = ---b - -b - 4 125 5 o7 : B</pre> </td></tr> </table> In more complicated situations, Gröbner bases are usually needed. See <a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a>.</div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_remainder.html" title="matrix remainder">remainder</a> -- matrix remainder</span></li> <li><span><a href="_remainder_sq.html" title="matrix quotient and remainder (opposite)">remainder'</a> -- matrix quotient and remainder (opposite)</span></li> <li><span><a href="_pseudo__Remainder.html" title="compute the pseudo-remainder">pseudoRemainder</a> -- compute the pseudo-remainder</span></li> <li><span><a href="__sl_sl.html" title="a binary operator, usually used for quotient">//</a> -- a binary operator, usually used for quotient</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>%</tt> :</h2> <ul><li>CC % CC</li> <li>CC % QQ</li> <li>CC % RR</li> <li>CC % ZZ</li> <li>Number % RingElement</li> <li>QQ % QQ</li> <li>QQ % ZZ</li> <li>RingElement % Number</li> <li>RR % QQ</li> <li>RR % RR</li> <li>RR % ZZ</li> <li>ZZ % GroebnerBasis</li> <li>ZZ % Ideal</li> <li>ZZ % MonomialIdeal</li> <li>ZZ % ZZ</li> <li><span><tt>InexactNumber % RingElement</tt> (missing documentation<!-- tag: (%,InexactNumber,RingElement) -->)</span></li> <li><span><a href="___Matrix_sp_pc_sp__Groebner__Basis.html" title="calculate the normal form of ring elements and matrices using a (partially computed) Gröbner basis">Matrix % GroebnerBasis</a> -- calculate the normal form of ring elements and matrices using a (partially computed) Gröbner basis</span></li> <li><span>RingElement % GroebnerBasis, see <span><a href="___Matrix_sp_pc_sp__Groebner__Basis.html" title="calculate the normal form of ring elements and matrices using a (partially computed) Gröbner basis">Matrix % GroebnerBasis</a> -- calculate the normal form of ring elements and matrices using a (partially computed) Gröbner basis</span></span></li> <li><span>Matrix % Ideal, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>Matrix % Matrix, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>Matrix % Module, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>Matrix % MonomialIdeal, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>Matrix % RingElement, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>RingElement % Ideal, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>RingElement % Matrix, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>RingElement % MonomialIdeal, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span>RingElement % RingElement, see <span><a href="_methods_spfor_spnormal_spforms_spand_spremainder.html" title="calculate the normal form of ring elements and matrices">methods for normal forms and remainder</a> -- calculate the normal form of ring elements and matrices</span></span></li> <li><span><tt>RingElement % InexactNumber</tt> (missing documentation<!-- tag: (%,RingElement,InexactNumber) -->)</span></li> </ul> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="__pc.html" title="a binary operator, usually used for remainder and reduction">%</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p> <div><div><p>This operator may be used as a binary operator in an expression like <tt>x%y</tt>. The user may install <a href="_binary_spmethods.html" title="">binary methods</a> for handling such expressions with code such as</p> <pre> X % Y := (x,y) -> ...</pre> <p>where <tt>X</tt> is the class of <tt>x</tt> and <tt>Y</tt> is the class of <tt>y</tt>.</p> </div> </div> </div> </div> </body> </html>