source: git/Singular/LIB/involut.lib @ d41540

spielwiese
Last change on this file since d41540 was d41540, checked in by Frank Seelisch <seelisch@…>, 15 years ago
removed some typos etc. prior to release 3-1-0 git-svn-id: file:///usr/local/Singular/svn/trunk@11661 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 23.1 KB
Line 
1version="$Id: involut.lib,v 1.16 2009-04-09 12:04:41 seelisch Exp $";
2category="Noncommutative";
3info="
4LIBRARY:  involut.lib  Computations and operations with involutions
5AUTHORS:  Oleksandr Iena,       yena@mathematik.uni-kl.de,
6@*        Markus Becker,        mbecker@mathematik.uni-kl.de,
7@*        Viktor Levandovskyy,  levandov@mathematik.uni-kl.de
8
9THEORY: Involution is an anti-isomorphism of a noncommutative algebra with the
10 property that applied an involution twice, one gets an identity. Involution is linear with respect to the ground field. In this library we compute linear involutions, distinguishing the case of a diagonal matrix (such involutions are called homothetic) and a general one.
11
12SUPPORT: Forschungsschwerpunkt 'Mathematik und Praxis' (Project of Dr. E. Zerz
13and V. Levandovskyy), Uni Kaiserslautern
14
15NOTE: This library provides algebraic tools for computations and operations
16with algebraic involutions and linear automorphisms of non-commutative algebras
17
18PROCEDURES:
19findInvo();          computes linear involutions on a basering;
20findInvoDiag();     computes homothetic (diagonal) involutions on a basering;
21findAuto();          computes linear automorphisms of a basering;
22ncdetection();        computes an ideal, presenting an involution map on some particular noncommutative algebras;
23involution(m,theta);  applies the involution to an object.
24";
25
26LIB "ncalg.lib";
27LIB "poly.lib";
28LIB "primdec.lib";
29///////////////////////////////////////////////////////////////////////////////
30proc ncdetection()
31"USAGE:  ncdetection();
32RETURN:  ideal, representing an involution map
33PURPOSE: compute classical involutions (i.e. acting rather on operators than on variables) for some particular noncommutative algebras
34ASSUME: the procedure is aimed at non-commutative algebras with differential, shift or advance operators arising in Control Theory.
35It has to be executed in a ring.
36EXAMPLE: example ncdetection; shows an example
37"{
38// in this procedure an involution map is generated from the NCRelations
39// that will be used in the function involution
40// in dieser proc. wird eine matrix erzeugt, die in der i-ten zeile die indices
41// der differential-, shift- oder advance-operatoren enthaelt mit denen die i-te
42// variable nicht kommutiert.
43  if ( nameof(basering)=="basering" )
44  {
45    "No current ring defined.";
46    return(ideal(0));
47  }
48  def r = basering;
49  setring r;
50  int i,j,k,LExp;
51  int NVars  = nvars(r);
52  matrix rel = ncRelations(r)[2];
53  intmat M[NVars][3];
54  int NRows = nrows(rel);
55  intvec v,w;
56  poly d,d_lead;
57  ideal I;
58  map theta;
59  for( j=NRows; j>=2; j-- )
60  {
61   if( rel[j] == w )       //the whole column is zero
62    {
63      j--;
64      continue;
65    }
66    for( i=1; i<j; i++ )
67    {
68      if( rel[i,j]==1 )        //relation of type var(j)*var(i) = var(i)*var(j) +1
69      {
70         M[i,1]=j;
71      }
72      if( rel[i,j] == -1 )    //relation of type var(i)*var(j) = var(j)*var(i) -1
73      {
74        M[j,1]=i;
75      }
76      d = rel[i,j];
77      d_lead = lead(d);
78      v = leadexp(d_lead); //in the next lines we check wether we have a  relation of differential or shift type
79      LExp=0;
80      for(k=1; k<=NVars; k++)
81      {
82        LExp = LExp + v[k];
83      }
84      //      if( (d-d_lead != 0) || (LExp > 1) )
85if ( ( (d-d_lead) != 0) || (LExp > 1) || ( (LExp==0) && ((d_lead>1) || (d_lead<-1)) ) )
86      {
87        return(theta);
88      }
89
90      if( v[j] == 1)                   //relation of type var(j)*var(i) = var(i)*var(j) -lambda*var(j)
91      {
92        if (leadcoef(d) < 0)
93        {
94          M[i,2] = j;
95        }
96        else
97        {
98          M[i,3] = j;
99        }
100      }
101      if( v[i]==1 )                    //relation of type var(j)*var(i) = var(i)*var(j) -lambda*var(i)
102      {
103        if (leadcoef(d) > 0)
104        {
105          M[j,2] = i;
106        }
107        else
108        {
109          M[j,3] = i;
110        }
111      }
112    }
113  }
114  // from here on, the map is computed
115  for(i=1;i<=NVars;i++)
116  {
117    I=I+var(i);
118  }
119
120  for(i=1;i<=NVars;i++)
121  {
122    if( M[i,1..3]==(0,0,0) )
123    {
124      i++;
125      continue;
126    }
127    if( M[i,1]!=0 )
128    {
129      if( (M[i,2]!=0) && (M[i,3]!=0) )
130      {
131        I[M[i,1]] = -var(M[i,1]);
132        I[M[i,2]] = var(M[i,3]);
133        I[M[i,3]] = var(M[i,2]);
134      }
135      if( (M[i,2]==0) && (M[i,3]==0) )
136      {
137        I[M[i,1]] = -var(M[i,1]);
138      }
139      if( ( (M[i,2]!=0) && (M[i,3]==0) )|| ( (M[i,2]!=0) && (M[i,3]==0) )
140)
141      {
142        I[i] = -var(i);
143      }
144    }
145    else
146    {
147      if( (M[i,2]!=0) && (M[i,3]!=0) )
148      {
149        I[i] = -var(i);
150        I[M[i,2]] = var(M[i,3]);
151        I[M[i,3]] = var(M[i,2]);
152      }
153      else
154      {
155        I[i] = -var(i);
156      }
157    }
158  }
159  return(I);
160}
161example
162{
163  "EXAMPLE:"; echo = 2;
164  ring R = 0,(x,y,z,D(1..3)),dp;
165  matrix D[6][6];
166  D[1,4]=1; D[2,5]=1;  D[3,6]=1;
167  def r = nc_algebra(1,D); setring r;
168  map F = r;
169  ncdetection();
170  F;  // F(F) should be maxideal(1)
171  kill r, R;
172  //----------------------------------------
173  ring R=0,(x,S),dp;
174  def r = nc_algebra(1,-S); setring r;
175  map F = r;
176  ncdetection();
177  F;  // F(F) should be maxideal(1)
178  kill r, R;
179  //----------------------------------------
180  ring R=0,(x,D(1),S),dp;
181  matrix D[3][3];
182  D[1,2]=1;  D[1,3]=-S;
183  def r = nc_algebra(1,D); setring r;
184  map F = r;
185  ncdetection();
186  F;  // F(F) should be maxideal(1)
187}
188
189static proc In_Poly(poly mm, list l, int NVars)
190// applies the involution to the poly mm
191// entries of a list l are images of variables under invo
192// more general than invo_poly; used in many rings setting
193{
194  int i,j;
195  intvec v;
196  poly pp, zz;
197  poly nn = 0;
198  i = 1;
199  while(mm[i]!=0)
200  {
201    v  = leadexp(mm[i]);
202    zz = 1;
203    for( j=NVars; j>=1; j--)
204    {
205      if (v[j]!=0)
206      {
207        pp = l[j];
208        zz = zz*(pp^v[j]);
209      }
210    }
211    nn = nn + (leadcoef(mm[i])*zz);
212    i++;
213  }
214  return(nn);
215}
216
217static proc Hom_Poly(poly mm, list l, int NVars)
218// applies the endomorphism to the poly mm
219// entries of a list l are images of variables under endo
220// should not be replaced by map-based stuff! used in
221// many rings setting
222{
223  int i,j;
224  intvec v;
225  poly pp, zz;
226  poly nn = 0;
227  i = 1;
228  while(mm[i]!=0)
229  {
230    v  = leadexp(mm[i]);
231    zz = 1;
232    for( j=NVars; j>=1; j--)
233    {
234      if (v[j]!=0)
235      {
236        pp = l[j];
237        zz = (pp^v[j])*zz;
238      }
239    }
240    nn = nn + (leadcoef(mm[i])*zz);
241    i++;
242  }
243  return(nn);
244}
245
246static proc invo_poly(poly m, map theta)
247// applies the involution map theta to m, where m=polynomial
248{
249  // compatibility:
250  ideal l = ideal(theta);
251  int i;
252  list L;
253  for (i=1; i<=size(l); i++)
254  {
255    L[i] = l[i];
256  }
257  int nv = nvars(basering);
258  return (In_Poly(m,L,nv));
259//   if (m==0) { return(m); }
260//   int i,j;
261//   intvec v;
262//   poly p,z;
263//   poly n = 0;
264//   i = 1;
265//   while(m[i]!=0)
266//   {
267//     v = leadexp(m[i]);
268//     z =1;
269//     for(j=nvars(basering); j>=1; j--)
270//     {
271//       if (v[j]!=0)
272//       {
273//         p = var(j);
274//         p = theta(p);
275//         z = z*(p^v[j]);
276//       }
277//     }
278//     n = n + (leadcoef(m[i])*z);
279//     i++;
280//   }
281//   return(n);
282}
283///////////////////////////////////////////////////////////////////////////////////
284proc involution(m, map theta)
285"USAGE:  involution(m, theta); m is a poly/vector/ideal/matrix/module, theta is a map
286RETURN:  object of the same type as m
287PURPOSE: applies the involution, presented by theta to the object m
288THEORY: for an involution theta and two polynomials a,b from the algebra, theta(ab) = theta(b) theta(a); theta is linear with respect to the ground field
289NOTE: This is generalized ''theta(m)'' for data types unsupported by ''map''.
290EXAMPLE: example involution; shows an example
291"{
292  // applies the involution map theta to m,
293  // where m= vector, polynomial, module, matrix, ideal
294  int i,j;
295  intvec v;
296  poly p,z;
297  if (typeof(m)=="poly")
298  {
299    return (invo_poly(m,theta));
300  }
301  if ( typeof(m)=="ideal" )
302  {
303    ideal n;
304    for (i=1; i<=size(m); i++)
305    {
306      n[i] = invo_poly(m[i], theta);
307    }
308    return(n);
309  }
310  if (typeof(m)=="vector")
311  {
312    for(i=1; i<=size(m); i++)
313    {
314      m[i] = invo_poly(m[i], theta);
315    }
316    return (m);
317  }
318  if ( (typeof(m)=="matrix") || (typeof(m)=="module"))
319  {
320    matrix n = matrix(m);
321    int @R=nrows(n);
322    int @C=ncols(n);
323    for(i=1; i<=@R; i++)
324    {
325      for(j=1; j<=@C; j++)
326      {
327        if (m[i,j]!=0)
328        {
329          n[i,j] = invo_poly( m[i,j], theta);
330        }
331      }
332    }
333    if (typeof(m)=="module")
334    {
335      return (module(n));
336    }
337    else // matrix
338    {
339      return(n);
340    }
341  }
342  // if m is not of the supported type:
343  "Error: unsupported argument type!";
344  return();
345}
346example
347{
348  "EXAMPLE:";echo = 2;
349  ring R = 0,(x,d),dp;
350  def r = nc_algebra(1,1); setring r; // Weyl-Algebra
351  map F = r,x,-d;
352  F(F);  // should be maxideal(1) for an involution
353  poly f =  x*d^2+d;
354  poly If = involution(f,F);
355  f-If;
356  poly g = x^2*d+2*x*d+3*x+7*d;
357  poly tg = -d*x^2-2*d*x+3*x-7*d;
358  poly Ig = involution(g,F);
359  tg-Ig;
360  ideal I = f,g;
361  ideal II = involution(I,F);
362  II;
363  I - involution(II,F);
364  module M  = [f,g,0],[g,0,x^2*d];
365  module IM = involution(M,F);
366  print(IM);
367  print(M - involution(IM,F));
368}
369///////////////////////////////////////////////////////////////////////////////////
370static proc new_var()
371//generates a string of new variables
372{
373
374  int NVars=nvars(basering);
375  int i,j;
376  //  string s="@_1_1";
377  string s="a11";
378  for(i=1; i<=NVars; i++)
379  {
380    for(j=1; j<=NVars; j++)
381    {
382      if(i*j!=1)
383      {
384        s = s+ ","+NVAR(i,j);
385      };
386    };
387  };
388  return(s);
389};
390
391static proc NVAR(int i, int j)
392{
393  //  return("@_"+string(i)+"_"+string(j));
394  return("a"+string(i)+string(j));
395};
396///////////////////////////////////////////////////////////////////////////////////
397static proc new_var_special()
398//generates a string of new variables
399{
400  int NVars=nvars(basering);
401  int i;
402  //  string s="@_1_1";
403  string s="a11";
404  for(i=2; i<=NVars; i++)
405  {
406    s = s+ ","+NVAR(i,i);
407  };
408  return(s);
409};
410///////////////////////////////////////////////////////////////////////////////////
411static proc RelMatr()
412// returns the matrix of relations
413// only Lie-type relations x_j x_i= x_i x_j + .. are taken into account
414{
415  int i,j;
416  int NVars = nvars(basering);
417  matrix Rel[NVars][NVars];
418  for(i=1; i<NVars; i++)
419  {
420    for(j=i+1; j<=NVars; j++)
421    {
422      Rel[i,j]=var(j)*var(i)-var(i)*var(j);
423    };
424  };
425  return(Rel);
426};
427/////////////////////////////////////////////////////////////////
428proc findInvo()
429"USAGE: findInvo();
430RETURN: a ring containing a list L of pairs, where
431@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
432@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
433PURPOSE: computed the ideal of linear involutions of the basering
434NOTE: for convenience, the full ideal of relations @code{idJ}
435and the initial matrix with indeterminates @code{matD} are exported in the output ring
436SEE ALSO: findInvoDiag, involution
437EXAMPLE: example findInvo; shows examples
438
439"{
440  def @B    = basering; //save the name of basering
441  int NVars = nvars(@B); //number of variables in basering
442  int i, j;
443
444  matrix Rel = RelMatr(); //the matrix of relations
445
446  string @ss   = new_var(); //string of new variables
447  string Par = parstr(@B); //string of parameters in old ring
448
449  if (Par=="") // if there are no parameters
450  {
451    execute("ring @@@KK=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
452  }
453  else //if there exist parameters
454  {
455     execute("ring @@@KK=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
456  };
457
458  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
459
460  int Sz = NVars*NVars+NVars; // number of variables in new ring
461
462  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
463
464  for(i=1; i<NVars; i++) //initialize that matrix of relations
465  {
466    for(j=i+1; j<=NVars; j++)
467    {
468      M[i,j] = Rel[i,j];
469    };
470  };
471
472  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
473
474  list l; //list to define an involution
475  poly @@F;
476  for(i=1; i<=NVars; i++) //initializing list for involution
477  {
478    @@F=0;
479    for(j=1; j<=NVars; j++)
480    {
481      execute( "@@F = @@F+"+NVAR(i,j)+"*"+string( var(j) )+";" );
482    };
483    l=l+list(@@F);
484  };
485
486  matrix N = imap(@@@KK,Rel);
487
488  for(i=1; i<NVars; i++)//get matrix by applying the involution to relations
489  {
490    for(j=i+1; j<=NVars; j++)
491    {
492      N[i,j]= l[j]*l[i] - l[i]*l[j] + In_Poly( N[i,j], l, NVars);
493    };
494  };
495  kill l;
496  //---------------------------------------------
497  //get the ideal of coefficients of N
498  ideal J;
499  ideal idN = simplify(ideal(N),2);
500  J = ideal(coeffs( idN, var(1) ) );
501  for(i=2; i<=NVars; i++)
502  {
503    J = ideal( coeffs( J, var(i) ) );
504  };
505  J = simplify(J,2);
506  //-------------------------------------------------
507  if ( Par=="" ) //initializes the ring of relations
508  {
509    execute("ring @@KK=0,("+@ss+"), dp;");
510  }
511  else
512  {
513    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
514  };
515  ideal J = imap(@@K,J); // ideal, considered in @@KK now
516  string snv = "["+string(NVars)+"]";
517  execute("matrix @@D"+snv+snv+"="+@ss+";"); // matrix with entries=new variables
518
519  J = J, ideal( @@D*@@D-matrix( freemodule(NVars) ) ); // add the condition that involution to square is just identity
520  J = simplify(J,2); // without extra zeros
521  list mL = minAssGTZ(J); // components not in GB
522  int sL  = size(mL);
523  option(redSB);       // important for reduced GBs
524  option(redTail);
525  matrix IM = @@D;     // involution map
526  list L    = list();  // the answer
527  list TL;
528  ideal tmp = 0;
529  for (i=1; i<=sL; i++) // compute GBs of components
530  {
531    TL    = list();
532    TL[1] = std(mL[i]);
533    tmp   = NF( ideal(IM), TL[1] );
534    TL[2] = matrix(tmp, NVars,NVars);
535    L[i]  = TL;
536  }
537  export(L); // main export
538  ideal idJ = J; // debug-comfortable exports
539  matrix matD = @@D;
540  export(idJ);
541  export(matD);
542  return(@@KK);
543}
544example
545{ "EXAMPLE:"; echo = 2;
546  def a = makeWeyl(1);
547  setring a; // this algebra is a first Weyl algebra
548  a;
549  def X = findInvo();
550  setring X; // ring with new variables, corr. to unknown coefficients
551  X;
552  L;
553  // look at the matrix in the new variables, defining the linear involution
554  print(L[1][2]);
555  L[1][1];  // where new variables obey these relations
556  idJ;
557}
558///////////////////////////////////////////////////////////////////////////
559proc findInvoDiag()
560"USAGE: findInvoDiag();
561RETURN: a ring together with a list of pairs L, where
562@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
563@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
564PURPOSE: compute homothetic (diagonal) involutions of the basering
565NOTE: for convenience, the full ideal of relations @code{idJ}
566and the initial matrix with indeterminates @code{matD} are exported in the output ring
567SEE ALSO: findInvo, involution
568EXAMPLE: example findInvoDiag; shows examples
569"{
570  def @B    = basering; //save the name of basering
571  int NVars = nvars(@B); //number of variables in basering
572  int i, j;
573
574  matrix Rel = RelMatr(); //the matrix of relations
575
576  string @ss   = new_var_special(); //string of new variables
577  string Par = parstr(@B); //string of parameters in old ring
578
579  if (Par=="") // if there are no parameters
580  {
581    execute("ring @@@KK=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
582  }
583  else //if there exist parameters
584  {
585    execute("ring @@@KK=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
586  };
587
588  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
589
590  int Sz = 2*NVars; // number of variables in new ring
591
592  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
593  for(i=1; i<NVars; i++) //initialize that matrix of relations
594  {
595    for(j=i+1; j<=NVars; j++)
596    {
597      M[i,j] = Rel[i,j];
598    };
599  };
600
601  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
602
603  list l; //list to define an involution
604
605  for(i=1; i<=NVars; i++) //initializing list for involution
606  {
607    execute( "l["+string(i)+"]="+NVAR(i,i)+"*"+string( var(i) )+";" );
608
609  };
610  matrix N = imap(@@@KK,Rel);
611
612  for(i=1; i<NVars; i++)//get matrix by applying the involution to relations
613  {
614    for(j=i+1; j<=NVars; j++)
615    {
616      N[i,j]= l[j]*l[i] - l[i]*l[j] + In_Poly( N[i,j], l, NVars);
617    };
618  };
619  kill l;
620  //---------------------------------------------
621  //get the ideal of coefficients of N
622
623  ideal J;
624  ideal idN = simplify(ideal(N),2);
625  J = ideal(coeffs( idN, var(1) ) );
626  for(i=2; i<=NVars; i++)
627  {
628    J = ideal( coeffs( J, var(i) ) );
629  };
630  J = simplify(J,2);
631  //-------------------------------------------------
632
633  if ( Par=="" ) //initializes the ring of relations
634  {
635    execute("ring @@KK=0,("+@ss+"), dp;");
636  }
637  else
638  {
639    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
640  };
641
642  ideal J = imap(@@K,J); // ideal, considered in @@KK now
643
644  matrix @@D[NVars][NVars]; // matrix with entries=new variables to square i.e. @@D=@@D^2
645  for(i=1;i<=NVars;i++)
646  {
647    execute("@@D["+string(i)+","+string(i)+"]="+NVAR(i,i)+";");
648  };
649  J = J, ideal( @@D*@@D - matrix( freemodule(NVars) ) ); // add the condition that involution to square is just identity
650  J = simplify(J,2); // without extra zeros
651
652  list mL = minAssGTZ(J); // components not in GB
653  int sL  = size(mL);
654  option(redSB); // important for reduced GBs
655  option(redTail);
656  matrix IM = @@D; // involution map
657  list L = list(); // the answer
658  list TL;
659  ideal tmp = 0;
660  for (i=1; i<=sL; i++) // compute GBs of components
661  {
662    TL    = list();
663    TL[1] = std(mL[i]);
664    tmp   = NF( ideal(IM), TL[1] );
665    TL[2] = matrix(tmp, NVars,NVars);
666    L[i]  = TL;
667  }
668  export(L);
669  ideal idJ = J; // debug-comfortable exports
670  matrix matD = @@D;
671  export(idJ);
672  export(matD);
673  return(@@KK);
674}
675example
676{ "EXAMPLE:"; echo = 2;
677  def a = makeWeyl(1);
678  setring a; // this algebra is a first Weyl algebra
679  a;
680  def X = findInvoDiag();
681  setring X; // ring with new variables, corresponding to unknown coefficients
682  X;
683  // print matrices, defining linear involutions
684  print(L[1][2]);  // a first matrix: we see it is constant
685  print(L[2][2]);  // and a second possible matrix; it is constant too
686  L; // let us take a look on the whole list
687  idJ;
688}
689/////////////////////////////////////////////////////////////////////
690proc findAuto(int n)
691"USAGE: findAuto(n); n an integer
692RETURN: a ring together with a list of pairs L, where
693@*        L[i][1]  =  ideal; a Groebner Basis of an i-th associated prime,
694@*        L[i][2]  =  matrix, defining a linear map, with entries, reduced with respect to L[i][1]
695PURPOSE: compute the ideal of linear automorphisms of the basering, given by a matrix, n-th power of which gives identity (i.e. unipotent matrix)
696NOTE: if n=0, a matrix, defining an automorphism is not assumed to be unipotent but just non-degenerate. A nonzero parameter @code{@@p} is introduced as the value of the determinant of the matrix above.
697@* For convenience, the full ideal of relations @code{idJ} and the initial matrix with indeterminates @code{matD} are mutually exported in the output ring
698SEE ALSO: findInvo
699EXAMPLE: example findAuto; shows examples
700"{
701  if ((n<0 ) || (n==1))
702  {
703    "The index of unipotency is too small.";
704    return(0);
705  }
706  def @B    = basering; //save the name of basering
707  int NVars = nvars(@B); //number of variables in basering
708  int i, j;
709
710  matrix Rel = RelMatr(); //the matrix of relations
711
712  string @ss = new_var(); //string of new variables
713  string Par = parstr(@B); //string of parameters in old ring
714
715  if (Par=="") // if there are no parameters
716  {
717    execute("ring @@@K=0,("+varstr(@B)+","+@ss+"), dp;"); //new ring with new variables
718  }
719  else //if there exist parameters
720  {
721     execute("ring @@@K=(0,"+Par+") ,("+varstr(@B)+","+@ss+"), dp;");//new ring with new variables
722  };
723
724  matrix Rel = imap(@B, Rel); //consider the matrix of relations in new ring
725
726  int Sz = NVars*NVars+NVars; // number of variables in new ring
727
728  matrix M[Sz][Sz]; //to be the matrix of relations in new ring
729
730  for(i=1; i<NVars; i++) //initialize that matrix of relations
731  {
732    for(j=i+1; j<=NVars; j++)
733    {
734      M[i,j] = Rel[i,j];
735    };
736  };
737
738  def @@K = nc_algebra(1, M); setring @@K; //now new ring @@K become a noncommutative ring
739
740  list l; //list to define a homomorphism(isomorphism)
741  poly @@F;
742  for(i=1; i<=NVars; i++) //initializing list for involution
743  {
744    @@F=0;
745    for(j=1; j<=NVars; j++)
746    {
747      execute( "@@F = @@F+"+NVAR(i,j)+"*"+string( var(j) )+";" );
748    };
749    l=l+list(@@F);
750  };
751
752  matrix N = imap(@@@K,Rel);
753
754  for(i=1; i<NVars; i++)//get matrix by applying the homomorphism  to relations
755  {
756    for(j=i+1; j<=NVars; j++)
757    {
758      N[i,j]= l[j]*l[i] - l[i]*l[j] - Hom_Poly( N[i,j], l, NVars);
759    };
760  };
761  kill l;
762  //---------------------------------------------
763  //get the ideal of coefficients of N
764  ideal J;
765  ideal idN = simplify(ideal(N),2);
766  J = ideal(coeffs( idN, var(1) ) );
767  for(i=2; i<=NVars; i++)
768  {
769    J = ideal( coeffs( J, var(i) ) );
770  };
771  J = simplify(J,2);
772  //-------------------------------------------------
773  if (( Par=="" ) && (n!=0)) //initializes the ring of relations
774  {
775    execute("ring @@KK=0,("+@ss+"), dp;");
776  }
777  if (( Par=="" ) && (n==0)) //initializes the ring of relations
778  {
779    execute("ring @@KK=(0,@p),("+@ss+"), dp;");
780  }
781  if ( Par!="" )
782  {
783    execute("ring @@KK=(0,"+Par+"),("+@ss+"), dp;");
784  };
785  //  execute("setring @@KK;");
786  //  basering;
787  ideal J = imap(@@K,J); // ideal, considered in @@KK now
788  string snv = "["+string(NVars)+"]";
789  execute("matrix @@D"+snv+snv+"="+@ss+";"); // matrix with entries=new variables
790
791  if (n>=2)
792  {
793    J = J, ideal( @@D*@@D-matrix( freemodule(NVars) ) ); // add the condition that homomorphism to square is just identity
794  }
795  if (n==0)
796  {
797    J = J, det(@@D)-@p; // det of non-unipotent matrix is nonzero
798  }
799  J       = simplify(J,2); // without extra zeros
800  list mL = minAssGTZ(J); // components not in GB
801  int sL  = size(mL);
802  option(redSB); // important for reduced GBs
803  option(redTail);
804  matrix IM = @@D; //  map
805  list L = list(); // the answer
806  list TL;
807  ideal tmp = 0;
808  for (i=1; i<=sL; i++)// compute GBs of components
809  {
810    TL    = list();
811    TL[1] = std(mL[i]);
812    tmp   = NF( ideal(IM), TL[1] );
813    TL[2] = matrix(tmp,NVars, NVars);
814    L[i]  = TL;
815  }
816  export(L);
817  ideal idJ = J; // debug-comfortable exports
818  matrix matD = @@D;
819  export(idJ);
820  export(matD);
821  return(@@KK);
822}
823example
824{ "EXAMPLE:"; echo = 2;
825  def a = makeWeyl(1);
826  setring a; // this algebra is a first Weyl algebra
827  a;
828  def X = findAuto(2);  // in contrast to findInvo look for automorphisms
829  setring X; // ring with new variables - unknown coefficients
830  X;
831  size(L); // we have (size(L)) families in the answer
832  // look at matrices, defining linear automorphisms:
833  print(L[1][2]);  // a first one: we see it is the identity
834  print(L[2][2]);  // and a second possible matrix; it is diagonal
835  // L; // we can take a look on the whole list, too
836  idJ;
837  kill X; kill a;
838  //----------- find all the linear automorphisms --------------------
839  //----------- use the call findAuto(0)          --------------------
840  ring R = 0,(x,s),dp;
841  def r = nc_algebra(1,s); setring r; // the shift algebra
842  s*x; // the only relation in the algebra is:
843  def Y = findAuto(0);
844  setring Y;
845  size(L); // here, we have 1 parametrized family
846  print(L[1][2]); // here, @p is a nonzero parameter
847  det(L[1][2]-@p);  // check whether determinante is zero
848}
Note: See TracBrowser for help on using the repository browser.