File: examples.m2

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (311 lines) | stat: -rw-r--r-- 7,384 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
--------------------------------------------
-- This Document is Reserved for Examples --
--------------------------------------------


--PUT SOME EXAMPLES INTO THE PACKAGE

viewHelp use


--Examples:
clearAll
uninstallPackage "NoetherNormalization"
installPackage "NoetherNormalization"
loadPackage "NoetherNormalization"
methods noetherNormalization
help NoetherNormalization
help noetherNormalization

viewHelp


-- Joe's example

clearAll
installPackage "NoetherNormalization"
loadPackage "NoetherNormalization"
n = 2;
A = QQ[x_(1,1)..x_(n,n),y_(1,1)..y_(n,n),MonomialOrder => Lex]
X = transpose genericMatrix(A,n,n)
Y = transpose genericMatrix(A,y_(1,1),n,n)
bracket = ideal flatten entries (X*Y - Y*X)
f = map(A,A,toList apply(0..(2*n^2-1), i -> sum(gens A)_{0..i}))
f bracket

viewHelp sum


(f,J,j) = noetherNormalization(bracket,Verbose=>true,LimitSequence => {5,10})
transpose gens J


--Example 1
clearAll
A = QQ[x_1..x_3][x_4]
A = QQ[x_1..x_4]
I = ideal(x_1^2 + x_1*x_4+1,x_1*x_2*x_3*x_4+1)
(f,J,j) = noetherNormalization(I,Verbose=>true,LimitList => {5})
A/f I

A = QQ
I = promote(ideal 0,QQ)
noetherNormalization(I,Verbose=>true)



transpose gens gb J
()
ring I
ring x_1
ring x_4

--Example 2
R = QQ[x_2,x_3,x_4,x_1,x_5,MonomialOrder=>Lex] -- this is a nice example...
R = QQ[x_1..x_5, MonomialOrder => Lex]; -- this is a nice example...
I = ideal(x_2*x_1-x_5^3, x_5*x_1^3);              -- compare with the same example in singular. 
(f,J,j) = noetherNormalization (I,Verbose => true)
transpose gens gb J


-- Not inverse maps!
S_2*S_1 -- Not inverse maps!
S_4*S_3
S_3*S_4
S_5*S_6
S_6*S_5
S_3*S_5*S_6*S_4


--Example 2.5
R = QQ[x_1..x_5,MonomialOrder=>Lex] -- this is a nice example...
I = ideal(x_2*x_1-x_5^3, x_5*x_1^3)              -- compare with the same example in singular. 
noetherNormalization(I,Verbose => true)
f = noetherPosition(I)
transpose gens gb f I
dim I
sort gens R
gens R





--Example 3 -- this one the indep vars are different
R = QQ[x_5,x_4,x_3,x_2,x_1]
I = ideal(x_1^3 + x_1*x_2, x_2^3-x_4+x_3, x_1^2*x_2+x_1*x_2^2)
noetherNormalization(I,Verbose => true)
f := (noetherNormalization(I))_1


support (independentSets(I,Limit=>1))_0

--Example 4
R = QQ[x_1,x_2,x_3]
I = ideal(x_1*x_2,x_1*x_3)
noetherNormalization(I,Verbose => true)
support (independentSets(I,Limit=>1))_0
X = (noetherNormalization(I,Verbose => true))_0
f = (noetherNormalization(I,Verbose => true))_1
R/f(I)
X
apply(X, i-> f i)



--Example 5
R := QQ[x_5,x_4,x_3,x_2,x_1, MonomialOrder => Lex]
I = ideal(x_4^3*x_3*x_2-x_4, x_2*x_1-x_5^3, x_5*x_1^3)
S = noetherNormalization(I,Verbose => true)
f = S_1
f x_2
x_2
describe ring x_2


--Example 6
R = QQ[x_1..x_5] --80
I = ideal(x_4^3*x_3*x_2-x_4, x_2*x_1-x_5^3, x_5*x_1^3)
noetherNormalization(I,Verbose => true)
support (independentSets(I,Limit=>1))_0


--Example 6.5
R = QQ[x_5,x_4,x_3,x_2,x_1] --20
I = ideal(x_4^3*x_3*x_2-x_4, x_2*x_1-x_5^3, x_5*x_1^3)
noetherNormalization(I,Verbose => true)
support (independentSets(I,Limit=>1))_0

--Example 7 Nat, check this one later. CANNOT DO in ALT NN
R = QQ[x_6,x_5,x_4,x_3,x_2,x_1];
I = ideal(x_6^2+x_5*x_3*x_4-2,x_4^4*x_3^2+x_1,x_2*x_1^3);
noetherNormalization(I,Verbose => true)
support (independentSets(I,Limit=>1))_0


--Example 8 -- kills m2 in AltNN! 
R = QQ[x_6,x_5,x_4,x_3,x_2,x_1];
I = ideal(x_6^3+x_5^2*x_3*x_4-2,x_4^4*x_3^2+x_1,x_2*x_1^3);
noetherNormalization(I,Verbose => true)
support (independentSets(I,Limit=>1))_0


--We cannot compute even the gb with this ordering
R = QQ[x_1..x_4];
I = ideal(-(3/2)*x_3^3*x_2-(4/5)*x_2^2+4*x_1^5-x_1,x_3^3*x_1-(5/8)*x_3^2*x_2*x_1^2+(2/5)*x_2+(8/3)*x_1^3)
noetherNormalization I
support (independentSets(I,Limit=>1))_0




-- output should be:

-- alg independent vars, ideal, map

          p       s
I < k[x] <= k[y] <- k[p^-1(U)]
            J<
	    
we take I we currently return p^-1, we want p,s,J --MIKE AGREES
don't compute the inverse asking for it. 

cache the inverse using something like

keys f.cache


-- Singular is better...

R = QQ[x_5,x_4,x_3,x_2,x_1,MonomialOrder => Lex] 
I = ideal(x_2*x_1-x_5^3, x_5*x_1^3)              
gens gb I
noetherNormalization I



R = QQ[x_5,x_4,x_3,x_2,x_1,MonomialOrder => Lex]
I = ideal(x_4^3*x_3*x_2-x_4, x_2*x_1-x_5^3, x_5*x_1^3)
gens gb I
noetherNormalization I
--this guys a problem, what to do?

R = QQ[x_1..x_4,MonomialOrder => Lex];
I = ideal((4/7)*x_3^2*x_4-(4/3)*x_4^2-(3/7)*x_3,(5/4)*x_2*x_4^2+(7/8)*x_1+(7/2),-(10/9)*x_1^2*x_4-(7/9)*x_2^2+(7/4)*x_4+(3/2))
noetherNormalization(I,Verbose => true)



-- Examples should be listed in a reasonable order
-- Comments should be given about why each example is good

--========================================================



--Examples:
clearAll
uninstallPackage "NoetherNormalization"
installPackage "NoetherNormalization"
methods noetherNormalization
help noetherNormalization

R = QQ[x_3,x_3,x_2,x_1, MonomialOrder => Lex];
I = ideal(-(3/2)*x_3^3*x_2-(4/5)*x_2^2+4*x_1^5-x_1,x_3^3*x_1-(5/8)*x_3^2*x_2*x_1^2+(2/5)*x_2+(8/3)*x_1^3)



--Ex#1
-- this is the example from the paper
-- this makes it a good first example
R = QQ[x_1..x_4,MonomialOrder => Lex];
R = QQ[x_4,x_3,x_2,x_1, MonomialOrder => Lex]; --the same ordering as in the paper
R = QQ[x_2,x_3,x_4,x_1, MonomialOrder => Lex];
I = ideal(x_2^2+x_1*x_2+1, x_1*x_2*x_3*x_4+1);
noetherNormalization I
I = ideal((6/5)*x_4*x_1-(8/7)*x_1^3-(9/4),(3/7)*x_4*x_3+(7/8)*x_3*x_2^2+x_1-(5/3),-(5/6)*x_4*x_2-(5/6)*x_3^2*x_1)
G = gb I
X = sort gens R -- note that this "sort" is very important
benchmark "varPrep(X,G)"
benchmark "support (independentSets(I,Limit => 1))_0"


--Examples of not so good I
--Ex#2
R = QQ[x_5,x_4,x_3,x_2,x_1,MonomialOrder => Lex]
I = ideal(x_1^3 + x_1*x_2, x_2^3-x_4+x_3, x_1^2*x_2+x_1*x_2^2)
noetherNormalization I
G = gb I
X = sort gens R -- note that this "sort" is very important
varPrep(X,G)
ZZ[x]
support (independentSets(ideal(x),Limit => 1))_0
independentSets(ideal(x))

dim(ZZ[x]/(7,x))
dim (ZZ[x]/ideal(7,x))

--Ex#3
R = QQ[x_1,x_2,x_3,MonomialOrder => Lex]
I = ideal(x_1*x_2,x_1*x_3)
noetherNormalization(I)
G = gb I
X = sort gens R -- note that this "sort" is very important
benchmark "varPrep(X,G)"
benchmark "support (independentSets(I,Limit => 1))_0"
benchmark "independentSets(I,Limit => 1)"
altVarPrep(X,I)

--Ex#4
R = QQ[x_3,x_2,x_1,MonomialOrder => Lex]
I = ideal(x_1*x_2, x_1*x_3)
G = gb I
X = sort gens R -- note that this "sort" is very important
varPrep(X,G)
independentSets I


prune ideal gens G
d = dim I
X = sort gens R -- note that this "sort" is very important
varPrep(X,G)
np = maxAlgPerm(R,X,G,d)
maxAlgPermC(R,X,G,d)
maxAlgPermB(R,X,G,d,{})


--Ex#5
R = QQ[x_1..x_6,MonomialOrder => Lex]
R = QQ[x_6,x_5,x_4,x_3,x_2,x_1,MonomialOrder => Lex]
I = ideal(x_1*x_2,x_1*x_3, x_2*x_3,x_2*x_4,x_2*x_5,x_3*x_4,x_3*x_5,x_4*x_5, x_4*x_6, x_5*x_6)
G = gb I
d = dim I
X = sort gens R -- note that this "sort" is very important
varPrep(X,G)
np = maxAlgPerm(R,X,G,d)
G = gb np I
(U,V) = varPrep(X,G)
noetherNormalization I
x_5<x_4

--Dan's finite field killing examples
xy(x+y)
(xy-1)(x+y)
x^2*y+x*y^2+1

R = ZZ/2[x,y]
I = ideal((x^2*y+x*y^2+1))
noetherNormalization I

-- we need more complex examples.

viewHelp


--Nat's examples

R = QQ[x_7,x_6,x_5,x_4,x_3,x_2,x_1, MonomialOrder => Lex];
I = ideal(x_2^2+x_1*x_2+x_5^2+1, x_1*x_2*x_3*x_4+x_5^4, x_6^4*x_3+x_4^2+8, x_7*x_6*x_5^2+x_5*x_2^2+12);
gens gb I
noetherNormalization I