[genius] Mon Sep 26 17:39:27 2011 Jiri (George) Lebl <jirka 5z com>



commit 29bb60a45ef3ebb3de7f50a017a89452de26fee1
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Mon Sep 26 17:40:20 2011 -0500

    Mon Sep 26 17:39:27 2011  Jiri (George) Lebl <jirka 5z com>
    
    	* configure.in, lib/Makefile.am, lib/communtative_algebra/Makefile.am,
    	  lib/commutative_algebra/macaulay.gel, src/funclib.c:
    	  Add MacaulayRep, MacaulayLowerOperator, and MacaulayBound
    	  functions and a Commutative Algebra section
    
    	* src/geniustests.txt: Add tests of the above

 ChangeLog                            |    9 +++++++
 NEWS                                 |    5 ++++
 configure.in                         |    1 +
 lib/Makefile.am                      |    3 +-
 lib/commutative_algebra/Makefile.am  |   13 ++++++++++
 lib/commutative_algebra/macaulay.gel |   45 ++++++++++++++++++++++++++++++++++
 lib/library-strings.c                |    3 ++
 src/funclib.c                        |    1 +
 src/geniustests.txt                  |    4 +++
 9 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 55d0887..95e2262 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Sep 26 17:39:27 2011  Jiri (George) Lebl <jirka 5z com>
+
+	* configure.in, lib/Makefile.am, lib/communtative_algebra/Makefile.am,
+	  lib/commutative_algebra/macaulay.gel, src/funclib.c:
+	  Add MacaulayRep, MacaulayLowerOperator, and MacaulayBound
+	  functions and a Commutative Algebra section
+
+	* src/geniustests.txt: Add tests of the above
+
 Fri Jul 29 09:06:50 2011  Jiri (George) Lebl <jirka 5z com>
 
 	* Release 1.0.14
diff --git a/NEWS b/NEWS
index 12c6143..c2f874b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Changes to 1.0.15
+
+* New functions MacaulayRep, MacaulayLowerOperator, MacaulayBound
+* FIXME: TEST AND DOCUMENT the above
+
 Changes to 1.0.14
 
 * Fix some compilation warnings (Vincent Untz, me)
diff --git a/configure.in b/configure.in
index 6c7d6a8..9b809aa 100644
--- a/configure.in
+++ b/configure.in
@@ -273,6 +273,7 @@ lib/sets/Makefile
 lib/number_theory/Makefile
 lib/statistics/Makefile
 lib/symbolic/Makefile
+lib/commutative_algebra/Makefile
 ve/Makefile
 gtkextra/Makefile
 pixmaps/Makefile
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 21548b2..ccfe835 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,7 @@
 Librarydir = $(datadir)/genius/gel
 SUBDIRS = calculus combinatorics equation_solving functions \
-	linear_algebra misc number_theory statistics sets symbolic
+	linear_algebra misc number_theory statistics sets symbolic \
+	commutative_algebra
 
 Library_DATA = lib.cgel loader.gel
 
diff --git a/lib/commutative_algebra/Makefile.am b/lib/commutative_algebra/Makefile.am
new file mode 100644
index 0000000..65e3fcc
--- /dev/null
+++ b/lib/commutative_algebra/Makefile.am
@@ -0,0 +1,13 @@
+Librarydir = $(datadir)/genius/gel/commutative_algebra
+SUBDIRS =
+
+GELFILES = macaulay.gel
+
+EXTRA_DIST = $(GELFILES)
+
+Library_DATA = $(GELFILES) loader.gel
+
+MOSTLYCLEANFILES = loader.gel
+
+loader.gel: $(GELFILES)
+	cd $(top_builddir)/lib/commutative_algebra && $(top_srcdir)/lib/make_loader_gel.sh $^ > loader.gel
diff --git a/lib/commutative_algebra/macaulay.gel b/lib/commutative_algebra/macaulay.gel
new file mode 100644
index 0000000..4d4b748
--- /dev/null
+++ b/lib/commutative_algebra/macaulay.gel
@@ -0,0 +1,45 @@
+SetHelp("MacaulayRep", "commutative_algebra", "Return the dth Macaulay representation of a positive integer c")
+function MacaulayRep (c,d) = (
+	if not IsNonNegativeInteger(c) or not IsPositiveInteger(d) then
+		(error("MacaulayRep: c should be a nonnegative integer and d a positive integer");bailout);
+	r = null;
+	for n=d to 1 by -1 do (
+		r@(1,n) = d-n;
+		r@(2,n) = d-n+1
+	);
+	j = 1;
+	while (sum n in ColumnsOf(r) do nCr(n@(1),n@(2))) != c do (
+		if j < d and r@(1,j+1) + 1 < r@(1,j) then (
+			increment j
+		) else (
+			while j > 1 and r@(1,j)+1 >= r@(1,j-1) do (
+				increment j by -1
+			);
+			for n=(j+1) to d do r@(1,n) = d-n
+		);
+		increment r@(1,j)
+	);
+	len = 1;
+	until len >= d or r@(1,len+1) < r@(2,len+1) do
+		increment len;
+	SetMatrixSize(r,2,len)
+)
+
+SetHelp("MacaulayLowerOperator", "commutative_algebra", "The c_<d> operator from Green's proof of Macaulay's Theorem")
+function MacaulayLowerOperator (c,d) = (
+	if not IsNonNegativeInteger(c) or not IsPositiveInteger(d) then
+		(error("MacaulayLowerOperator: c should be a nonnegative integer and d a positive integer");bailout);
+	r = MacaulayRep(c,d);
+	r@(1,) = r@(1,)-1;
+	sum n in ColumnsOf(r) do nCr(n@(1),n@(2))
+)
+
+SetHelp("MacaulayBound", "commutative_algebra", "For a Hilbert function that is c for degree d, given the Macaulay bound for the Hilbert function of degree d+1 (The c^<d> operator from Green's proof)")
+function MacaulayBound (c,d) = (
+	if not IsNonNegativeInteger(c) or not IsPositiveInteger(d) then
+		(error("MacaulayBound: c should be a nonnegative integer and d a positive integer");bailout);
+	r = MacaulayRep(c,d);
+	r@(1,) = r@(1,)+1;
+	r@(2,) = r@(2,)+1;
+	sum n in ColumnsOf(r) do nCr(n@(1),n@(2))
+)
diff --git a/lib/library-strings.c b/lib/library-strings.c
index 4f49913..c378833 100644
--- a/lib/library-strings.c
+++ b/lib/library-strings.c
@@ -251,6 +251,9 @@ char *fake = N_("Calculate the standard deviation of a whole matrix");
 char *fake = N_("Run newton's method on a polynomial to attempt to find a root, returns after two successive values are within epsilon or after maxn tries (then returns null)");
 char *fake = N_("Returns a set where every element of X appears only once");
 char *fake = N_("Returns a set theoretic union of X and Y (X and Y are vectors pretending to be sets)");
+char *fake = N_("For a Hilbert function that is c for degree d, given the Macaulay bound for the Hilbert function of degree d+1 (The c^<d> operator from Green's proof)");
+char *fake = N_("The c_<d> operator from Green's proof of Macaulay's Theorem");
+char *fake = N_("Return the dth Macaulay representation of a positive integer c");
 char *fake = N_("Attempt to symbolically differentiate a function n times");
 char *fake = N_("Attempt to symbolically differentiate a function n times quietly and return null on failure");
 char *fake = N_("Attempt to construct the taylor approximation function around x0 to the nth degree.");
diff --git a/src/funclib.c b/src/funclib.c
index 987fd58..ec0f376 100644
--- a/src/funclib.c
+++ b/src/funclib.c
@@ -6282,6 +6282,7 @@ gel_funclib_addall(void)
 	gel_new_category ("statistics", N_("Statistics"), TRUE /* internal */);
 	gel_new_category ("polynomial", N_("Polynomials"), TRUE /* internal */);
 	gel_new_category ("sets", N_("Set Theory"), TRUE /* internal */);
+	gel_new_category ("commutative_algebra", N_("Commutative Algebra"), TRUE /* internal */);
 	gel_new_category ("misc", N_("Miscellaneous"), TRUE /* internal */);
 
 	FUNC (manual, 0, "", "basic", N_("Displays the user manual"));
diff --git a/src/geniustests.txt b/src/geniustests.txt
index 6caa90a..ff26a38 100644
--- a/src/geniustests.txt
+++ b/src/geniustests.txt
@@ -1077,6 +1077,10 @@ IntegerQuotient(6,3)						2
 IntegerQuotient(-1,3)						-1
 IntegerQuotient(1,-3)						-1
 IntegerQuotient([1,2,3],[2,2,2])				[0,1,1]
+j=0;(for n=1 to 20 do (for d=1 to 20 do (if n!=(sum r in ColumnsOf(MacaulayRep(n,d)) do nCr(r@(1),r@(2))) then increment j)));j			0
+MacaulayRep(27,3)						[6,4,1;3,2,1]
+MacaulayBound(27,3)						46
+MacaulayLowerOperator(27,3)					13
 load "nullspacetest.gel"					true
 load "longtest.gel"						true
 load "testprec.gel"						true



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]