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

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