source: git/Singular/LIB/involut.lib @ 0610f0e

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