<commit_before><html>
  <head>

    <title>
Tutorial
    </title>
  </head>
<body>
<p>        In this tutorial we introduce a number
        of basic operations using Gröbner bases, and
        at the same time become familiar with a range
        of useful Macaulay2 constructs. The sections are:
        
        A.  First steps; example with a monomial curve
        
        B.  Random regular sequences
        
        C.  Division with remainder
        
        D.  Elimination theory
        
        E.  Quotients and saturation</p>
<div>
    <h4>A. First Steps; example with a monomial curve</h4>
<p>        To compute the Gröbner basis of an ideal
        <i>(x<sup>2</sup>y,xy<sup>2</sup>+x<sup>3</sup>)</i> in the polynomial ring in
        four variables we proceed as follows:
        
        Our favorite field</p>
        <code>KK = ZZ/31991</code><br>
<p>        The polynomial ring</p>
        <code>R = KK[x,y,z,w]</code><br>
<p>        and the ideal</p>
        <code>I = ideal(x^2*y,x*y^2+x^3)</code><br>
<p>        now the punch line:</p>
        <code>J = gens gb I</code><br>
<p>        From this we can for example compute the
        codimension, dimension,
        degree, and the whole Hilbert
        function and polynomial.  
        This will be more fun if we work with an
        example having some meaning.  We choose
        to work with the ideal defining the
        rational quartic curve in <i><b>P</b><sup>3</sup></i> given
        parametrically in an affine representation
        by 
        <p align=center><i>t ↦ (t,t<sup>3</sup>,t<sup>4</sup>).</i></p>
        (The reader who doesn&rsquo;t understand this
        terminology may ignore it for the moment,
        and treat the ideal given below as a 
        gift from the gods... .)
        We obtain the ideal by first making the 
        polynomial ring in 4 variables (the
        homogeneous coordinate ring of <i><b>P</b><sup>3</sup></i>)</p>
        <code>R = KK[a..d]</code><br>
<p>        and then using a function <tt>monomialCurveIdeal</tt>, which we shall
        treat for now as a black box</p>
        <code>I = monomialCurveIdeal(R,{1,3,4})</code><br>
<p>        From Macaulay2&rsquo;s point of view, <i>I</i> is an
        ideal, and the codimension of its support
        is 2, while its dimension is 2:</p>
        <code>codim I</code><br>
        <code>dim I</code><br>
<p>        This is the codimension of <i>R/I</i> in <i>R</i> 
        and the dimension of <i>R/I</i>.  We could work with
        the module <i>R/I</i> as well.
        Precision requires writing <i>R<sup>1</sup></i> instead
        of <i>R</i> (<i>R</i> is a ring, and <i>R<sup>1</sup></i> is
        the free module of rank 1 over it)</p>
        <code>codim (R^1/(I*R^1))</code><br>
<p>        We could also extract the generators of
        <i>I</i> (as a matrix) and take the cokernel to
        get the same thing:</p>
        <code>M = coker gens I</code><br>
        <code>codim M</code><br>
        <code>dim M</code><br>
<p>        And similarly for the degree:</p>
        <code>degree I</code><br>
        <code>degree M</code><br>
<p>        As one might expect, the degree of the quartic
        is 4 !
        
        The Hilbert polynomial is obtained by</p>
        <code>hilbertPolynomial M</code><br>
<p>        The term <i><b>P</b><sup>i</sup></i> represents the Hilbert polynomial of
        projective <i>i</i>-space.  This formula tells
        us that the Hilbert polynomial of <i>M</i> is
        <i>H(m) = 4(m+1) - 3 = 4m + 1</i>.  Thus the degree
        is four, the dimension of the projective variety
        which is the support of <i>M</i> is 1 (and so the affine
        dimension is 2),
        and that the (arithmetic) genus is 0 (1 minus the
        constant term, for curves).
        
        The Hilbert series of <i>M</i> (the generating function
        for the dimensions of the graded pieces of <i>M</i>) is</p>
        <code>hilbertSeries M</code><br>
<p>        The indeterminate in this expression is $T.
        
        Another way to get information about
        the module <i>M</i> is to see its free resolution</p>
        <code>Mres = res M</code><br>
<p>        To get more precise information about <tt>Mres</tt>,
        we could do</p>
        <code>betti Mres</code><br>
<p>        The display is chosen for compactness:
        B    total: 1 4 4 1
        B        0: 1 . . .
        B        1: . 1 . .
        B        2: . 3 4 1
        the first line gives the total betti 
        numbers, the same information given when
        we type the resolution.  The remaining
        lines express the degrees of each of the
        generators of the free modules in the
        resolution.  The <i>j</i>th column after the colons
        gives the degrees of generators of the
        <i>j</i>th module(counting from <i>0</i>); 
        an <i>n</i> in the <i>j</i>th column in the
        row headed by &ldquo;<i>d</i>:&rdquo; means that the <i>j</i>th
        free module has <i>n</i> generators of degree
        <i>n+j</i>.  Thus for example in our case, the
        generator of the third (last) free module in the
        resolution has degree <i>3+2=5</i>.</p>
</div>
<div>
    <h4>B. Random regular sequences</h4>
<p>        An interesting and illustrative open problem
        is to understand the initial ideal (and 
        the Gröbner basis) of a &ldquo;generic&rdquo; <commit_msg>made changes to the Groebner tutorial.  BUT did NOT change the input files in tutorials/<commit_after><html>
  <head>

    <title>
Elementary uses of Groebner bases
    </title>
  </head>
<body>
<div>
    <h4>A. First Steps; example with a monomial curve</h4>
<p>        In this tutorial we introduce a number
        of basic operations using Gröbner bases, and
        at the same time become familiar with a range
        of useful Macaulay2 constructs. The sections are:
        
/p>
  <p>        To compute the Gröbner basis of an ideal
        <i>(x<sup>2</sup>y,xy<sup>2</sup>+x<sup>3</sup>)</i> in the polynomial ring in
        four variables we proceed as follows:
        
        Our favorite field</p>
        <code>KK = ZZ/31991</code><br>
<p>        The polynomial ring</p>
        <code>R = KK[x,y,z,w]</code><br>
<p>        and the ideal</p>
        <code>I = ideal(x^2*y,x*y^2+x^3)</code><br>
<p>        now the punch line:</p>
        <code>J = gens gb I</code><br>
<p>        From this we can for example compute the
        codimension, dimension,
        degree, and the whole Hilbert
        function and polynomial.  
        This will be more fun if we work with an
        example having some meaning.  We choose
        to work with the ideal defining the
        rational quartic curve in <i><b>P</b><sup>3</sup></i> given
        parametrically in an affine representation
        by 
        <p align=center><i>t ↦ (t,t<sup>3</sup>,t<sup>4</sup>).</i></p>
        (The reader who doesn&rsquo;t understand this
        terminology may ignore it for the moment,
        and treat the ideal given below as a 
        gift from the gods... .)
        We obtain the ideal by first making the 
        polynomial ring in 4 variables (the
        homogeneous coordinate ring of <i><b>P</b><sup>3</sup></i>)</p>
        <code>R = KK[a..d]</code><br>
<p>        and then using a function <tt>monomialCurveIdeal</tt>, which we shall
        treat for now as a black box</p>
        <code>I = monomialCurveIdeal(R,{1,3,4})</code><br>
<p>        From Macaulay2&rsquo;s point of view, <i>I</i> is an
        ideal, and the codimension of its support
        is 2, while its dimension is 2:</p>
        <code>codim I</code><br>
        <code>dim I</code><br>
<p>        This is the codimension of <i>R/I</i> in <i>R</i> 
        and the dimension of <i>R/I</i>.  We could work with
        the module <i>R/I</i> as well.
        Precision requires writing <i>R<sup>1</sup></i> instead
        of <i>R</i> (<i>R</i> is a ring, and <i>R<sup>1</sup></i> is
        the free module of rank 1 over it)</p>
        <code>codim (R^1/(I*R^1))</code><br>
<p>        We could also extract the generators of
        <i>I</i> (as a matrix) and take the cokernel to
        get the same thing:</p>
        <code>M = coker gens I</code><br>
        <code>codim M</code><br>
        <code>dim M</code><br>
<p>        And similarly for the degree:</p>
        <code>degree I</code><br>
        <code>degree M</code><br>
<p>        As one might expect, the degree of the quartic
        is 4 !
        
        The Hilbert polynomial is obtained by</p>
        <code>hilbertPolynomial M</code><br>
<p>        The term <i><b>P</b><sup>i</sup></i> represents the Hilbert polynomial of
        projective <i>i</i>-space.  This formula tells
        us that the Hilbert polynomial of <i>M</i> is
        <i>H(m) = 4(m+1) - 3 = 4m + 1</i>.  Thus the degree
        is four, the dimension of the projective variety
        which is the support of <i>M</i> is 1 (and so the affine
        dimension is 2),
        and that the (arithmetic) genus is 0 (1 minus the
        constant term, for curves).
        
        The Hilbert series of <i>M</i> (the generating function
        for the dimensions of the graded pieces of <i>M</i>) is</p>
        <code>hilbertSeries M</code><br>
<p>        The indeterminate in this expression is $T.
        
        Another way to get information about
        the module <i>M</i> is to see its free resolution</p>
        <code>Mres = res M</code><br>
<p>        To get more precise information about <tt>Mres</tt>,
        we could do</p>
        <code>betti Mres</code><br>
<p>        The output displayed is chosen for compactness:
        the first line gives the total betti 
        numbers, the same information given when
        we type the resolution.  The remaining
        lines express the degrees of each of the
        generators of the free modules in the
        resolution.  The <i>j</i>th column after the colons
        gives the degrees of generators of the
        <i>j</i>th module(counting from <i>0</i>); 
        an <i>n</i> in the <i>j</i>th column in the
        row headed by &ldquo;<i>d</i>:&rdquo; means that the <i>j</i>th
        free module has <i>n</i> generators of degree
        <i>n+j</i>.  Thus for example in our case, the
        generator of the third (last) free module in the
        resolution has degree <i>3+2=5</i>.</p>
</div>
<div>
    <h4>B. Random regular sequences</h4>
<p>        An interesting and illustrative open problem
        is to understand the initial ideal (and 
        the Gröbner basis) of a &ldquo;generic&rdquo; 
{'fraction_non_alphanumeric': 0.12046158176189135, 'fraction_numerical': 0.009757012852988085, 'mean_word_length': 2.1297709923664123, 'pattern_counts': {'":': 0, '<': 394, '<?xml version=': 0, '>': 395, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2469007', 'n_tokens_mistral': 3534, 'n_tokens_neox': 3401, 'n_words': 1270}