1 | LIB "freegb.lib"; |
---|
2 | |
---|
3 | // proc vct2str(vector v, list #) NOTE: if an optional integer is not 0, stars signs are used in multiplication |
---|
4 | /* int useStar = 0; |
---|
5 | if ( size(#)>0 ) |
---|
6 | { |
---|
7 | if (#[1]) |
---|
8 | { |
---|
9 | useStar = 1; |
---|
10 | } |
---|
11 | } |
---|
12 | */ |
---|
13 | |
---|
14 | |
---|
15 | ring r = 0,(x,y,z),(dp); |
---|
16 | module M = [1,x,y,x,y],[-2,y,x,y,x],[6,x,y,y,x,y]; |
---|
17 | mod2str(M); // => no * |
---|
18 | mod2str(M,0); // => no * |
---|
19 | mod2str(M,1); // => *! |
---|
20 | |
---|
21 | // BUT, the following are BUGs: |
---|
22 | mod2str(M,2); // => * |
---|
23 | mod2str(M,-1); // => * |
---|
24 | |
---|
25 | // minor BUG: maybe it's better if the procedure complains about non-integer optional argument |
---|
26 | mod2str(M,"1"); |
---|
27 | |
---|
28 | // TODO: WHAT ABOUT ZERO? |
---|
29 | M = 0; |
---|
30 | mod2str(M); // TODO: FIX BUG: MUST BE JUST A ZERO! |
---|
31 | M = [0], [0], [1], [0, x]; |
---|
32 | mod2str(M); // TODO: FIX THIS BUGS! |
---|
33 | M = [1, x, y, z], [0, x], [2, y], [0]; |
---|
34 | mod2str(M); |
---|
35 | |
---|
36 | kill r; |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | ring r = (0,a),(x,y3,z(1)),dp; |
---|
41 | vector v = [-7,x,y3^4,x2,z(1)^3]; |
---|
42 | vct2str(v); |
---|
43 | vct2str(v,0); |
---|
44 | |
---|
45 | // same bugs here... |
---|
46 | vct2str(v,2); |
---|
47 | vct2str(v,-1); |
---|
48 | vct2str(v,"1"); |
---|
49 | |
---|
50 | vector w = [-7a^5+6a,x,y3,y3,x,z(1),z(1)]; |
---|
51 | vct2str(w); |
---|
52 | vct2str(w,1); |
---|
53 | // TODO: WHAT ABOUT ZERO? |
---|
54 | vector M = 0; |
---|
55 | vct2str(M); |
---|
56 | M = [0]; |
---|
57 | vct2str(M); |
---|
58 | M = [0, x, y3, z(1)]; |
---|
59 | vct2str(M,1); // TODO: FIX BUG: MUST BE ZERO! |
---|
60 | M = [1, x, 0, z(1)]; |
---|
61 | vct2str(M,1); |
---|
62 | M = [1, 0, z(1), 0, 0, x*y3, 0, 666]; |
---|
63 | vct2str(M,1); // TODO: FIX BUG: WHAT IS THIS??? |
---|
64 | |
---|
65 | kill r; |
---|
66 | |
---|
67 | ring r = 0,(x,y,z),(dp(1),dp(2)); |
---|
68 | module M = [-1,x,y],[-7,y,y],[3,x,x]; |
---|
69 | module N = [1,x,y,x,y],[-2,y,x,y,x],[6,x,y,y,x,y]; |
---|
70 | list L; L[1] = M; L[2] = N; |
---|
71 | lst2str(L); |
---|
72 | lst2str(L[1],0); |
---|
73 | |
---|
74 | // and here... |
---|
75 | lst2str(L[1],2); |
---|
76 | lst2str(L[1],-1); |
---|
77 | lst2str(L[1], "1"); |
---|
78 | M = [0, x, y3, z]; |
---|
79 | N = [1, 0, z, 0, 0, x*y3, 0, 666]; |
---|
80 | module MM = [0], [0], [1], [0, x]; |
---|
81 | module MMM = [1, x, y, z], [0, x], [2, y], [0]; |
---|
82 | list L; L[1] = M; L[2] = N; L[3] = MM; L[4] = MMM; |
---|
83 | lst2str(L); |
---|
84 | |
---|
85 | |
---|
86 | kill r; |
---|
87 | |
---|
88 | |
---|
89 | ring r = 0,(x,y),dp; |
---|
90 | isVar(xy+1); |
---|
91 | isVar(xy); |
---|
92 | isVar(y^3); |
---|
93 | poly i = 1; |
---|
94 | isVar(i); |
---|
95 | // ? |
---|
96 | isVar(1); |
---|
97 | int k = 1; |
---|
98 | isVar(k); |
---|
99 | |
---|
100 | // tiny BUG: No test for leading coefficient! |
---|
101 | isVar(2x); // Is "2x" an variable? |
---|
102 | isVar(2*x^3); |
---|
103 | isVar(2xy); |
---|
104 | |
---|
105 | kill r; |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | ring r = 0,(x,y,z),(dp(1),dp(2)); |
---|
111 | r; |
---|
112 | def A = freegbRing(2); setring A; |
---|
113 | A; |
---|
114 | attrib(A); |
---|
115 | if( attrib(A, "isLetterplaceRing") ) |
---|
116 | { |
---|
117 | "Uptodeg: ", attrib(A, "uptodeg"), ", lV: ", attrib(A, "lV"); |
---|
118 | } |
---|
119 | |
---|
120 | kill A, r; |
---|
121 | ring r = 0,(x(1..3)),(dp(1),lp(2)); |
---|
122 | r; |
---|
123 | def A = freegbRing(2); setring A; |
---|
124 | A; // OK |
---|
125 | attrib(A); |
---|
126 | if( attrib(A, "isLetterplaceRing") ) |
---|
127 | { |
---|
128 | "Uptodeg: ", attrib(A, "uptodeg"), ", lV: ", attrib(A, "lV"); |
---|
129 | } |
---|
130 | kill A, r; |
---|
131 | ring r = (0,a(1),b(1)),(a, b),(lp(1),dp(1)); |
---|
132 | r; |
---|
133 | def A = freegbRing(2); setring A; |
---|
134 | A; // BUG: parameter should not be named as a variable and vice verse! |
---|
135 | a(1); typeof(a(1)); |
---|
136 | kill A, r; |
---|
137 | ring r = 0,(x,y,z),dp; |
---|
138 | def R = nc_algebra(-1, 1); setring R; |
---|
139 | R; |
---|
140 | def A = freegbRing(2); setring A; |
---|
141 | A; // NOTE: the putput is a purely commutative ring! |
---|
142 | attrib(A); |
---|
143 | if( attrib(A, "isLetterplaceRing") ) |
---|
144 | { |
---|
145 | "Uptodeg: ", attrib(A, "uptodeg"), ", lV: ", attrib(A, "lV"); |
---|
146 | } |
---|
147 | kill A, R, r; |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | |
---|
152 | ring r = 0,(x,y,z),(dp(1),dp(2)); |
---|
153 | module M = [-1,x,y],[-7,y,y],[3,x,x]; |
---|
154 | module N = [1,x,y,x],[-1,y,x,y]; |
---|
155 | list L; L[1] = M; L[2] = N; |
---|
156 | lst2str(L); |
---|
157 | def U = freegbasis(L,5); |
---|
158 | lst2str(U); |
---|
159 | kill U; |
---|
160 | setring r; // non-homog. input: |
---|
161 | M = [-1,x,y],[-7,y,y,z],[3,x,x,x,z,z]; |
---|
162 | N = [1,x,y,z,x],[-1,y,x,y]; |
---|
163 | L[1] = M; L[2] = N; |
---|
164 | lst2str(L); |
---|
165 | def U = freegbasis(L,5); |
---|
166 | lst2str(U); // OK |
---|
167 | kill U,r; |
---|
168 | ring r = 0,(x,y,z),(dp(1),dp(2)); |
---|
169 | def R = nc_algebra(1,0); setring R; // should be the same as 1st! |
---|
170 | module M = [-1,x,y],[-7,y,y],[3,x,x]; |
---|
171 | module N = [1,x,y,x],[-1,y,x,y]; |
---|
172 | list L; L[1] = M; L[2] = N; |
---|
173 | lst2str(L); |
---|
174 | def U = freegbasis(L,5); |
---|
175 | lst2str(U); // OK |
---|
176 | kill U, R; |
---|
177 | setring r; |
---|
178 | def R = nc_algebra(-1,1); setring R; // some non-commutativity |
---|
179 | R; |
---|
180 | module M = [-1,x,y],[-7,y,y],[3,x,x]; |
---|
181 | module N = [1,x,y,x],[-1,y,x,y]; |
---|
182 | list L; L[1] = M; L[2] = N; |
---|
183 | lst2str(L); |
---|
184 | def U = freegbasis(L,5); |
---|
185 | lst2str(U); |
---|
186 | kill basering; |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | // static proc schur2-3() // How does Singular see it? |
---|
191 | |
---|
192 | /* |
---|
193 | TODO: BAD NAMES, SEE 3.9.1 Procedures in a library, 5^th rule. PLEASE RENAME: |
---|
194 | freegbRing(d); creates a ring with d blocks of shifted original variables |
---|
195 | freegbasis(L, int n); computes two-sided GB of ideal, up to degree n |
---|
196 | Liebr(a,b[, N]); computes Lie bracket ab-ba of two letterplace polys |
---|
197 | Serre(A,z); computes Serre's relations associated to Cartan matrix |
---|
198 | */ |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | $$$ |
---|