[fd3fb7] | 1 | // $Id: ainvar.lib,v 1.3 2000-12-19 15:05:15 anne Exp $ |
---|
[68e678] | 2 | ///////////////////////////////////////////////////////////////////////////// |
---|
| 3 | |
---|
[fd3fb7] | 4 | version="$Id: ainvar.lib,v 1.3 2000-12-19 15:05:15 anne Exp $"; |
---|
| 5 | category="Invariant theory"; |
---|
[5480da] | 6 | info=" |
---|
[82ed24] | 7 | LIBRARY: ainvar.lib PROCEDURES FOR COMPUTING INVARIANTS RINGS OF THE ADDITIVE GROUP |
---|
[68e678] | 8 | AUTHORS: Gerhard Pfister, email: pfister@mathematik.uni-kl.de |
---|
| 9 | Gert-Martin Greuel, email: greuel@mathematik.uni-kl.de |
---|
[4b35a90] | 10 | |
---|
[f34c37c] | 11 | PROCEDURES: |
---|
[68e678] | 12 | invariantRing(m..); compute ring of invariants of (K,+)-action given by m |
---|
[091424] | 13 | derivate(m,f); derivation of f with respect to the vectorfield m |
---|
[68e678] | 14 | actionIsProper(m); tests whether action defined by m is proper |
---|
| 15 | reduction(p,I); SAGBI reduction of p in the subring generated by I |
---|
[091424] | 16 | completeReduction(); complete SAGBI reduction |
---|
[68e678] | 17 | localInvar(m,p..); invariant polynomial under m computed from p,... |
---|
| 18 | furtherInvar(m..); compute further inariants of m from the given ones |
---|
[091424] | 19 | sortier(id); sorts generators of id by increasing leading terms |
---|
[5480da] | 20 | "; |
---|
[4b35a90] | 21 | |
---|
| 22 | LIB "inout.lib"; |
---|
| 23 | LIB "general.lib"; |
---|
[68e678] | 24 | LIB "algebra.lib"; |
---|
[4b35a90] | 25 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 26 | |
---|
[68e678] | 27 | proc sortier(id) |
---|
| 28 | "USAGE: sotier(id); id ideal/module |
---|
| 29 | RETURN: the same ideal/module but with generators ordered by there |
---|
| 30 | leading term, starting with the smallest |
---|
| 31 | EXAMPLE: example sortier; shows an example |
---|
| 32 | " |
---|
[4b35a90] | 33 | { |
---|
| 34 | if(size(id)==0) |
---|
[68e678] | 35 | {return(id); |
---|
[4b35a90] | 36 | } |
---|
| 37 | intvec i=sortvec(id); |
---|
| 38 | int j; |
---|
[68e678] | 39 | if( typeof(id)=="ideal") |
---|
| 40 | { ideal m; |
---|
| 41 | } |
---|
| 42 | if( typeof(id)=="module") |
---|
| 43 | { module m; |
---|
| 44 | } |
---|
| 45 | if( typeof(id)!="ideal" and typeof(id)!="module") |
---|
| 46 | { "// input must be of type ideal or module" |
---|
| 47 | return(); |
---|
| 48 | } |
---|
| 49 | for (j=1;j<=size(i);j++) |
---|
[4b35a90] | 50 | { |
---|
| 51 | m[j] = id[i[j]]; |
---|
| 52 | } |
---|
| 53 | return(m); |
---|
| 54 | } |
---|
[82716e] | 55 | example |
---|
[4b35a90] | 56 | { "EXAMPLE:"; echo = 2; |
---|
| 57 | ring q=0,(x,y,z,u,v,w),dp; |
---|
| 58 | ideal i=w,x,z,y,v; |
---|
[68e678] | 59 | sortier(i); |
---|
[4b35a90] | 60 | } |
---|
| 61 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 62 | |
---|
[091424] | 63 | proc derivate (matrix m, id) |
---|
| 64 | "USAGE: derivate(m,id); m matrix, id poly/vector/ideal |
---|
[68e678] | 65 | ASSUME: m is a nx1 matrix, where n = number of variables of the basering |
---|
[091424] | 66 | RETURN: poly/vector/ideal (same type as input), result of applying the |
---|
[68e678] | 67 | vectorfield by the matrix m componentwise to id; |
---|
[091424] | 68 | NOTE: the vectorfield is m[1,1]*d/dx(1) +...+ m[1,n]*d/dx(n) |
---|
| 69 | EXAMPLE: example derivate; shows an example |
---|
[d2b2a7] | 70 | " |
---|
[091424] | 71 | { |
---|
| 72 | execute (typeof(id)+ " j;"); |
---|
[68e678] | 73 | ideal I = ideal(id); |
---|
| 74 | matrix mh=matrix(jacob(I))*m; |
---|
| 75 | if(typeof(j)=="poly") |
---|
| 76 | { j = mh[1,1]; |
---|
| 77 | } |
---|
| 78 | else |
---|
| 79 | { j = mh[1]; |
---|
| 80 | } |
---|
| 81 | return(j); |
---|
[4b35a90] | 82 | } |
---|
[82716e] | 83 | example |
---|
[4b35a90] | 84 | { "EXAMPLE:"; echo = 2; |
---|
| 85 | ring q=0,(x,y,z,u,v,w),dp; |
---|
| 86 | poly f=2xz-y2; |
---|
[68e678] | 87 | matrix m[6][1] =x,y,0,u,v; |
---|
[091424] | 88 | derivate(m,f); |
---|
[68e678] | 89 | vector v = [2xz-y2,u6-3]; |
---|
[091424] | 90 | derivate(m,v); |
---|
| 91 | derivate(m,ideal(2xz-y2,u6-3)); |
---|
[4b35a90] | 92 | } |
---|
| 93 | |
---|
| 94 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 95 | |
---|
| 96 | proc actionIsProper(matrix m) |
---|
[8afd58] | 97 | "USAGE: actionIsProper(m); m matrix |
---|
[68e678] | 98 | ASSUME: m is a nx1 matrix, where n = number of variables of the basering |
---|
| 99 | RETURN: int = 1, if the action defined by m is proper, 0 if not |
---|
| 100 | NOTE: m defines a group action which is the exponential of the vector |
---|
| 101 | field m[1,1]*d/dx(1) +...+ m[1,n]*d/dx(n) |
---|
[4b35a90] | 102 | EXAMPLE: example actionIsProper; shows an example |
---|
[d2b2a7] | 103 | " |
---|
[4b35a90] | 104 | { |
---|
| 105 | int i; |
---|
| 106 | ideal id=maxideal(1); |
---|
| 107 | def bsr=basering; |
---|
| 108 | |
---|
| 109 | //changes the basering bsr to bsr[@t] |
---|
[034ce1] | 110 | execute("ring s="+charstr(basering)+",("+varstr(basering)+",@t),dp;"); |
---|
[4b35a90] | 111 | poly inv,delta,tee,j; |
---|
| 112 | ideal id=imap(bsr,id); |
---|
| 113 | matrix @m[size(id)+1][1]; |
---|
| 114 | @m=imap(bsr,m),0; |
---|
| 115 | |
---|
| 116 | //computes the exp(@t*m)(var(i)) for all i |
---|
| 117 | for(i=1;i<=nvars(basering)-1;i++) |
---|
| 118 | { |
---|
| 119 | inv=var(i); |
---|
[091424] | 120 | delta=derivate(@m,inv); |
---|
[4b35a90] | 121 | j=1; |
---|
| 122 | tee=@t; |
---|
| 123 | while(delta!=0) |
---|
| 124 | { |
---|
| 125 | inv=inv+1/j*delta*tee; |
---|
| 126 | j=j*(j+1); |
---|
| 127 | tee=tee*@t; |
---|
[091424] | 128 | delta=derivate(@m,delta); |
---|
[4b35a90] | 129 | } |
---|
[82716e] | 130 | id=id+ideal(inv); |
---|
[4b35a90] | 131 | } |
---|
| 132 | i=inSubring(@t,id)[1]; |
---|
| 133 | setring(bsr); |
---|
| 134 | return(i); |
---|
| 135 | } |
---|
[82716e] | 136 | example |
---|
[4b35a90] | 137 | { "EXAMPLE:"; echo = 2; |
---|
| 138 | |
---|
[68e678] | 139 | ring rf=0,x(1..7),dp; |
---|
[4b35a90] | 140 | matrix m[7][1]; |
---|
| 141 | m[4,1]=x(1)^3; |
---|
| 142 | m[5,1]=x(2)^3; |
---|
| 143 | m[6,1]=x(3)^3; |
---|
| 144 | m[7,1]=(x(1)*x(2)*x(3))^2; |
---|
| 145 | actionIsProper(m); |
---|
| 146 | |
---|
[68e678] | 147 | ring rd=0,x(1..5),dp; |
---|
[4b35a90] | 148 | matrix m[5][1]; |
---|
| 149 | m[3,1]=x(1); |
---|
| 150 | m[4,1]=x(2); |
---|
[dc3a44] | 151 | m[5,1]=1+x(1)*x(4)^2; |
---|
[4b35a90] | 152 | actionIsProper(m); |
---|
| 153 | } |
---|
| 154 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 155 | |
---|
[e801fe] | 156 | proc reduction(poly p, ideal dom, list #) |
---|
[68e678] | 157 | "USAGE: reduction(p,I[,q,n]); p poly, I ideal, [q monomial, n int (optional)] |
---|
| 158 | RETURN: a polynomial equal to p-H(f1,...,fr), in case the leading |
---|
[091424] | 159 | term LT(p) of p is of the form H(LT(f1),...,LT(fr)) for some |
---|
[68e678] | 160 | polynomial H in r variables over the base field, I=f1,...,fr; |
---|
[091424] | 161 | if q is given, a maximal power a is computed such that q^a devides |
---|
[68e678] | 162 | p-H(f1,...,fr), and then (p-H(f1,...,fr))/q^a is returned; |
---|
| 163 | return p if no H is found |
---|
| 164 | if n=1, a different algorithm is choosen which is sometimes faster |
---|
| 165 | (default: n=0; q and n can be given (or not) in any order) |
---|
[091424] | 166 | NOTE: this is a kind of SAGBI reduction in the subalgebra K[f1,...,fr] of |
---|
[68e678] | 167 | the basering |
---|
[4b35a90] | 168 | EXAMPLE: example reduction; shows an example |
---|
[d2b2a7] | 169 | " |
---|
[4b35a90] | 170 | { |
---|
[68e678] | 171 | int i,choose; |
---|
| 172 | int z=ncols(dom); |
---|
[4b35a90] | 173 | def bsr=basering; |
---|
[68e678] | 174 | if( size(#) >0 ) |
---|
| 175 | { if( typeof(#[1]) == "int") |
---|
| 176 | { choose = #[1]; |
---|
| 177 | } |
---|
| 178 | if( typeof(#[1]) == "poly") |
---|
| 179 | { poly q = #[1]; |
---|
| 180 | } |
---|
| 181 | if( size(#)>1 ) |
---|
| 182 | { if( typeof(#[2]) == "poly") |
---|
| 183 | { poly q = #[2]; |
---|
| 184 | } |
---|
| 185 | if( typeof(#[2]) == "int") |
---|
| 186 | { choose = #[2]; |
---|
| 187 | } |
---|
| 188 | } |
---|
[4b35a90] | 189 | } |
---|
[6a0d85] | 190 | |
---|
[68e678] | 191 | // -------------------- first algorithm (default) ----------------------- |
---|
| 192 | if ( choose == 0 ) |
---|
[4b35a90] | 193 | { |
---|
[68e678] | 194 | list L = algebra_containment(lead(p),lead(dom),1); |
---|
| 195 | if( L[1]==1 ) |
---|
| 196 | { |
---|
| 197 | // the ring L[2] = char(bsr),(x(1..nvars(bsr)),y(1..z)),(dp(n),dp(m)), |
---|
| 198 | // contains poly check s.t. LT(p) is of the form check(LT(f1),...,LT(fr)) |
---|
| 199 | def s1 = L[2]; |
---|
| 200 | map psi = s1,maxideal(1),dom; |
---|
| 201 | poly re = p - psi(check); |
---|
| 202 | // devide by the maximal power of #[1] |
---|
[5e0891c] | 203 | if ( defined(q) == voice ) |
---|
[68e678] | 204 | { while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0)) |
---|
| 205 | { re=re/#[1]; |
---|
| 206 | } |
---|
| 207 | } |
---|
| 208 | return(re); |
---|
| 209 | } |
---|
| 210 | return(p); |
---|
[091424] | 211 | } |
---|
[68e678] | 212 | // ------------------------- second algorithm --------------------------- |
---|
| 213 | else |
---|
| 214 | { |
---|
| 215 | //----------------- arranges the monomial v for elimination ------------- |
---|
| 216 | poly v=product(maxideal(1)); |
---|
[82716e] | 217 | |
---|
[68e678] | 218 | //------------- changes the basering bsr to bsr[@(0),...,@(z)] ---------- |
---|
[034ce1] | 219 | execute("ring s="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;"); |
---|
[091424] | 220 | // Ev hier die Reihenfolge der Vars aendern. Dazu muss unten aber entsprechend |
---|
| 221 | // geaendert werden: |
---|
[034ce1] | 222 | // execute("ring s="+charstr(basering)+",(@(0..z),"+varstr(basering)+"),dp;"); |
---|
[4b35a90] | 223 | |
---|
[68e678] | 224 | //constructs the leading ideal of dom=(p-@(0),dom[1]-@(1),...,dom[z]-@(z)) |
---|
| 225 | ideal dom=imap(bsr,dom); |
---|
| 226 | for (i=1;i<=z;i++) |
---|
[4b35a90] | 227 | { |
---|
[68e678] | 228 | dom[i]=lead(dom[i])-var(nvars(bsr)+i+1); |
---|
| 229 | } |
---|
| 230 | dom=lead(imap(bsr,p))-@(0),dom; |
---|
[5e0891c] | 231 | |
---|
[68e678] | 232 | //---------- eliminates the variables of the basering bsr -------------- |
---|
| 233 | //i.e. computes dom intersected with K[@(0),...,@(z)] (this is hard) |
---|
| 234 | //### hier Variante analog zu algebra_containment einbauen! |
---|
| 235 | ideal kern=eliminate(dom,imap(bsr,v)); |
---|
| 236 | |
---|
| 237 | //--------- test wether @(0)-h(@(1),...,@(z)) is in ker --------------- |
---|
| 238 | // for some poly h and divide by maximal power of q=#[1] |
---|
| 239 | poly h; |
---|
| 240 | z=size(kern); |
---|
| 241 | for (i=1;i<=z;i++) |
---|
| 242 | { |
---|
| 243 | h=kern[i]/@(0); |
---|
| 244 | if (deg(h)==0) |
---|
| 245 | { h=(1/h)*kern[i]; |
---|
| 246 | // define the map psi : s ---> bsr defined by @(i) ---> p,dom[i] |
---|
| 247 | setring bsr; |
---|
| 248 | map psi=s,maxideal(1),p,dom; |
---|
| 249 | poly re=psi(h); |
---|
| 250 | // devide by the maximal power of #[1] |
---|
| 251 | if (size(#)>0) |
---|
| 252 | { while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0)) |
---|
| 253 | { re=re/#[1]; |
---|
| 254 | } |
---|
[4b35a90] | 255 | } |
---|
[68e678] | 256 | return(re); |
---|
[4b35a90] | 257 | } |
---|
| 258 | } |
---|
[68e678] | 259 | setring bsr; |
---|
| 260 | return(p); |
---|
[4b35a90] | 261 | } |
---|
| 262 | } |
---|
[091424] | 263 | |
---|
[82716e] | 264 | example |
---|
[4b35a90] | 265 | { "EXAMPLE:"; echo = 2; |
---|
| 266 | ring q=0,(x,y,z,u,v,w),dp; |
---|
| 267 | poly p=x2yz-x2v; |
---|
[e801fe] | 268 | ideal dom =x-w,u2w+1,yz-v; |
---|
| 269 | reduction(p,dom); |
---|
| 270 | reduction(p,dom,w); |
---|
[4b35a90] | 271 | } |
---|
| 272 | |
---|
| 273 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 274 | |
---|
[e801fe] | 275 | proc completeReduction(poly p, ideal dom, list #) |
---|
[68e678] | 276 | "USAGE: completeReduction(p,I[,q,n]); p poly, I ideal, [q monomial, n int] |
---|
| 277 | RETURN: a polynomial, the SAGBI reduction of the polynomial p with I |
---|
| 278 | via the procedure 'reduction' as long as possible |
---|
| 279 | if n=1, a different algorithm is choosen which is sometimes faster |
---|
| 280 | (default: n=0; q and n can be given (or not) in any order) |
---|
| 281 | NOTE: help reduction; shows an explanation of SAGBI reduction |
---|
[4b35a90] | 282 | EXAMPLE: example completeReduction; shows an example |
---|
[d2b2a7] | 283 | " |
---|
[4b35a90] | 284 | { |
---|
| 285 | poly p1=p; |
---|
[e801fe] | 286 | poly p2=reduction(p,dom,#); |
---|
[4b35a90] | 287 | while (p1!=p2) |
---|
| 288 | { |
---|
| 289 | p1=p2; |
---|
[e801fe] | 290 | p2=reduction(p1,dom,#); |
---|
[4b35a90] | 291 | } |
---|
| 292 | return(p2); |
---|
| 293 | } |
---|
[82716e] | 294 | example |
---|
[4b35a90] | 295 | { "EXAMPLE:"; echo = 2; |
---|
| 296 | ring q=0,(x,y,z,u,v,w),dp; |
---|
| 297 | poly p=x2yz-x2v; |
---|
[e801fe] | 298 | ideal dom =x-w,u2w+1,yz-v; |
---|
| 299 | completeReduction(p,dom); |
---|
| 300 | completeReduction(p,dom,w); |
---|
[4b35a90] | 301 | } |
---|
| 302 | |
---|
| 303 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 304 | |
---|
[6a0d85] | 305 | proc completeReductionnew(poly p, ideal dom, list #) |
---|
| 306 | "USAGE: completeReduction(p,I[,q,n]); p poly, I ideal, [q monomial, n int] |
---|
| 307 | RETURN: a polynomial, the SAGBI reduction of the polynomial p with I |
---|
| 308 | via the procedure 'reduction' as long as possible |
---|
| 309 | if n=1, a different algorithm is choosen which is sometimes faster |
---|
| 310 | (default: n=0; q and n can be given (or not) in any order) |
---|
| 311 | NOTE: help reduction; shows an explanation of SAGBI reduction |
---|
| 312 | EXAMPLE: example completeReduction; shows an example |
---|
| 313 | " |
---|
| 314 | { |
---|
| 315 | if(p==0) |
---|
| 316 | { |
---|
| 317 | return(p); |
---|
| 318 | } |
---|
| 319 | poly p1=p; |
---|
| 320 | poly p2=reduction(p,dom,#); |
---|
| 321 | while (p1!=p2) |
---|
| 322 | { |
---|
| 323 | p1=p2; |
---|
| 324 | p2=reduction(p1,dom,#); |
---|
| 325 | } |
---|
| 326 | poly re=lead(p2)+completeReduction(p2-lead(p2),dom,#); |
---|
| 327 | return(re); |
---|
| 328 | } |
---|
| 329 | |
---|
| 330 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 331 | |
---|
[4b35a90] | 332 | proc localInvar(matrix m, poly p, poly q, poly h) |
---|
[68e678] | 333 | "USAGE: localInvar(m,p,q,h); m matrix, p,q,h polynomials |
---|
| 334 | ASSUME: m(q) and h are invariant under the vectorfield m, i.e. m(m(q))=m(h)=0 |
---|
| 335 | h must be a ring variable |
---|
| 336 | RETURN: a polynomial, the invariant polynomial of the vectorfield |
---|
[091424] | 337 | m = m[1,1]*d/dx(1) +...+ m[n,1]*d/dx(n) |
---|
| 338 | with respect to p,q,h. It is defined as follows: set inv = p if p is |
---|
[68e678] | 339 | invariant, and else as |
---|
| 340 | inv = m(q)^N * sum_i=1..N-1{ (-1)^i*(1/i!)*m^i(p)*(q/m(q))^i } |
---|
| 341 | where m^N(p) = 0, m^(N-1)(p) != 0; |
---|
| 342 | the result is inv divided by h as much as possible |
---|
[4b35a90] | 343 | EXAMPLE: example localInvar; shows an example |
---|
[d2b2a7] | 344 | " |
---|
[4b35a90] | 345 | { |
---|
[091424] | 346 | if ((derivate(m,h) !=0) || (derivate(m,derivate(m,q)) !=0)) |
---|
[4b35a90] | 347 | { |
---|
[68e678] | 348 | "//the last two polynomials of the input must be invariant functions"; |
---|
[4b35a90] | 349 | return(q); |
---|
| 350 | } |
---|
[68e678] | 351 | int ii,k; |
---|
| 352 | for ( k=1; k <= nvars(basering); k++ ) |
---|
| 353 | { if (h == var(k)) |
---|
| 354 | { ii=1; |
---|
| 355 | } |
---|
| 356 | } |
---|
| 357 | if( ii==0 ) |
---|
| 358 | { "// the last argument must be a ring variable"; |
---|
| 359 | return(q); |
---|
| 360 | } |
---|
[091424] | 361 | |
---|
[4b35a90] | 362 | poly inv=p; |
---|
[091424] | 363 | poly dif= derivate(m,inv); |
---|
| 364 | poly a=derivate(m,q); |
---|
[4b35a90] | 365 | poly sgn=-1; |
---|
| 366 | poly coeff=sgn*q; |
---|
[68e678] | 367 | k=1; |
---|
[4b35a90] | 368 | if (dif==0) |
---|
| 369 | { |
---|
| 370 | return(inv); |
---|
| 371 | } |
---|
[82716e] | 372 | while (dif!=0) |
---|
[4b35a90] | 373 | { |
---|
| 374 | inv=(a*inv)+(coeff*dif); |
---|
[091424] | 375 | dif=derivate(m,dif); |
---|
[4b35a90] | 376 | k=k+1; |
---|
| 377 | coeff=q*coeff*sgn/k; |
---|
| 378 | } |
---|
| 379 | while ((inv!=0) && (inv!=h) &&(subst(inv,h,0)==0)) |
---|
| 380 | { |
---|
| 381 | inv=inv/h; |
---|
| 382 | } |
---|
| 383 | return(inv); |
---|
| 384 | } |
---|
[82716e] | 385 | example |
---|
[4b35a90] | 386 | { "EXAMPLE:"; echo = 2; |
---|
| 387 | ring q=0,(x,y,z),dp; |
---|
| 388 | matrix m[3][1]; |
---|
| 389 | m[2,1]=x; |
---|
| 390 | m[3,1]=y; |
---|
| 391 | poly in=localInvar(m,z,y,x); |
---|
| 392 | in; |
---|
| 393 | } |
---|
| 394 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 395 | |
---|
[68e678] | 396 | proc furtherInvar(matrix m, ideal id, ideal karl, poly q, list #) |
---|
| 397 | "USAGE: furtherInvar(m,id,karl,q); m matrix, id,karl ideals, q poly, n int |
---|
| 398 | ASSUME: karl,id,q are invariant under the vectorfield m, |
---|
| 399 | moreover, q must be a variable |
---|
[091424] | 400 | RETURN: list of two ideals, the first ideal contains further invariants of |
---|
| 401 | the vectorfield |
---|
[68e678] | 402 | m = sum m[i,1]*d/dx(i) with respect to id,p,q, |
---|
[091424] | 403 | i.e. we compute elements in the (invariant) subring generated by id |
---|
[68e678] | 404 | which are divisible by q and divde them by q as much as possible |
---|
| 405 | the second ideal contains all invariants given before |
---|
| 406 | if n=1, a different algorithm is choosen which is sometimes faster |
---|
| 407 | (default: n=0) |
---|
[4b35a90] | 408 | EXAMPLE: example furtherInvar; shows an example |
---|
[d2b2a7] | 409 | " |
---|
[4b35a90] | 410 | { |
---|
[68e678] | 411 | list ll = q; |
---|
| 412 | if ( size(#)>0 ) |
---|
| 413 | { ll = ll+list(#[1]); |
---|
[091424] | 414 | } |
---|
[4b35a90] | 415 | int i; |
---|
| 416 | ideal null; |
---|
[68e678] | 417 | int z=ncols(id); |
---|
[4b35a90] | 418 | intvec v; |
---|
[68e678] | 419 | def br=basering; |
---|
[4b35a90] | 420 | ideal su; |
---|
[68e678] | 421 | for (i=1; i<=z; i++) |
---|
[4b35a90] | 422 | { |
---|
[091424] | 423 | su[i]=subst(id[i],q,0); |
---|
[4b35a90] | 424 | } |
---|
[68e678] | 425 | // -- define the map phi : r1 ---> br defined by y(i) ---> id[i](q=0) -- |
---|
| 426 | execute ("ring r1="+charstr(basering)+",(y(1..z)),dp;"); |
---|
| 427 | setring br; |
---|
[4b35a90] | 428 | map phi=r1,su; |
---|
[82716e] | 429 | setring r1; |
---|
[68e678] | 430 | // --------------- compute the kernel of phi --------------------------- |
---|
| 431 | ideal ker=preimage(br,phi,null); |
---|
[6a0d85] | 432 | ker=mstd(ker)[2]; |
---|
[68e678] | 433 | // ---- define the map psi : r1 ---> br defined by y(i) ---> id[i] ----- |
---|
| 434 | setring br; |
---|
[4b35a90] | 435 | map psi=r1,id; |
---|
[68e678] | 436 | // ------------------- compute psi(ker(phi)) -------------------------- |
---|
[4b35a90] | 437 | ideal rel=psi(ker); |
---|
[68e678] | 438 | // devide by maximal power of q, test wether we really obtain invariants |
---|
[4b35a90] | 439 | for (i=1;i<=size(rel);i++) |
---|
| 440 | { |
---|
| 441 | while ((rel[i]!=0) && (rel[i]!=q) &&(subst(rel[i],q,0)==0)) |
---|
| 442 | { |
---|
| 443 | rel[i]=rel[i]/q; |
---|
[091424] | 444 | if (derivate(m,rel[i])!=0) |
---|
[4b35a90] | 445 | { |
---|
[68e678] | 446 | "// error in furtherInvar, function not invariant:"; |
---|
[4b35a90] | 447 | rel[i]; |
---|
| 448 | } |
---|
| 449 | } |
---|
| 450 | rel[i]=simplify(rel[i],1); |
---|
| 451 | } |
---|
[68e678] | 452 | // --------------------------------------------------------------------- |
---|
[091424] | 453 | // test whether some variables occur linearly and then delete the |
---|
[68e678] | 454 | // corresponding invariant function |
---|
[4b35a90] | 455 | setring r1; |
---|
| 456 | int j; |
---|
| 457 | for (i=1;i<=size(ker);i=i+1) |
---|
| 458 | { |
---|
| 459 | for (j=1;j<=z;j++) |
---|
| 460 | { |
---|
| 461 | if (deg(ker[i]/y(j))==0) |
---|
| 462 | { |
---|
[68e678] | 463 | setring br; |
---|
| 464 | rel[i]= completeReduction(rel[i],karl,ll); |
---|
[4b35a90] | 465 | if(rel[i]!=0) |
---|
| 466 | { |
---|
| 467 | karl[j+1]=rel[i]; |
---|
| 468 | rel[i]=0; |
---|
| 469 | } |
---|
| 470 | setring r1; |
---|
| 471 | } |
---|
| 472 | } |
---|
[82716e] | 473 | |
---|
[4b35a90] | 474 | } |
---|
[68e678] | 475 | setring br; |
---|
[4b35a90] | 476 | list l=rel+null,karl; |
---|
| 477 | return(l); |
---|
| 478 | } |
---|
[82716e] | 479 | example |
---|
[4b35a90] | 480 | { "EXAMPLE:"; echo = 2; |
---|
| 481 | ring r=0,(x,y,z,u),dp; |
---|
| 482 | matrix m[4][1]; |
---|
| 483 | m[2,1]=x; |
---|
| 484 | m[3,1]=y; |
---|
| 485 | m[4,1]=z; |
---|
| 486 | ideal id=localInvar(m,z,y,x),localInvar(m,u,y,x); |
---|
| 487 | ideal karl=id,x; |
---|
| 488 | list in=furtherInvar(m,id,karl,x); |
---|
| 489 | in; |
---|
| 490 | } |
---|
| 491 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 492 | |
---|
[091424] | 493 | proc invariantRing(matrix m, poly p, poly q, int b, list #) |
---|
| 494 | "USAGE: invariantRing(m,p,q,b[,r,pa]); m matrix, p,q poly, b,r int, pa string |
---|
[68e678] | 495 | ASSUME: p,q variables with m(p)=q and q invariant under m |
---|
[091424] | 496 | i.e. if p=x(i) and q=x(j) then m[j,1]=0 and m[i,1]=x(j) |
---|
| 497 | RETURN: ideal, containing generators of the ring of invariants of the |
---|
| 498 | additive gropup (K,+) given by the vectorfield |
---|
[68e678] | 499 | m = m[1,1]*d/dx(1) +...+ m[n,1]*d/dx(n). |
---|
[091424] | 500 | If b>0 the computation stops after all invariants of degree <= b |
---|
| 501 | (and at least one of higher degree) are found or when all invariants |
---|
[68e678] | 502 | are computed. |
---|
[091424] | 503 | If b<=0, the computation continues until all generators |
---|
[68e678] | 504 | of the ring of invariants are computed (should be used only if the |
---|
| 505 | ring of invariants is known to be finitey generated otherwise the |
---|
[091424] | 506 | algorithm might not stop). |
---|
[68e678] | 507 | If r=1 a different reduction is used which is sometimes faster |
---|
[091424] | 508 | (default r=0). |
---|
| 509 | DISPLAY: if pa is given (any string as 5th or 6th argument), the computation |
---|
[68e678] | 510 | pauses whenever new invariants are found and displays them |
---|
[091424] | 511 | THEORY: The algoritm to compute the ring of invariants works in char 0 |
---|
| 512 | or big enough characteristic. (K,+) acts as the exponential of the |
---|
[68e678] | 513 | vectorfield defined by the matrix m. For background see G.-M. Greuel, |
---|
| 514 | G. Pfister, Geometric quotients of unipotent group actions, Proc. |
---|
| 515 | London Math. Soc. ??,???,1993? |
---|
[091424] | 516 | EXAMPLE: example invariantRing; shows an example |
---|
[d2b2a7] | 517 | " |
---|
[4b35a90] | 518 | { |
---|
| 519 | ideal j; |
---|
| 520 | int i,it; |
---|
[68e678] | 521 | list ll=q; |
---|
[091424] | 522 | int bou=b; |
---|
[68e678] | 523 | if( size(#) >0 ) |
---|
| 524 | { if( typeof(#[1]) == "int") |
---|
| 525 | { ll=ll+list(#[1]); |
---|
| 526 | } |
---|
| 527 | if( typeof(#[1]) == "string") |
---|
| 528 | { string pau=#[1]; |
---|
| 529 | } |
---|
| 530 | if( size(#)>1 ) |
---|
| 531 | { if( typeof(#[2]) == "string") |
---|
| 532 | { string pau=#[2]; |
---|
| 533 | } |
---|
| 534 | if( typeof(#[2]) == "int") |
---|
| 535 | { ll=ll+list(#[2]); |
---|
| 536 | } |
---|
| 537 | } |
---|
[4b35a90] | 538 | } |
---|
[82716e] | 539 | int z; |
---|
[4b35a90] | 540 | ideal karl; |
---|
| 541 | ideal k1=1; |
---|
| 542 | list k2; |
---|
[68e678] | 543 | //------------------ computation of local invariants ------------------ |
---|
[4b35a90] | 544 | for (i=1;i<=nvars(basering);i++) |
---|
| 545 | { |
---|
| 546 | karl=karl+localInvar(m,var(i),p,q); |
---|
| 547 | } |
---|
[091424] | 548 | if( defined(pau) ) |
---|
[68e678] | 549 | { ""; |
---|
| 550 | "// local invariants computed:"; |
---|
| 551 | ""; |
---|
[4b35a90] | 552 | karl; |
---|
[68e678] | 553 | ""; |
---|
[5e0891c] | 554 | pause("// hit return key to continue!"); |
---|
| 555 | ""; |
---|
[4b35a90] | 556 | } |
---|
[68e678] | 557 | //------------------ computation of further invariants ---------------- |
---|
[4b35a90] | 558 | it=0; |
---|
| 559 | while (size(k1)!=0) |
---|
[68e678] | 560 | { |
---|
[82716e] | 561 | // test if the new invariants are already in the ring generated |
---|
[68e678] | 562 | // by the invariants we constructed so far |
---|
[4b35a90] | 563 | it++; |
---|
| 564 | karl=sortier(karl); |
---|
| 565 | j=q; |
---|
| 566 | for (i=1;i<=size(karl);i++) |
---|
| 567 | { |
---|
[68e678] | 568 | j=j + simplify(completeReduction(karl[i],j,ll),1); |
---|
[4b35a90] | 569 | } |
---|
| 570 | karl=j; |
---|
| 571 | j[1]=0; |
---|
| 572 | j=simplify(j,2); |
---|
| 573 | k2=furtherInvar(m,j,karl,q); |
---|
| 574 | k1=k2[1]; |
---|
| 575 | karl=k2[2]; |
---|
| 576 | k1=sortier(k1); |
---|
[82716e] | 577 | z=size(k1); |
---|
[6a0d85] | 578 | |
---|
[4b35a90] | 579 | for (i=1;i<=z;i++) |
---|
| 580 | { |
---|
[68e678] | 581 | k1[i]= completeReduction(k1[i],karl,ll); |
---|
[4b35a90] | 582 | if (k1[i]!=0) |
---|
| 583 | { |
---|
| 584 | karl=karl+simplify(k1[i],1); |
---|
| 585 | } |
---|
| 586 | } |
---|
[5e0891c] | 587 | if( defined(pau) == voice) |
---|
| 588 | { |
---|
[68e678] | 589 | "// the invariants after",it,"iteration(s):"; ""; |
---|
| 590 | karl;""; |
---|
[5e0891c] | 591 | pause("// hit return key to continue!"); |
---|
[68e678] | 592 | ""; |
---|
[4b35a90] | 593 | } |
---|
[68e678] | 594 | if( (bou>0) && (size(k1)>0) ) |
---|
[4b35a90] | 595 | { |
---|
[68e678] | 596 | if( deg(k1[size(k1)])>bou ) |
---|
[4b35a90] | 597 | { |
---|
| 598 | return(karl); |
---|
| 599 | } |
---|
| 600 | } |
---|
| 601 | } |
---|
| 602 | return(karl); |
---|
| 603 | } |
---|
[82716e] | 604 | example |
---|
[4b35a90] | 605 | { "EXAMPLE:"; echo = 2; |
---|
| 606 | |
---|
[091424] | 607 | //Winkelmann: free action but Spec(k[x(1),...,x(5)]) --> Spec(invariant ring) |
---|
[68e678] | 608 | //is not surjective |
---|
[82716e] | 609 | |
---|
[4b35a90] | 610 | ring rw=0,(x(1..5)),dp; |
---|
| 611 | matrix m[5][1]; |
---|
| 612 | m[3,1]=x(1); |
---|
| 613 | m[4,1]=x(2); |
---|
| 614 | m[5,1]=1+x(1)*x(4)+x(2)*x(3); |
---|
[091424] | 615 | ideal in=invariantRing(m,x(3),x(1),0); //compute full invarint ring |
---|
[4b35a90] | 616 | in; |
---|
[82716e] | 617 | |
---|
[4b35a90] | 618 | //Deveney/Finston: The ring of invariants is not finitely generated |
---|
[82716e] | 619 | |
---|
[4b35a90] | 620 | ring rf=0,(x(1..7)),dp; |
---|
| 621 | matrix m[7][1]; |
---|
| 622 | m[4,1]=x(1)^3; |
---|
| 623 | m[5,1]=x(2)^3; |
---|
| 624 | m[6,1]=x(3)^3; |
---|
| 625 | m[7,1]=(x(1)*x(2)*x(3))^2; |
---|
[68e678] | 626 | ideal in=invariantRing(m,x(4),x(1),6); //all invariants up to degree 6 |
---|
[4b35a90] | 627 | in; |
---|
[68e678] | 628 | } |
---|
[82716e] | 629 | |
---|
[68e678] | 630 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 631 | /* Further examplex |
---|
[091424] | 632 | |
---|
[68e678] | 633 | //Deveney/Finston: Proper Ga-action which is not locally trivial |
---|
[4b35a90] | 634 | //r[x(1),...,x(5)] is not flat over the ring of invariants |
---|
[68e678] | 635 | LIB "invar.lib"; |
---|
[4b35a90] | 636 | ring rd=0,(x(1..5)),dp; |
---|
| 637 | matrix m[5][1]; |
---|
| 638 | m[3,1]=x(1); |
---|
| 639 | m[4,1]=x(2); |
---|
| 640 | m[5,1]=1+x(1)*x(4)^2; |
---|
[68e678] | 641 | ideal in=invariantRing(m,x(3),x(1),0,1); |
---|
[4b35a90] | 642 | in; |
---|
[82716e] | 643 | |
---|
[4b35a90] | 644 | actionIsProper(m); |
---|
[82716e] | 645 | |
---|
[68e678] | 646 | //compute the algebraic relations between the invariants |
---|
[4b35a90] | 647 | int z=size(in); |
---|
| 648 | ideal null; |
---|
| 649 | ring r1=0,(y(1..z)),dp; |
---|
| 650 | setring rd; |
---|
| 651 | map phi=r1,in; |
---|
[82716e] | 652 | setring r1; |
---|
| 653 | ideal ker=preimage(rd,phi,null); |
---|
[4b35a90] | 654 | ker; |
---|
[82716e] | 655 | |
---|
[4b35a90] | 656 | //the discriminant |
---|
[82716e] | 657 | |
---|
[4b35a90] | 658 | ring r=0,(x(1..2),y(1..2),z,t),dp; |
---|
| 659 | poly p=z+(1+x(1)*y(2)^2)*t+x(1)*y(1)*y(2)*t^2+(1/3)*x(1)*y(1)^2*t^3; |
---|
[82716e] | 660 | |
---|
[4b35a90] | 661 | matrix m[5][5]; |
---|
| 662 | m[1,1]=z; |
---|
| 663 | m[1,2]=x(1)*y(2)^2+1; |
---|
| 664 | m[1,3]=x(1)*y(1)*y(2); |
---|
| 665 | m[1,4]=1/3*x(1)*y(1)^2; |
---|
| 666 | m[1,5]=0; |
---|
| 667 | m[2,1]=0; |
---|
| 668 | m[2,2]=z; |
---|
| 669 | m[2,3]=x(1)*y(2)^2+1; |
---|
| 670 | m[2,4]=x(1)*y(1)*y(2); |
---|
| 671 | m[2,5]=1/3*x(1)*y(1)^2; |
---|
| 672 | m[3,1]=x(1)*y(2)^2+1; |
---|
| 673 | m[3,2]=2*x(1)*y(1)*y(2); |
---|
| 674 | m[3,3]=x(1)*y(1)^2; |
---|
| 675 | m[3,4]=0; |
---|
| 676 | m[3,5]=0; |
---|
| 677 | m[4,1]=0; |
---|
| 678 | m[4,2]=x(1)*y(2)^2+1; |
---|
| 679 | m[4,3]=2*x(1)*y(1)*y(2); |
---|
| 680 | m[4,4]=x(1)*y(1)^2; |
---|
| 681 | m[4,5]=0; |
---|
| 682 | m[5,1]=0; |
---|
| 683 | m[5,2]=0; |
---|
| 684 | m[5,3]=x(1)*y(2)^2+1; |
---|
| 685 | m[5,4]=2*x(1)*y(1)*y(2); |
---|
| 686 | m[5,5]=x(1)*y(1)^2; |
---|
[82716e] | 687 | |
---|
[4b35a90] | 688 | poly disc=9*det(m)/(x(1)^2*y(1)^4); |
---|
[82716e] | 689 | |
---|
[68e678] | 690 | LIB "invar.lib"; |
---|
[4b35a90] | 691 | matrix n[6][1]; |
---|
| 692 | n[2,1]=x(1); |
---|
| 693 | n[4,1]=y(1); |
---|
| 694 | n[5,1]=1+x(1)*y(2)^2; |
---|
[82716e] | 695 | |
---|
[091424] | 696 | derivate(n,disc); |
---|
[82716e] | 697 | |
---|
[68e678] | 698 | //x(1)^3*y(2)^6-6*x(1)^2*y(1)*y(2)^3*z+6*x(1)^2*y(2)^4+9*x(1)*y(1)^2*z^2-18*x(1)*y(1)*y(2)*z+9*x(1)*y(2)^2+4 |
---|
[82716e] | 699 | |
---|
[68e678] | 700 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 701 | //constructive approach to Weizenboecks theorem |
---|
[82716e] | 702 | |
---|
[68e678] | 703 | int n=5; |
---|
| 704 | // int n=6; //limit |
---|
| 705 | ring w=32003,(x(1..n)),wp(1..n); |
---|
[82716e] | 706 | |
---|
[4b35a90] | 707 | // definition of the vectorfield m=sum m[i]*d/dx(i) |
---|
| 708 | matrix m[n][1]; |
---|
| 709 | int i; |
---|
| 710 | for (i=1;i<=n-1;i=i+1) |
---|
| 711 | { |
---|
| 712 | m[i+1,1]=x(i); |
---|
| 713 | } |
---|
[68e678] | 714 | ideal in=invariantRing(m,x(2),x(1),0,""); |
---|
[6a0d85] | 715 | |
---|
[4b35a90] | 716 | in; |
---|
[68e678] | 717 | */ |
---|