From fdc8c2842da73a829455ac65b1cf0ebf39a70f7a Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 25 May 2024 11:05:39 -0400 Subject: [PATCH 1/2] Remove unused files in the "m2" directory --- M2/Macaulay2/m2/COPYRIGHT | 2 - M2/Macaulay2/m2/Makefile.in | 2 - M2/Macaulay2/m2/macaulay1.m2 | 16 - M2/Macaulay2/m2/overview.m2 | 1160 ------------------------------- M2/Macaulay2/m2/sagbi.m2 | 39 -- M2/Macaulay2/m2/workingnotes.m2 | 33 - 6 files changed, 1252 deletions(-) delete mode 100644 M2/Macaulay2/m2/COPYRIGHT delete mode 100644 M2/Macaulay2/m2/macaulay1.m2 delete mode 100644 M2/Macaulay2/m2/overview.m2 delete mode 100644 M2/Macaulay2/m2/sagbi.m2 delete mode 100644 M2/Macaulay2/m2/workingnotes.m2 diff --git a/M2/Macaulay2/m2/COPYRIGHT b/M2/Macaulay2/m2/COPYRIGHT deleted file mode 100644 index a538b42e168..00000000000 --- a/M2/Macaulay2/m2/COPYRIGHT +++ /dev/null @@ -1,2 +0,0 @@ --- Copyright 2009 by Daniel R. Grayson - diff --git a/M2/Macaulay2/m2/Makefile.in b/M2/Macaulay2/m2/Makefile.in index 78a3c42922b..52d3b85bef0 100644 --- a/M2/Macaulay2/m2/Makefile.in +++ b/M2/Macaulay2/m2/Makefile.in @@ -21,7 +21,6 @@ DUMPEDM2DOCFILES := \ @srcdir@/../packages/Macaulay2Doc/functions/*.m2 \ @srcdir@/../packages/Macaulay2Doc/operators/*.m2 \ ../packages/Macaulay2Doc.m2 -OTHERM2FILES := sagbi.m2 ############################## loadsequence LOADSEQUENCE := $(shell cat @srcdir@/loadsequence) DUMPEDM2FILES += $(LOADSEQUENCE) @@ -56,7 +55,6 @@ clean::; rm -f TAGS @srcdir@/TAGS @srcdir@/TAGS.doc @srcdir@/TAGS: \ $(DUMPEDM2SRCFILES) \ installedpackages \ - $(OTHERM2FILES) \ $(shell @FIND@ @srcdir@/../packages -name "*.m2" -a -not -name .\#\* | sort) \ ../editors/emacs/make-M2-emacs-help.m2 \ ../editors/make-M2-symbols.m2 \ diff --git a/M2/Macaulay2/m2/macaulay1.m2 b/M2/Macaulay2/m2/macaulay1.m2 deleted file mode 100644 index 3b079e9ee1c..00000000000 --- a/M2/Macaulay2/m2/macaulay1.m2 +++ /dev/null @@ -1,16 +0,0 @@ -cat = (firstvar,rows,cols) -> ( - R := ring firstvar; - x := index firstvar; - map(R^(#rows), #cols, (i,j) -> R_(x+rows_i+cols_j))) - -diag = (m) -> ( - m1 := flatten m; - n := numgens source m1; - R := ring m1; - map(R^n, n, (i,j) -> if i === j then n_(0,i) else 0)) - - - --- Local Variables: --- compile-command: "make -C $M2BUILDDIR/Macaulay2/m2" --- End: diff --git a/M2/Macaulay2/m2/overview.m2 b/M2/Macaulay2/m2/overview.m2 deleted file mode 100644 index a932f5d0db5..00000000000 --- a/M2/Macaulay2/m2/overview.m2 +++ /dev/null @@ -1,1160 +0,0 @@ --- Copyright 1993-1998 by Daniel R. Grayson - - -/// -document { "rings", - Headline => "an overview", - "In this section we present an overview of rings.", - see ", TO "Ring", ".", - MENU { - TO "basic rings", - TO "polynomial rings", - TO "manipulating polynomials", - TO "polynomial rings with other monomial orderings", - TO "multi-graded polynomial rings", - TO "quotient rings", - TO "finite fields", - TO "fraction fields", - TO "tensor products of rings", - TO "exterior algebras", - TO "symmetric algebras", - TO "Weyl algebras", - TO "associative algebras", - } - } -/// - - - -document { "basic rings", - "The following rings are initially present in every session with - Macaulay 2.", - UL { - TO "ZZ", - TO "QQ", - TO "RR", - TO "CC" - }, - NOINDENT, - "(The names of these rings are double letters so the corresponding symbols - with single letters can be used as variables in rings.) Entries of these - rings are constructed as follows, and the usual arithmetic operations apply.", - EXAMPLE { - "1234", - "123/4", - "123.4", - "123+4*ii", - }, - "The usual arithmetic operations are available.", - EXAMPLE { - "4/5 + 2/3", - "10^20", - "3*5*7", - "5!", - }, - "An additional pair of division operations that produce integral quotients - and remainders is available.", - EXAMPLE { - "1234//100", - "1234%100" - }, - } - -document { "polynomial rings", - "A polynomial ring can be created with the usual mathematical notation.", - EXAMPLE "ZZ[x,y,z]", - "If you try to construct this ring again, you will get a different - answer. We use the strict comparison operator ", TO "===", " to - demonstrate this.", - EXAMPLE "ZZ[x,y,z]===ZZ[x,y,z]", - "Thus it is a good idea to assign a new ring to a variable for - future reference.", - EXAMPLE "R = QQ[a,b,c,d,e,f]", - "Notice that after assignment to a global variable, the ring knows its - name, and the name is used when printing the ring.", - EXAMPLE "R", - "The original description of the ring can be recovered - with ", TO "describe", ".", - EXAMPLE "describe R", - "Subscript notation can be used to obtain the zero element and the unit - element of a ring, or indeed, to obtain any multiple of the unit.", - EXAMPLE { - "0_R", - "1_R", - "11_R", - }, - "Subscript notation (the other way around) can be used to obtain the - variables (generators) from the ring. The first available index is 0.", - EXAMPLE "R_0^10+R_1^3+R_2", - "It is also possible to obtain the variables in a ring from strings - containing their names.", - EXAMPLE ///R_"a"^10+R_"b"^3+R_"c"///, - "The number of variables is provided by ", TO "numgens", ".", - EXAMPLE { - "numgens R", - "apply(numgens R, i -> R_i^i)", - "sum(numgens R, i -> R_i^i)", - }, - "The index corresponding to a given variable can be obtained - with ", TO "index", ".", - EXAMPLE { - "index a, index f", - }, - "The coefficient ring can be recovered with ", TO "coefficientRing", ".", - EXAMPLE "coefficientRing R", - "An element of the coefficient ring can be promoted to the polynomial ring.", - EXAMPLE "promote(11/2,R)", - "Conversely, an element of the polynomial ring that is known to be a scalar - can be lifted back to the coefficient ring.", - EXAMPLE { - "sc = (a-2)^2-a^2+4*a", - "lift(sc,QQ)", - }, - "In programs, the function ", TO "liftable", " can be used to see whether - this is possible.", - EXAMPLE { - "liftable(sc,QQ)", - "liftable(c^3,QQ)", - }, - "A random homogeneous element can be obtained with ", TO "random", ".", - EXAMPLE "random(2,R)", - "We may construct polynomial rings over polynomial rings.", - EXAMPLE "ZZ[a,b,c][d,e,f];", - "When displaying an element of an iterated polynomial ring, - parentheses are used to organize the coefficients recursively, which - may themselves be polynomials.", - EXAMPLE "(a+d+1)^2", - "Variable names may be words.", - EXAMPLE { - "QQ[rho,sigma,tau];", - "(rho - sigma)^2", - }, - "There are various other ways to specify the variables to be used in a polynomial - ring. A sequence of variables can be obtained as follows.", - EXAMPLE "ZZ[b..k];", - "The single-letter variables can be obtained with ", TO "vars", ".", - EXAMPLE { - "vars (0..4)", - "ZZ[vars (0..4),vars(26..30),vars 51]", - }, - "Subscripted variables can be used, provided the base for the subscripted - variable has not been used for something else.", - EXAMPLE "ZZ[t,p_0,p_1,q_0,q_1];", - "Sequences of subscripted variables can be obtained.", - EXAMPLE { - "ZZ[p_(0,0) .. p_(2,1),q_0..q_5]", - "(p_(0,0)+q_2-1)^2", - }, - "The subscripts can be much more general, but care is required when using - symbols as subscripts, for the symbols may acquire values later that would - interfere with your original use of them as symbols. Thus you should - protect symbols that will be used in this way.", - EXAMPLE { - "protect xx; protect yy; protect zz;", - "ZZ[ee_[xx],ee_[yy],ee_[zz]]", - }, - "A basis of the subspace of ring elements of a given degree can be obtained - in matrix form with ", TO "basis", ".", - EXAMPLE "basis(2,R)", - "The Hilbert series of a polynomial ring can be obtained. Its power - series expansion is the generating function for the dimensions of the - degree ", TT "n", " parts.", - EXAMPLE "hilbertSeries R", - "We may use the option ", TO "Degrees", " to produce rings where the - generators have degrees other than 1.", - EXAMPLE { - "S = ZZ/101[a,b,c,d,Degrees=>{1,2,3,4}]", - "random(5,S)", - "hilbertSeries S" - }, - SEEALSO { "polynomial rings with other monomial orderings", "PolynomialRing"} - } - -document { "polynomial rings with other monomial orderings", - "We can make polynomial rings with various other orderings of the - monomials used in storing and displaying the polynomials. The - choice of ordering can make a difference in the time taken in - various computations.", - PARA, - "The material in this section will be completely redone soon.", - PARA, - "The default is to use the graded reverse lexicographic ordering - of monomials. - This means that terms of higher total degree come first; - and for two terms of the same degree, the term with the higher - power of the last variable comes last; for terms with the same - power of the last variable, the exponent on the next to last - variable is consulted, and so on.", - EXAMPLE { - "R=ZZ/101[a,b,c]", - "(a+b+c+1)^2", - }, - "Explicit comparison of monomials with respect to the chosen - ordering is possible.", - EXAMPLE "b^2 > a*c", - "The comparison operator ", TO "?", " returns a symbol indicating - the result of the comparison: the convention is that the larger - monomials are printed first (leftmost).", - EXAMPLE "b^2 ? a*c", - "The monomial ordering is also used when sorting lists with ", TO "sort", ".", - EXAMPLE "sort {1_R, a, a^2, b, b^2, a*b, a^3, b^3}", - "The next ring uses ", TO "MonomialOrder", " to specify reverse - lexicographic ordering. This means that the term with - the higher power of the last variable comes last; for terms with the same - power of the last variable, the exponent on the next to last variable - is consulted, and so on. Under this ordering the monomials are not - well ordered.", - EXAMPLE "R=ZZ/101[x,y,z,MonomialOrder=>RevLex];", - "We currently get a monomial overflow if we try to compute anything - in this ring, sigh.", - -- EXAMPLE "(x+y+z+1)^2", - PARA, - "The next ring uses graded lexicographic ordering. This means that - terms of higher total degree come first; for two terms of the - same degree, the term with the higher power of the first variable comes - first: for terms with the same power of the first variable the - power of the second variable is consulted, and so on.", - EXAMPLE { - "R=ZZ/101[a,b,c,MonomialOrder=>GLex];", - "(a+b+c+1)^2", - }, - NOINDENT, - "(Notice how similar the result above is to the one obtained when - graded reverse lexicographic ordering is used.)", - PARA, - "The next ring uses lexicographic ordering. This means that - terms with the highest power of the first variable come - first: for two terms with the same power of the first variable the - power of the second variable is consulted, and so on.", - EXAMPLE { - "R=ZZ/101[a,b,c,MonomialOrder=>Lex];", - "(a+b+c+1)^2", - }, - "The next ring uses an elimination order suitable for eliminating - the first two variables, ", TT "a", " and ", TT "b", ". In such an - ordering we want all terms in which either of the first two - variables appears to come before all of those terms in which - the first two variables don't appear. This particular ordering - accomplishes this by consulting first the graded reverse lexicographic - ordering ignoring all variables but the first two, and in case of - a tie, consulting the graded reverse lexicographic ordering of the - entire monomials.", - EXAMPLE { - "R=ZZ/101[a,b,c,MonomialOrder=>Eliminate 2];", - "(a+b+c+1)^2", - }, - "The next ring uses the product ordering that segregates the - first variable from the next two. This means that terms come - first that would come first in the graded reverse lexicographic - ordering when their parts involving the - second two variables are ignored, and in case of equality, - the graded reverse lexicographic ordering of their parts involving - just the next two variables is consulted.", - EXAMPLE { - "R=ZZ/101[a,b,c,MonomialOrder=>ProductOrder{1,2}];", - "(a+b+c+1)^2" - }, - PARA, - "See ", TO "MonomialOrder", " for further details." - } - -document { "manipulating polynomials", - "Let's set up some polynomials.", - EXAMPLE { - "R = ZZ/10007[a,b];", - "f = (2*a+3)^4 + 5", - "g = (2*a+b+1)^3", - }, - "The number of terms in a polynomial is obtained with ", TO "size", ".", - EXAMPLE "size f, size g", - "The degree of a polynomial is obtained with ", TO "degree", ".", - EXAMPLE { - "degree f", - "degree g", - }, - NOINDENT, - "(Notice that the degree is a list containing one integer, rather than - an integer. The degree is actually a vector of integers, represented as - a list, with one component by default.)", - PARA, - "The list of terms of a polynomial is obtained with ", TO "terms", ".", - EXAMPLE "terms g", - "We may combine that with ", TO "select", " to select terms satisfying - certain conditions. Here we select the terms of degree 2, subsequently - summing them, keeping in mind that the degree of a polynomial is always a - list of integers.", - EXAMPLE { - "select(terms g, i -> degree i == {2})", - "sum oo", - }, - "Of course, if the list of selected terms is empty, the sum would turn out - to be the zero integer, rather than the zero element of the ring ", TT "R", ". - Fortunately, we have another way to select the elements of given degree - or multi-degree (see ", TO (symbol _, RingElement, ZZ), ").", - EXAMPLE { - "g_0", - "g_1", - "g_2", - "g_3" - }, - "A string representing the polynomial, suitable for entry into other programs, - can be obtained with ", TO "toString", ".", - EXAMPLE { - "toString f", - "toString g", - }, - PARA, - "The usual algebraic operations on polynomials are available, but there - are some special remarks to make about division. The result of division - depends on the ordering of monomials chosen when the ring is created, for - division of ", TT "f", " by ", TT "g", " proceeds by locating monomials in - ", TT "f", " divisible by the leading monomial of ", TT "g", ", and - substituting for it the negation of the rest of ", TT "g", ". The quotient - is provided by the expression ", TT "f//g", ", and the remainder is obtained - with ", TT "f%g", ".", - EXAMPLE { - "quot = f//g", - "rem = f%g", - "f == quot * g + rem", - }, - NOINDENT, - "Notice that as in the example above, comparison of polynomials is done - with the operator ", TO "==", ".", - PARA, - "Polynomials can be homogenized with respect to one of the variables in the - ring with ", TO "homogenize", ".", - EXAMPLE "homogenize(f,b)", - PARA, - "Polynomials can be factored with ", TO "factor", ".", - EXAMPLE { - "S = factor f", - "T = factor g", - }, - PARA, - "The results above are represented as products of powers. (Exponents equal - to 1 don't appear in the display.) We can see the internal structure - to a specified depth (in this case, 2) with ", TO "peek2", ".", - EXAMPLE { - "peek2(S,2)", - "peek2(T,2)", - }, - "The components of the expressions above (Products and Powers) are types of - lists, and the parts can be extracted with ", TO "#", ".", - EXAMPLE { - "T#0", - "T#0#0", - "T#0#1", - }, - "The ring containing a ring element can be obtained with ", TO "ring", ".", - EXAMPLE "ring f", - "You can use this in a program to check whether two ring elements - come from the same ring.", - EXAMPLE "ring f === ring g", - "Notice that in the comparison above, the strict equality operator ", TO "===", " - is used.", - PARA, - "The coefficient of a monomial in a polynomial can be obtained with ", TO "_", ".", - EXAMPLE { - "f_1", - "f_a", - "g_(a*b)", - }, - NOINDENT, - "(Notice that the coefficients are elements of the coefficient ring.)", - PARA, - "We may get parts of the leading term of a polynomial as follows.", - EXAMPLE { - "leadTerm g", - "leadCoefficient g", - "leadMonomial g", - }, - NOINDENT, - "Notice that the lead monomial is an element of a monoid whose name is - ", TT "[a,b]", ". Its exponents can be extracted with ", TO "exponents", ".", - EXAMPLE "exponents leadMonomial g", - "We can get all of the coefficients at once, assembled a one-rowed matrix, - along with a matrix containing the corresponding monomials.", - EXAMPLE { - "coefficients f", - "coefficients g", - }, - "A list of lists of exponents appearing in a polynomial can be obtained with - ", TO "exponents", ".", - EXAMPLE { - "exponents f", - "exponents g", - }, - "The entire structure of a polynomial can be provided in an accessible form - based on lists with ", TO "listForm", ".", - EXAMPLE { - "listForm f", - "S = listForm g", - }, - "The lists above are lists of pairs, where the first member of each pair is - a list of exponents in a monomial, and the second member is the corresponding - coefficient. Standard list operations can be used to manipulate the result.", - EXAMPLE "S / print;", - "The structure of a polynomial can also be provided in a form - based on hash tables with ", TO "standardForm", ".", - EXAMPLE { - "S = standardForm f", - "standardForm g", - }, - "The hash tables above present the same information, except that only nonzero - exponents need to be provided. The information can be extracted with ", TO "#", ".", - EXAMPLE "S#(new HashTable from {0 => 2})", - PARA, - "Monomials (monoid elements) have an accessible form that is implicitly used - above.", - EXAMPLE { - "listForm leadMonomial g", - "standardForm leadMonomial g", - }, - "Comparison of polynomials is possible, and proceeds by simply examining the - lead monomials and comparing them.", - EXAMPLE { - "f < g", - "sort {b^2-1,a*b,a+1,a,b}" - }, - "The comparison operator ", TO "?", " returns a symbol indicating how two - polynomials, or rather, their lead monomials, stand with respect to each - other in the monomial ordering.", - EXAMPLE "f ? g", - } - -document { "multi-graded polynomial rings", - "It is possible to set up a polynomial ring so that the degree of an - element is a vector of integers. For this, the option - ", TO "Degrees", " is used, together with a list of degrees for the - variables in the ring. Each degree is itself a list of integers. The - degrees given must all be of the same length, and length zero is - allowed, to get an ungraded ring.", - EXAMPLE { - "R = ZZ/101[a,b,c,Degrees=>{{1,2},{2,1},{1,0}}]", - "describe R", - }, - "At the moment there is a restriction on the degree vectors: the first - entry must be greater than zero. This restriction will be removed soon.", - EXAMPLE { - "degree a", - "degree b^2", - "degree 0_R", - "degree 1_R", - }, - "A random element of bi-degree ", TT "{m,n}", " can be obtained with - ", TO "random", ".", - EXAMPLE "random({15,15},R)", - "The function ", TO "degree", " applied to a polynomial will - return the least upper bound of the degrees of its monomials.", - EXAMPLE "degree (a+b)", - "We may recover the number of integers in each degree list for our ring - as follows.", - EXAMPLE { - "degreeLength R", - "degreeLength ZZ" - }, - } - -document { "maps between rings", - Headline => "an overview", - "The class of all ring homomorphisms is ", TO "RingMap", ". A ring - homomorphism from a polynomial ring ", TT "S", " to a ring ", TT "R", " - is obtained with ", TO "map", " by providing a list of - elements in ", TT "R", " to which the generators (variables) of - ", TT "S", " should go, as follows.", - EXAMPLE { - "R = ZZ/101[a,b];", - "S = ZZ/101[x,y,z];", - "f = map(R,S,{a^2,a*b,b^2})", - }, - NOINDENT, - "(Notice that the target of ", TT "f", " is the first argument of ", TT "map", " - and the source of ", TT "f", " is the second argument.)", - PARA, - "We can apply this ring map to elements of ", TT "S", " in the usual way.", - EXAMPLE { - "f(x+y+z)", - "f S_2", - }, - "Composition of ring maps is possible.", - EXAMPLE { - "g = map(S,ZZ/101[t],{x+y+z})", - "f * g", - }, - "The defining matrix of ", TT "f", " can be recovered with the - key ", TT "matrix", ".", - EXAMPLE "f.matrix", - "We can produce the kernel of ", TT "f", " with ", TO "kernel", ".", - EXAMPLE "kernel f", - "We can produce the image of ", TT "f", " with ", TO "image", ". It is - computed as its source ring modulo its kernel.", - EXAMPLE "image f", - "We can check whether the map is homogeneous with ", TO "isHomogeneous", ".", - EXAMPLE "isHomogeneous f", - "We can obtain the ring of the graph of ", TT "f", " with ", TO "graphRing", ".", - EXAMPLE "graphRing f", - "We can obtain the ideal of the graph of ", TT "f", " with ", TO "graphIdeal", ", - except that currently the result is a matrix rather than an ideal, sigh.", - EXAMPLE "graphIdeal f" - } - -document { "quotient rings", - "The usual notation is used to form quotient rings. A Groebner basis is computed - and used to reduce ring elements to normal form after arithmetic operations.", - EXAMPLE { - "R = ZZ/11", - "6_R + 7_R", - }, - EXAMPLE { - "S = QQ[x,y,z]/(x^2-y, y^3-z)", - "{1,x,x^2,x^3,x^4,x^5,x^6,x^7,x^8}", - }, - "In the example above you might have wondered whether typing ", TT "x", " - would give an element of ", TT "S", " or an element of ", TT "QQ[x,y,z]", ". Our - convention is that typing ", TT "x", " gives an element of the - last ring that has been assigned to a global variable. Here is another - example.", - EXAMPLE { - "T = ZZ/101[r,s,t]", - "T/(r^3+s^3+t^3)", - "r^3+s^3+t^3", - }, - "Notice that this time, the variables end up in the ring ", TT "T", ", because - we didn't assign the quotient ring to a global variable. The - command ", TO "use", " would install the variables for us, or we could - assign the ring to a global variable.", - EXAMPLE { - "U = ooo", - "r^3+s^3+t^3", - }, - "The functions ", TO "lift", " and ", TO "promote", " can be used to transfer - elements between the polynomial ring and its quotient ring.", - EXAMPLE { - ///lift(U_"r",T)///, - ///promote(T_"r",U)///, - }, - "A random element of degree ", TT "n", " can be obtained with ", TO "random", ".", - EXAMPLE "random(2,S)", - "In a program we can tell whether a ring is a quotient ring.", - EXAMPLE { - "isQuotientRing ZZ", - "isQuotientRing S", - }, - "We can recover the ring of which a given ring is a quotient.", - EXAMPLE "ambient S", - "We can also recover the coefficient ring, as we could for the original - polynomial ring.", - EXAMPLE "coefficientRing S", - "Here's how we can tell whether the defining relations of a quotient - ring were homogeneous.", - EXAMPLE { - "isHomogeneous S", - "isHomogeneous U", - }, - "We can obtain the characteristic of a ring with ", TO "char", ".", - EXAMPLE { - "char (ZZ/11)", - "char S", - "char U", - }, - "The presentation of the quotient ring can be obtained as a matrix - with ", TO "presentation", ".", - EXAMPLE "presentation S", - "If a quotient ring has redundant defining relations, a new ring can - be made in which these are eliminated with ", TO "trim", ".", - EXAMPLE { - "R = ZZ/101[x,y,z]/(x-y,y-z,z-x)", - "trim R" - }, - "For more information see ", TO "QuotientRing", "." - } - -document { "finite fields", - "The prime finite fields can be made easily as quotient rings of ", TT "ZZ", ".", - EXAMPLE "ZZ/101", - "In general, to make a finite field with ", TT "q", " elements, we use - ", TO "GF", ".", - EXAMPLE "k = GF 81", - "The generator of the field can be obtained as usual.", - EXAMPLE "k_0", - "Notice that the name of the generator is displayed with a ", TT "$", " in it - to indicate that it is not accessible by typing. Of course, you could assign the - generator to the symbol of your choice, but it will still print the same way.", - EXAMPLE { - "a = k_0", - "a^20+1", - }, - "You may use ", TO "ambient", " to see the quotient ring the field is made from.", - EXAMPLE "ambient k", - "Use ", TO "ideal", " to see the ideal that defined that quotient ring.", - EXAMPLE "ideal oo", - "Finally, you may use ", TO "_", " to recover the generator of the ideal.", - EXAMPLE "oo_0", - "To specify a different name for the generator when the field is created, - use the ", TO "Variable", " option.", - EXAMPLE { - "F = GF(16, Variable => b)", - "b^20 + 1", - "random F", - }, - "Finite fields can be used as base rings for polynomial rings.", - EXAMPLE { - "R = F[x,y,z]", - "random(2,R)", - }, - "If you have a quotient ring that you know is a finite field, then you can - convert it to ring that is known by the system to be a finite field.", - EXAMPLE "GF (ZZ/2[T]/(T^9+T+1), Variable => T)", - "You may also provide your own choice of primitive element. Internally, - elements of the finite field are stored as powers of the primitive element. - First we assign our quotient ring to a global variable to ensure that - ", TT "T", " gets set to a value in the quotient ring, and then we - call ", TT "GF", ".", - EXAMPLE { - "A = ZZ/2[T]/(T^9+T+1)", - "k = GF (A, PrimitiveElement => T^3+1)", - }, - "Notice that ", TT "T", " is still recorded as an element of its - quotient ring, rather than this finite field.", - EXAMPLE "T", - "Use ", TO "promote", " to see how the generator ", TT "T", " appears as - an element of the finite field.", - EXAMPLE "promote(T,k)", - "Conversely, a given element of the finite field can be transferred back - to the quotient ring with ", TO "lift", ".", - EXAMPLE "lift(k_0, ring T)", - "We can even lift it back to the polynomial ring.", - EXAMPLE "lift(k_0, ambient ring T)", - "For more information see ", TO "GaloisField", "." - } - -document { "fraction fields", - "The fraction field of a ring (which must be an integral domain) is obtained - with the function ", TO "frac", ".", - EXAMPLE { - "frac ZZ", - "R = ZZ/101[x,y]/(x^3 + 1 + y^3)", - "frac R", - }, - "After defining a ring such as ", TT "R", ", fractions in its fraction field - can be obtained by writing them explicitly.", - EXAMPLE { - "x", - "1/x", - "x/1", - }, - "Alternatively, after applying the function ", TO "use", ", or assigning the - fraction ring to a global variable, the symbols you used - become associated with the corresponding elements of the fraction field.", - EXAMPLE { - "use frac R", - "x", - }, - "Fractions are reduced to the extent possible. This is done by computing the - syzygies between the numerator and denominator, and picking one of low degree.", - EXAMPLE { - "f = (x-y)/(x^6-y^6)", - "(x^3 - y^3) * f", - }, - "The parts of a fraction may be extracted.", - EXAMPLE { - "numerator f", - "denominator f", - }, - "Alternatively, the functions ", TO "lift", " and ", TO "liftable", " can - be used.", - EXAMPLE { - "liftable(1/f,R)", - "liftable(f,R)", - "lift(1/f,R)" - }, - "For more information see ", TO "FractionField", "." - } - -document { "tensor products of rings", - "The operator ", TO "**", " or the function ", TO "tensor", " can be - used to construct tensor products of rings.", - EXAMPLE "ZZ/101[x,y]/(x^2-y^2) ** ZZ/101[a,b]/(a^3+b^3)", - "Other monomial orderings can be specified.", - EXAMPLE "T = tensor(ZZ/101[x,y], ZZ/101[a,b], MonomialOrder => Eliminate 2)", - "The options to ", TT "tensor", " can be discovered with ", TO "options", ".", - EXAMPLE "options tensor" - } - -document { "exterior algebras", - "Create an exterior algebra with explicit generators by creating a polynomial - ring with the option ", TO "SkewCommutative", ".", - EXAMPLE { - "R = ZZ/101[x,y,z, SkewCommutative => true]", - "y*x", - "(x+y+z)^2", - "basis R", - "basis(2,R)", - }, - "At the moment, there is no way to construct an exterior algebra from a free module, but - you can take quotient rings of exterior algebras.", - } - -document { "symmetric algebras", - "Polynomial rings are symmetric algebras with explicit generators, and we have - already seen how to construct them. But if you have a module, then its symmetric - algebra can be constructed with ", TO "symmetricAlgebra", ".", - EXAMPLE { - "R = QQ[a..d];", - "S = symmetricAlgebra R^3", - "describe S", - }, - "The dollar signs used in displaying the names of the variables indicate that - the names were invented for us, and are not available by typing them, but you can - get them in the usual way by indexing.", - EXAMPLE { - "S_0+S_4", - ///S_"$x_0"///, - }, - "To specify the names of the variables when creating the ring, use the - ", TO "Variables", " option.", - EXAMPLE "S = symmetricAlgebra(R^3, Variables => {t,u,v})", - "We can construct the symmetric algebra of a module that isn't - necessarily free.", - EXAMPLE "symmetricAlgebra(R^1/(R_0,R_1^3), Variables => {t})" - } - -document { "Weyl algebras", - "A Weyl algebra is the non-commutative algebra of algebraic differential - operators on a polynomial ring. To each variable ", TT "x", " corresponds - the operator ", TT "dx", " that differentiates with respect to that - variable. The evident commutation relation takes the form - ", TT "dx*x == x*dx + 1", ".", - PARA, - "We can give any names we like to the variables in a Weyl algebra, provided - we specify the correspondence between the variables and the derivatives, - with the ", TO "WeylAlgebra", " option, as follows.", - PARA, - EXAMPLE { - "R = ZZ/101[x,dx,t,WeylAlgebra => {x=>dx}]", - "dx*x", - "dx*x^5" - } - } - -document { "associative algebras", - "Eventually we will implement associative algebras, not necessarily - commutative." - } - -document { "algebraic varieties", - "We may use ", TO "Spec", " to create an affine scheme (or algebraic variety) with - a specified coordinate ring and ", TO "ring", " to recover the ring.", - EXAMPLE { - "R = ZZ/2[x,y,z]", - "X = Spec R", - "ring X", - "dim X", - }, - "The variety ", TT "X", " is a 3-dimensional affine space.", - PARA, - "We may form products.", - EXAMPLE { - "X * X", - "dim oo", - }, - PARA, - "We may use ", TO "Proj", " to create a projective scheme (or algebraic variety) - with a specified homogeneous coordinate ring.", - EXAMPLE { - "Y = Proj R", - "ring Y", - "dim Y", - }, - "The most important reason for introducing the notion of algebraic variety into a computer - algebra system is to support the notion of coherent sheaf. See ", TO "coherent sheaves", " - for information about that.", - PARA, - "For more details about varieties, see ", TO "Variety", "." - } - -document { "matrices--old", - Headline => "an overview", - "In this section we present an overview of matrices. - For details, see ", TO "Matrix", ".", - MENU { - TO "making matrices", - TO "making random matrices", - TO "making generic matrices", - TO "displaying matrices", - TO "manipulating matrices", - TO "determinants", - TO "diff and contract", - } - } - -document { "making matrices", - "The simplest way to make a matrix is to give a doubly nested list of ring - elements to the ", TO "matrix", " command.", - EXAMPLE { - "R = ZZ/101[x,y,z];", - "f = matrix {{x,0,y*z},{0,y^2,x^2}}", - }, - "One way to construct a doubly nested - list of ring elements is with the ", TO "table", " command.", - EXAMPLE { - "table(3,3,(i,j) -> R_i^j)", - "p = matrix oo", - "q = matrix table(3,3,(i,j) -> R_j^i)", - }, - "The usual arithmetic operations among matrices are available, including - direct sum (", TO "++", ") and tensor product (", TO "**", "). Scalars - are converted to scalar matrices when necessary.", - EXAMPLE { - "x*p", - "11-p", - "p*q", - "p++q", - "r = p++x", - "x ++ y ++ z ++ x*y*z", - "p**p", - }, - "The components of a direct sum can be recovered later.", - EXAMPLE "components r", - "There are commands for horizontal and vertical concatenation of matrices, - and again, scalars are converted to scalar matrices when necessary.", - EXAMPLE { - "p|q", - "p||q", - "p|1", - "x^3||p", - }, - "An identity matrix can be obtained with ", TO "id", " as the identity map - on a free module.", - EXAMPLE "id_(R^3)", - "A matrix is regarded as a homomorphism between two free modules, its - ", TO "source", " and ", TO "target", ".", - EXAMPLE { - "M = target f", - "N = source f", - }, - "Free modules are actually graded free modules, with the same sort - of grading that the ring comes with. The degrees of the basis vectors - of the target are always zero.", - EXAMPLE { - "degree M_0", - "degree M_1", - }, - "If possible, the degrees of the basis vectors of the source are set so - that the map ", TT "f", " turns out to a homogeneous map of degree zero. - This opportunism is important because certain algorithms will run faster - on homogeneous maps.", - EXAMPLE { - "degree N_0", - "degree N_1", - "degree N_2", - "isHomogeneous f", - }, - "A list of the degrees of all the basis vectors can be obtained with - ", TO "degrees", ".", - EXAMPLE "degrees N", - "It may happen that the matrix can not be made homogeneous. In that - case, the degree of a basis vector is currently set to the degree of the - largest monomial occurring in the corresponding column of the matrix. In - a future version of the program it might be more sensible to set - the degrees of the basis vectors all to zero.", - EXAMPLE { - "g = matrix {{x,0,y*z},{y^2,x^2,0}}", - "isHomogeneous g", - "degrees source g", - }, - "Suppose we multiply a homogeneous polynomial by a homogeneous matrix. - The result ought to be homogeneous, but how can we arrange that? Scalar - multiplication should not change the source or target of a map! Instead, - we introduce one final complication: each matrix records a degree of its own, - which is normally zero, and is used when deciding whether the matrix is - homogeneous.", - EXAMPLE { - "degree matrix {{x^10}}", - "degree f", - }, - "Multiplying a matrix by a homogeneous polynomial adds the degree of - the polynomial to the degree of the map.", - EXAMPLE { - "h = x^10 * f", - "degree h", - "degrees source h", - "isHomogeneous h", - }, - "If you don't like this, you have an alternative. The degree of a tensor - product of two matrices is the sum of the degrees, and its source module is - the tensor product of the source modules.", - EXAMPLE { - "h = x^10 ** f", - "degree h", - "degrees source h", - "isHomogeneous h" - }, - "For more information about matrices, see ", TO "Matrix", "." - } - -document { "making random matrices", - "The ", TO "random", " command can be used in various ways to make random - matrices. We could assemble random polynomials into a doubly nested list - and use ", TO "matrix", " to enter them into a matrix.", - EXAMPLE { - "R = ZZ/101[x,y,z];", - "matrix table(3,3,(i,j)->random(2,R))", - "matrix table(3,3,(i,j)->random(i-j,R))", - }, - NOINDENT, "As usual, the degrees of the basis elements of the source and target - of the map are determined from the polynomials' degrees. Alternatively, - one could generate a free module with the appropriate degrees and use - ", TO "random", " to insert random matrix entries of the appropriate - degree so as to make the matrix homogeneous.", - EXAMPLE { - "random(R^3,R^{1,0,-1,-2})", - "random(R^{1,0,-1},R^{1,0,-1})" - }, - } - -document { "making generic matrices", - "Here a few commands for making various sorts of generic matrices. A generic - matrix is one whose entries are independent variables from the ring, subject - to certain relations.", - PARA, - "We begin by making a ring with enough variables to accommodate all - the examples.", - EXAMPLE "R = ZZ/101[a..z];", - "We can make a general generic matrix with ", TO "genericMatrix", ". We specify - the ring, the starting variable and the dimensions.", - EXAMPLE "genericMatrix(R,c,3,5)", - "We can also make a skew symmetric matrix with ", TO "genericSkewMatrix", " or - a symmetric matrix with ", TO "genericSymmetricMatrix", ".", - EXAMPLE { - "R = ZZ/101[a..i];", - "genericSkewMatrix(R,c,3)", - "gs = genericSymmetricMatrix(R,a,3)", - }, - "Suppose we need a random symmetric matrix of linear forms in three variables. - We can use ", TO "random", " and ", TO "substitute", " to obtain it from the - generic symmetric matrix ", TT "gs", " above.", - EXAMPLE { - "S = ZZ/101[x,y,z];", - "rn = random(S^1, S^{9:-1})", - "substitute(gs, rn)" - }, - } - -document { "displaying matrices", - "Normally matrices are displayed in compact notation that originated - with Macaulay.", - EXAMPLE { - "R = ZZ/101[x,y];", - "f = random(R^1,R^{2:-2})", - }, - "Setting the global flag ", TO "compactMatrixForm", " to ", TO "false", " - will modify that behavior so that matrices are displayed more clearly - and less compactly.", - EXAMPLE { - "compactMatrixForm = false", - "f", - }, - "We may use ", TO "toString", " to produce a string, useful as input into - other programs, or into Macaulay 2 at another time.", - EXAMPLE "toString f", - "The function ", TO "toExternalString", " tries harder: it gives - complete information about the source, target, and degree of the map.", - EXAMPLE "toExternalString f" - } - -document { "determinants", - Headline => "an overview of using determinants", - "The determinant of a square matrix is obtained using ", TO "det", ":", - EXAMPLE { - "R = ZZ[a..i];", - "m = genericMatrix(R,a,3,3)", - "det m", - }, - "Use the ", TO "minors", " function to obtain the ideal generated by all of the - determinants of a matrix of a given size.", - EXAMPLE "transpose generators minors(2,m)", - "The exterior power of a matrix is obtained using ", TO "exteriorPower", ".", - EXAMPLE "exteriorPower(2,m)", - "The signs are chosen so that this operation commutes with multiplication:", - EXAMPLE { - "S = QQ[x_(1,1) .. x_(3,5), y_(1,1) .. y_(5,4)]", - "M = transpose genericMatrix(S,x_(1,1),5,3)", - "N = transpose genericMatrix(S,y_(1,1),4,5)", - "exteriorPower(3,M*N) == exteriorPower(3,M) * exteriorPower(3,N)" - }, - "One can also compute the exterior power of more general maps between modules. See ", - TO "exteriorPower", " for details and an example.", - PARA, - "Macaulay 2 can use three different algorithms to compute determinants: - the ", TO "Cofactor", " method, which expands a determinant using the standard cofactor - approach, and ", TO "Bareiss", " which uses a fraction-free variant of Gaussian elimination - to compute a determinant. The ", TO "Dynamic", " algorithm implements a version of cofactor - expansion, with caching of intermediate results. The algorithm to use may be chosen using the optional ", - TO "Strategy", " argument:", - EXAMPLE { - "m = matrix{{0,a,b},{a+b,a,d},{e,f,g}}", - "det(m, Strategy => Cofactor)", - "minors(2,m, Strategy => Bareiss)", - "exteriorPower(2,m, Strategy => Dynamic)", - }, - "One warning is in order here: the Bareiss algorithm requires division in the base ring, - and so can yield the INCORRECT answer if the base ring contains zero divisors. However, - the Bareiss algorithm is often dramatically faster than the cofactor method, unless the - matrix is particularly sparse. Consequently, the default strategy for rings which are fields or are - not quotients of polynomial rings is ", TO "Bareiss", ", while the default for quotients of polynomial - rings that are not (declared to be) fields is ", TO "Cofactor", ".", - " The ", TO "Dynamic", " algorithm can sometimes also result in significant speedups compared to ", TO "Cofactor", - " and ", TO "Bareiss", ", at the cost of a slight memory overhead." - PARA, - "Sometimes finer control is needed when one is computing the ideal of minors of a larger - matrix. Compute the ideal of some determinants using ", TO "minors", " with optional - arguments as in", - EXAMPLE { - "M = genericMatrix(R,a,3,3);", - "minors(2,M,First => {{0,1},{1,2}}, Limit => 3)" - }, - "The argument to the optional argument ", TO "First", " is the list of row and column positions - to use for the first minor. Starting at this first minor, we then compute three minors." - } - - -document { "manipulating matrices", - "Some simple information about matrices:", - MENU { - TO (degree,Matrix), - TO (degrees,Matrix), - TO (entries,Matrix), - TO (isHomogeneous,Matrix), - TO (ring,Matrix), - TO (source,Matrix), - TO (target,Matrix), - TO (trace,Matrix), - TO (symbol _, Matrix, Sequence), - TO (symbol ==, Matrix, ZZ), - }, - "Some common algebraic operations on matrices:", - MENU { - TO (symbol +,Matrix,Matrix), - TO (symbol -,Matrix), - TO (symbol -,Matrix,Matrix), - TO (symbol *,Matrix,Matrix), - TO (symbol ^,Matrix,ZZ), - TO (symbol ==,Matrix,Matrix), - TO (symbol **,Matrix,Matrix), - TO (symbol //,Matrix,Matrix), - TO (symbol %,Matrix,Matrix), - TO (symbol ++,Matrix,Matrix), - TO (symbol |,Matrix,Matrix), - TO (symbol ||,Matrix,Matrix), - TO (symbol ^,Matrix,List), - TO (symbol _,Matrix,List), - TO (sortColumns,Matrix), - TO (submatrix,Matrix,List,List), - TO (substitute,Matrix,List), - TO (substitute,Matrix,Matrix), - TO (transpose,Matrix), - }, - "Some computations on matrices:", - MENU { - TO (exteriorPower,ZZ,Matrix), - TO (isInjective,Matrix), - TO (isSurjective,Matrix), - TO (isIsomorphism,Matrix), - TO (pfaffians,ZZ,Matrix), - TO (rank,Matrix), - TO (symmetricPower,ZZ,Matrix), - }, - } - -document { "computations", - Headline => "an overview", - "In this section we present an overview of the major computations.", - MENU { - TO "Groebner bases", - TO "computing Groebner bases", - TO "computing syzygies", - TO "computing resolutions", - } - } - -document { "Groebner bases", - "Computations in a quotient ring R/I of a polynomial ring R can be done with - the aid of a Groebner basis for the ideal I. One must begin by choosing - a way to order the monomials of R, so that each polynomial has a designated - leading term. A Groebner basis is then a generating set for I whose leading - terms generate the ideal of leading terms of all the elements of I. See - ", TO "polynomial rings with other monomial orderings", " for information about - setting up the ordering of the monomials.", - PARA, - "Many routines in Macaulay 2 will compute and use Groebner bases silently, so - ordinarily the user will not have to explicitly compute them. Recomputation - is avoided, in that if a Groebner basis has already been partially - computed, then it will be used whenever possible. Occasionally, the - user will need to exercise closer control over the computations, and - may need to compute the Groebner bases directly.", - PARA, - "To demonstrate, we set up a polynomial ring. (The default ordering used here - of the monomials is the graded reverse lexicographic ordering.)", - EXAMPLE { - "R = ZZ/101[a..d];", - "I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d)", - }, - "The Groebner basis can be obtained with ", TO "gb", ".", - EXAMPLE { - "gb I", - }, - "The result obtained above is an object of class ", TO "GroebnerBasis", " - that encapsulates the basis, the state of the computation, in case - it's incomplete, and several associated matrices.", - PARA, - "The basis can be assembled into a matrix with ", TO "generators", ", or its - abbreviation, ", TO "gens", ".", - EXAMPLE { - "transpose generators gb I", - }, - "We transposed the matrix above, simply because column vectors of polynomials - tend to fit on the page more easily than row vectors.", - PARA, - "Here is another example, which illustrates the use of another monomial - ordering convenient for the elimination of variables.", - EXAMPLE { - "A = ZZ/101[t];", - "f = t^3 + t^2 + 1;", - "g = t^4 - t;" - }, - "We wish to find a polynomial relation among ", TT "f", " and ", TT "g", ", - so we set up a new ring with a monomial ordering tailored for the - elimination of its first variable. (See ", TO "Eliminate", ").", - EXAMPLE { - "B = ZZ/101[t,F,G,MonomialOrder => Eliminate 1];", - "I = ideal(F - (t^3 + t^2 + 1), G - (t^4 - t))", - "transpose gens gb I", - }, - "The entry in the matrix above not involving ", TT "t", " is the desired relation.", - PARA, - "Computations in a quotient module ", TT "M/N", " can be done with the aid of a - Groebner basis for the submodule ", TT "N", ".", - EXAMPLE { - "clearAll", - "R = ZZ/101[a..f];", - "N = image matrix {{a,b,c},{d,e,f}}", - "gb N", - }, - "Notice the appearance of the 2 by 2 minors.", - PARA, - "Groebner bases can be computed in various types of rings: polynomial rings - over fields, skew-commutative-polynomial rings, Weyl algebras, and quotient rings of - any such rings. Groebner bases in rings over the integers can be computed - for homogeneous ideals. In the future Groebner bases will be provided - for nonhomogeneous ideals in rings over the integers, in polynomial rings - over polynomial rings, and in general noncommutative algebras." - } - - - - - --- Local Variables: --- compile-command: "make -C $M2BUILDDIR/Macaulay2/m2" --- End: diff --git a/M2/Macaulay2/m2/sagbi.m2 b/M2/Macaulay2/m2/sagbi.m2 deleted file mode 100644 index 0d517308972..00000000000 --- a/M2/Macaulay2/m2/sagbi.m2 +++ /dev/null @@ -1,39 +0,0 @@ --- Preliminary debugging interface for sagbi bases. --- Warning!! This is not yet functional! -sagbi = method() -sagbi Matrix := (M) -> ( - -- check that M has a single row - if numgens target M != 1 - then error "'sagbi' expects a one row matrix"; - notImplemented()) - -subduction = method() -subduction (Matrix, RingMap, Matrix) := (m,F,J) -> ( - R := ring m; - n := numgens R; - RS = ring J; - nS := numgens RS - n; - RtoRS = map(RS,R,(vars RS)_{0..n-1}); - RStoR = map(R,RS,(vars R) | matrix {toList(nS:0_R)}); - m = RtoRS m; - g := J#{false,0}; - FRStoRS = map(RS,RS, (vars RS)_{0..n-1} | RtoRS (F.matrix)); - result := notImplemented(); - RStoR result) - -/// -R = ZZ/101[a,b,c] -m = matrix{{a^2+b^2}} -S = ZZ/101[x,y] -F = map(R,S,{a-b, b^2-c^2}) -inF = map(R,S,leadTerm (F.matrix)) -J = graphIdeal(inF, MonomialOrder=>ProductOrder{3,2}) -generators gb J - -subduction(m, F, J) -/// - - --- Local Variables: --- compile-command: "make -C $M2BUILDDIR/Macaulay2/m2 " --- End: diff --git a/M2/Macaulay2/m2/workingnotes.m2 b/M2/Macaulay2/m2/workingnotes.m2 deleted file mode 100644 index a1c4d5cbddb..00000000000 --- a/M2/Macaulay2/m2/workingnotes.m2 +++ /dev/null @@ -1,33 +0,0 @@ -Mike could fix: - - test/ISSAC-97.m2 -- too big now, improve the algorithm - test/engine-div.m2 -- raw % and // need to be defined, or something - test/gbZZbug.m2 -- gb problem with bit integers - test/galois.m2 -- GF substitution - test/subst3.m2 -- GF substitution - test/euclid.errors -- % and // in ZZ[x,Inverses=>true,MonomialOrder=>RevLex] - test/engine/LU.m2 -- in debug version, I get many smashed blocks! Memory allocator problem? - test/order.m2 -- sorting of polynomials needs a total ordering - test/slow/completeintersections.m2 -- too slow or hung up??? - -Dan could fix: - -============================================================================= - - a - b - o23 = c - - i24 : z#0 - - o24 = a ??? put z#0 on the line? will this affect my code? - -============================================================================= - -TEST's in the Macaulay2 documentation might not be getting run! - - -on branch : -change 1 -change 2 -change 3 From 5195b2d33467acc53da0f58b7f881c6e525fd087 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 25 May 2024 13:41:46 -0400 Subject: [PATCH 2/2] Add missing content from unused "m2/overview.m2" to docs --- .../packages/Macaulay2Doc/monomorderings.m2 | 141 +++++++++++++++--- .../packages/Macaulay2Doc/ov_matrices.m2 | 139 +++++++++++++++-- .../packages/Macaulay2Doc/overviewC.m2 | 12 +- .../packages/Varieties/doc-varieties.m2 | 31 ++++ 4 files changed, 284 insertions(+), 39 deletions(-) diff --git a/M2/Macaulay2/packages/Macaulay2Doc/monomorderings.m2 b/M2/Macaulay2/packages/Macaulay2Doc/monomorderings.m2 index c7b9c0312d6..b409225384b 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/monomorderings.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/monomorderings.m2 @@ -4,13 +4,18 @@ document { Key => "polynomial rings", - "Create a polynomial ring using the usual mathematical notation.", - EXAMPLE { - "R = QQ[x,y,z];", - "R", - }, + "A polynomial ring can be created with the usual mathematical notation.", + EXAMPLE "ZZ[x,y,z]", + "If you try to construct this ring again, you will get a different + answer. We use the strict comparison operator ", TO "===", " to + demonstrate this.", + EXAMPLE "ZZ[x,y,z]===ZZ[x,y,z]", + "Thus it is a good idea to assign a new ring to a variable for + future reference.", + EXAMPLE "R = QQ[a,b,c,d,e,f]", "Notice that after assignment to a global variable, Macaulay2 knows the ring's name, and this name is used when printing the ring.", + EXAMPLE "R", "The original description of the ring can be recovered with ", TO "describe", ".", EXAMPLE "describe R", @@ -24,6 +29,9 @@ document { "Obtain the variables (generators) of the ring by subscripting the name of the ring. As always in Macaulay2, indexing starts at 0.", EXAMPLE "R_0^10+R_1^3+R_2", + "It is also possible to obtain the variables in a ring from strings + containing their names.", + EXAMPLE ///"a"_R^10+"b"_R^3+"c"_R///, "The number of variables is provided by ", TO "numgens", ".", EXAMPLE { "numgens R", @@ -43,6 +51,20 @@ document { "The coefficient ring can be recovered with ", TO "coefficientRing", ".", EXAMPLE "coefficientRing R", + "An element of the coefficient ring can be promoted to the polynomial ring.", + EXAMPLE "promote(11/2,R)", + "Conversely, an element of the polynomial ring that is known to be a scalar + can be lifted back to the coefficient ring.", + EXAMPLE { + "sc = (a-2)^2-a^2+4*a", + "lift(sc,QQ)", + }, + "In programs, the function ", TO "liftable", " can be used to see whether + this is possible.", + EXAMPLE { + "liftable(sc,QQ)", + "liftable(c^3,QQ)", + }, "A random homogeneous element can be obtained with ", TO "random", ".", EXAMPLE "random(2,R)", @@ -51,12 +73,15 @@ document { EXAMPLE "basis(2,R)", "We may construct polynomial rings over polynomial rings.", - EXAMPLE "ZZ[a,b,c][d,e,f];", + EXAMPLE "R = ZZ[a,b,c][d,e,f];", "When displaying an element of an iterated polynomial ring, parentheses are used to organize the coefficients recursively, which may themselves be polynomials.", EXAMPLE "(a+d+1)^2", + "Internally, the polynomials in such towers are expressed in terms of a flattened monoid + containing all the variables, obtainable with the key ", TO "FlatMonoid", ".", + EXAMPLE "R.FlatMonoid", "Variable names may be words.", EXAMPLE { "QQ[rho,sigma,tau];", @@ -91,18 +116,23 @@ document { "protect xx; protect yy; protect zz;", "ZZ[ee_[xx],ee_[yy],ee_[zz]]", }, - "Polynomial rings over polynomial rings work:", - EXAMPLE lines /// - R = QQ[a,b][x] - (a+b+x)^3 - ///, - PARA { - "Internally, the polynomials in such towers are expressed in terms of a flattened monoid - containing all the variables, obtainable with the key ", TO "FlatMonoid", "." - }, - EXAMPLE lines /// - R.FlatMonoid - ///, + "A basis of the subspace of ring elements of a given degree can be obtained + in matrix form with ", TO "basis", ".", + EXAMPLE { + "R = QQ[a,b,c,d,e,f];", + "basis(2,R)" + }, + "The Hilbert series of a polynomial ring can be obtained. Its power + series expansion is the generating function for the dimensions of the + degree ", TT "n", " parts.", + EXAMPLE "hilbertSeries R", + "We may use the option ", TO "Degrees", " to produce rings where the + generators have degrees other than 1.", + EXAMPLE { + "S = ZZ/101[a,b,c,d,Degrees=>{1,2,3,4}]", + "random(5,S)", + "hilbertSeries S" + }, "Some things to watch out for when using polynomial rings:", UL { LI ("Defining a ring twice gives different rings, as far as Macaulay2 is concerned: @@ -133,16 +163,81 @@ document { } document { - Key => "monomial orderings", + Key => "monomial orderings", "Every polynomial ring in Macaulay2 comes equipped with an ordering on - the monomials. See below for the definitions of all implemented - orderings. The default ordering is GRevLex, the graded reverse - lexicographic order.", - PARA{}, + the monomials.", "Polynomials are displayed by ordering the monomials in decreasing order. The choice of monomial order can make a difference in the time and space required for various computations, especially Gröbner basis computations.", + "See below for the definitions of all implemented + orderings.", + PARA{}, + "The default ordering is ", TO GRevLex, ", the graded reverse + lexicographic order.", + "This means that terms of higher total degree come first; + and for two terms of the same degree, the term with the higher + power of the last variable comes last; for terms with the same + power of the last variable, the exponent on the next to last + variable is consulted, and so on.", + EXAMPLE { + "R=ZZ/101[a,b,c]", + "(a+b+c+1)^2", + }, + "Explicit comparison of monomials with respect to the chosen + ordering is possible.", + EXAMPLE "b^2 > a*c", + "The comparison operator ", TO "?", " returns a symbol indicating + the result of the comparison: the convention is that the larger + monomials are printed first (leftmost).", + EXAMPLE "b^2 ? a*c", + "The monomial ordering is also used when sorting lists with ", TO "sort", ".", + EXAMPLE "sort {1_R, a, a^2, b, b^2, a*b, a^3, b^3}", + PARA{}, + "The next ring uses graded lexicographic ordering. This means that + terms of higher total degree come first; for two terms of the + same degree, the term with the higher power of the first variable comes + first: for terms with the same power of the first variable the + power of the second variable is consulted, and so on.", + EXAMPLE { + "R=ZZ/101[a,b,c,MonomialOrder=>GLex];", + "(a+b+c+1)^2", + }, + "(Notice how similar the result above is to the one obtained when + graded reverse lexicographic ordering is used.)", + PARA{}, + "The next ring uses lexicographic ordering. This means that + terms with the highest power of the first variable come + first: for two terms with the same power of the first variable the + power of the second variable is consulted, and so on.", + EXAMPLE { + "R=ZZ/101[a,b,c,MonomialOrder=>Lex];", + "(a+b+c+1)^2", + }, + "The next ring uses an elimination order suitable for eliminating + the first two variables, ", TT "a", " and ", TT "b", ". In such an + ordering we want all terms in which either of the first two + variables appears to come before all of those terms in which + the first two variables don't appear. This particular ordering + accomplishes this by consulting first the graded reverse lexicographic + ordering ignoring all variables but the first two, and in case of + a tie, consulting the graded reverse lexicographic ordering of the + entire monomials.", + EXAMPLE { + "R=ZZ/101[a,b,c,MonomialOrder=>Eliminate 2];", + "(a+b+c+1)^2", + }, + "The next ring uses the product ordering that segregates the + first variable from the next two. This means that terms come + first that would come first in the graded reverse lexicographic + ordering when their parts involving the + second two variables are ignored, and in case of equality, + the graded reverse lexicographic ordering of their parts involving + just the next two variables is consulted.", + EXAMPLE { + "R=ZZ/101[a,b,c,MonomialOrder=>ProductOrder{1,2}];", + "(a+b+c+1)^2" + }, PARA{}, Subnodes => { TO "examples of specifying alternate monomial orders", diff --git a/M2/Macaulay2/packages/Macaulay2Doc/ov_matrices.m2 b/M2/Macaulay2/packages/Macaulay2Doc/ov_matrices.m2 index a5f8cffe16c..201837a6e6a 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/ov_matrices.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/ov_matrices.m2 @@ -36,11 +36,19 @@ document { SUBSECTION "by its entries", "Using the function ", TO "matrix", " is the most basic method - for inputting a matrix. The entries are typed in by rows.", + for inputting a matrix. The entries are typed in by rows as a doubly + nested list of ring elements.", EXAMPLE { "R = ZZ/5[s..z];", "M = matrix {{ x^2+y, z^3}, {y^3-z,3*z-6*x-5*y}}" }, + "One way to construct a doubly nested + list of ring elements is with the ", TO "table", " command.", + EXAMPLE { + "table(3,3,(i,j) -> R_i^j)", + "p = matrix oo", + "q = matrix table(3,3,(i,j) -> R_j^i)", + }, SUBSECTION "by a function", "The function ", TO map, " can be used to construct @@ -137,15 +145,46 @@ document { TO "target", " command to obtain the target of the linear transformation ", TT "f", ".", EXAMPLE { - "target f" + "M = target f" }, + "Free modules are actually graded free modules, with the same sort + of grading that the ring comes with. The degrees of the basis vectors + of the target are always zero.", + EXAMPLE { + "degree M_0", + "degree M_1", + }, SUBSECTION "source", "Likewise, to obtain the source of our linear transformation, use the ", TO "source", " command.", EXAMPLE { - "source f" + "N = source f" }, + "If possible, the degrees of the basis vectors of the source are set so + that the map ", TT "f", " turns out to a homogeneous map of degree zero. + This opportunism is important because certain algorithms will run faster + on homogeneous maps.", + EXAMPLE { + "degree N_0", + "degree N_1", + "degree N_2", + "degree N_3", + "isHomogeneous f", + }, + "A list of the degrees of all the basis vectors can be obtained with + ", TO "degrees", ".", + EXAMPLE "degrees N", + "It may happen that the matrix can not be made homogeneous. In that + case, the degree of a basis vector is currently set to the degree of the + largest monomial occurring in the corresponding column of the matrix. In + a future version of the program it might be more sensible to set + the degrees of the basis vectors all to zero.", + EXAMPLE { + "g = matrix {{x,0,y*z},{y^2,x^2,0}}", + "isHomogeneous g", + "degrees source g", + }, SUBSECTION "number of rows or columns", "Use ", TO "numgens", " to obtain the rank of a free module. Combining @@ -201,6 +240,10 @@ document { }, "The matrices in question must have the same number of rows and columns and also must have the same ring.", + PARA{}, + "Scalars are converted to scalar matrices when necessary.", + EXAMPLE "matrix {{1, 2}, {3, 4}} + 5", + "This is also true for the other arithmetic operations discussed below.", SUBSECTION "-", "To subtract two matrices, use the ", TO "-", " operator.", @@ -218,6 +261,35 @@ document { "gg = matrix {{g,h},{i,j},{k,l}}", "ff * gg" }, + "Suppose we multiply a homogeneous polynomial by a homogeneous matrix. + The result ought to be homogeneous, but how can we arrange that? Scalar + multiplication should not change the source or target of a map! Instead, + we introduce one final complication: each matrix records a degree of its own, + which is normally zero, and is used when deciding whether the matrix is + homogeneous.", + EXAMPLE { + "R = ZZ/101[x,y,z];", + "degree matrix {{x^10}}", + "f = matrix {{x,0,y*z},{0,y^2,x^2}};", + "degree f", + }, + "Multiplying a matrix by a homogeneous polynomial adds the degree of + the polynomial to the degree of the map.", + EXAMPLE { + "h = x^10 * f", + "degree h", + "degrees source h", + "isHomogeneous h", + }, + "If you don't like this, you have an alternative. The degree of a tensor + product of two matrices is the sum of the degrees, and its source module is + the tensor product of the source modules.", + EXAMPLE { + "h = x^10 ** f", + "degree h", + "degrees source h", + "isHomogeneous h" + }, SUBSECTION "^", "To raise a square matrix to a power, use the ", TO "^", " operator.", @@ -275,6 +347,7 @@ document { ff ** gg : K ** M ---> L ** N ///, EXAMPLE { + "R = ZZ/17[a..l];", "ff = matrix {{a,b,c},{d,e,f}}", "gg = matrix {{g,h},{i,j},{k,l}}", "ff ** gg" @@ -318,8 +391,16 @@ document { matrix function that row entry must have 3 entries.", SUBSECTION "direct sum of matrices as maps between modules", - "++" - } + "Use ", TO symbol ++, " to find the direct sum of two matrices.", + EXAMPLE { + "R = ZZ/101[x,y,z];", + "p = matrix table(3,3,(i,j) -> R_i^j)", + "q = matrix table(3,3,(i,j) -> R_j^i)", + "r=p++q" + }, + "The components of a direct sum can be recovered later.", + EXAMPLE "components r" + } -* -- Mike wanted this: @@ -350,10 +431,30 @@ document { "The command ", TO2(determinant, "det"), " can be used to compute the determinant of a square matrix.", EXAMPLE { - "R = ZZ[a..d];", - "f = matrix{{a,b},{c,d}}", - "det f" - }, + "R = ZZ[a..i];", + "det matrix{{a,b},{c,d}}" + }, + "Macaulay2 can use three different algorithms to compute determinants: + the ", TO "Cofactor", " method, which expands a determinant using the standard cofactor + approach, and ", TO "Bareiss", " which uses a fraction-free variant of Gaussian elimination + to compute a determinant. The ", TO "Dynamic", " algorithm implements a version of cofactor + expansion, with caching of intermediate results. The algorithm to use may be chosen using the optional ", + TO "Strategy", " argument:", + EXAMPLE { + "m = matrix{{0,a,b},{a+b,a,d},{e,f,g}}", + "det(m, Strategy => Cofactor)", + "minors(2,m, Strategy => Bareiss)", + "exteriorPower(2,m, Strategy => Dynamic)", + }, + "One warning is in order here: the Bareiss algorithm requires division in the base ring, + and so can yield the INCORRECT answer if the base ring contains zero divisors. However, + the Bareiss algorithm is often dramatically faster than the cofactor method, unless the + matrix is particularly sparse. Consequently, the default strategy for rings which are fields or are + not quotients of polynomial rings is ", TO "Bareiss", ", while the default for quotients of polynomial + rings that are not (declared to be) fields is ", TO "Cofactor", ".", + " The ", TO "Dynamic", " algorithm can sometimes also result in significant speedups compared to ", TO "Cofactor", + " and ", TO "Bareiss", ", at the cost of a slight memory overhead.", + PARA{}, "The command ", TO "minors", " can be used to construct the ideal generated by the ", TT "n", " by ", TT "n", " minors of a matrix. Recall that the ", TT "n", " by ", TT "n", " minors of a matrix are @@ -363,7 +464,17 @@ document { "R = QQ[x,y,z];", "f = matrix{{x,y,z},{y,z,x^2}}", "I = minors(2,f)" - } + }, + "Sometimes finer control is needed when one is computing the ideal of minors of a larger + matrix. Compute the ideal of some determinants using ", TO "minors", " with optional + arguments as in", + EXAMPLE { + "R = ZZ[a..i];", + "M = genericMatrix(R,a,3,3);", + "minors(2,M,First => {{0,1},{1,2}}, Limit => 3)" + }, + "The argument to the optional argument ", TO "First", " is the list of row and column positions + to use for the first minor. Starting at this first minor, we then compute three minors." } document { @@ -385,6 +496,14 @@ document { TT "2", " minor (the determinant of a ", TT "2", " by ", TT "2", " submatrix) of the matrix ", TT "ff", ".", + PARA{}, + "The signs are chosen so that this operation commutes with multiplication:", + EXAMPLE { + "S = QQ[x_(1,1) .. x_(3,5), y_(1,1) .. y_(5,4)]", + "M = transpose genericMatrix(S,x_(1,1),5,3)", + "N = transpose genericMatrix(S,y_(1,1),4,5)", + "exteriorPower(3,M*N) == exteriorPower(3,M) * exteriorPower(3,N)" + }, SeeAlso => "exterior power of a module" } diff --git a/M2/Macaulay2/packages/Macaulay2Doc/overviewC.m2 b/M2/Macaulay2/packages/Macaulay2Doc/overviewC.m2 index 14deb7ccec4..3c8adfc0b6e 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/overviewC.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/overviewC.m2 @@ -654,12 +654,12 @@ document { } document { - Key => "associative algebras", - "Eventually we will implement associative algebras, not necessarily - commutative." - } + Key => "associative algebras", + "Associative (i.e., not necessarily commutative) algebras are implemented in + the ", TO "AssociativeAlgebras::AssociativeAlgebras", " package." + } -/// +-* "An element of the coefficient ring can be promoted to the polynomial ring.", EXAMPLE "promote(11/2,R)", "Conversely, an element of the polynomial ring that is known to be a scalar @@ -687,7 +687,7 @@ document { "hilbertSeries S" }, SeeAlso => { "monomial orderings", "PolynomialRing"} -/// +*- diff --git a/M2/Macaulay2/packages/Varieties/doc-varieties.m2 b/M2/Macaulay2/packages/Varieties/doc-varieties.m2 index c8148a0222b..b08f31f9018 100644 --- a/M2/Macaulay2/packages/Varieties/doc-varieties.m2 +++ b/M2/Macaulay2/packages/Varieties/doc-varieties.m2 @@ -15,6 +15,37 @@ document { Key => Variety, Headline => "the class of all algebraic varieties", S document { Key => AffineVariety, Headline => "the class of all affine varieties" } document { Key => ProjectiveVariety, Headline => "the class of all projective varieties" } +document { Key => "varieties", + "We may use ", TO "Spec", " to create an affine scheme (or algebraic variety) with + a specified coordinate ring and ", TO "ring", " to recover the ring.", + EXAMPLE { + "R = ZZ/2[x,y,z]", + "X = Spec R", + "ring X", + "dim X", + }, + "The variety ", TT "X", " is a 3-dimensional affine space.", + PARA{}, + "We may form products.", + EXAMPLE { + "X ** X", + "dim oo", + }, + PARA{}, + "We may use ", TO "Proj", " to create a projective scheme (or algebraic variety) + with a specified homogeneous coordinate ring.", + EXAMPLE { + "Y = Proj R", + "ring Y", + "dim Y", + }, + "The most important reason for introducing the notion of algebraic variety into a computer + algebra system is to support the notion of coherent sheaf. See ", TO "coherent sheaves", " + for information about that.", + PARA{}, + "For more details about varieties, see ", TO "Variety", "." + } + document { Key => {Spec, (Spec, Ring)}, Headline => "make an affine variety",