source: git/Singular/LIB/perron.lib @ 88b2dd

spielwiese
Last change on this file since 88b2dd was 88b2dd, checked in by Motsak Oleksandr <motsak@…>, 18 years ago
*motsak: bug fixed (lists are sometimes globa and sometimes local!?!) git-svn-id: file:///usr/local/Singular/svn/trunk@9244 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.2 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="$Id: perron.lib,v 1.4 2006-06-20 14:37:45 motsak Exp $";
3category="Noncommutative";
4info="
5LIBRARY:  perron.lib         computation of algebraic dependences
6AUTHORS:  Oleksandr Motsak,        motsak@mathematik.uni-kl.de.
7
8PROCEDURES:
9perron(L[, D]);  relations between pairwise commuting polynomials
10
11KEYWORDS:  algebraic dependence; relations
12";
13
14LIB "center.lib";
15
16//////////////////////////////////////////////////////////////////////////////
17proc perron( ideal L, list # )
18"USAGE:  perron( L [, D] )
19RETURN:  commutative ring with ideal `Relations`
20PURPOSE: computes polynomial relations ('Relations') between pairwise
21         commuting polynomials of L [, up to a given degree bound D]
22NOTE:    the implementation was partially inspired by the Perron's theorem.
23EXAMPLE: example perron; shows an example
24"
25{
26  int N, D, i;
27   
28  N = size(L);
29
30  if( N == 0 )
31    {
32      ERROR( "Input ideal must be non-zero!" );
33    }
34   
35  intvec W; // weights
36   
37  for ( i = N; i > 0; i-- )
38    {
39      W[i] = deg(L[i]);
40    }
41
42  ////////////////////////////////////////////////////////////////////////
43  D = -1;
44   
45  // Check whether the degree bound 'D' is given:
46  if( size(#)>0 )
47    {
48      if ( typeof(#[1]) == typeof(D) )
49        {
50          D = #[1];
51           
52          if( D <= 0 )
53            {
54              ERROR( "An optional parameter D must be positive!" );
55            }
56        }   
57    }
58   
59  // , otherwise we try to estimate it according to Perron's Th:
60  if( D < 0 )
61    {
62      D = 1;
63      int d, min;
64       
65      min = -1;
66       
67      for ( i = size(L); i > 0 ; i-- )
68        {
69          d = W[i];
70           
71          D = D * d;
72          if( min == -1)
73            {
74              min = d;
75            } else
76              {
77                if( min > d )
78                  {
79                    min = d;               
80                  }
81              }           
82        }
83       
84      if( (D == 0) or (min <= 0) )
85        {
86          ERROR( "Wrong set of polynomials!" );
87        }
88       
89      D = D / min;       
90     
91    }
92   
93  ////////////////////////////////////////////////////////////////////////
94   
95  def NCRING = basering;
96   
97  def CurrentField = ringlist( NCRING )[1];
98 
99//  CurrentField;
100   
101  // We are going to construct a commutative ring in N variables F(i),
102  // with the field specified by 'CurrentField':
103   
104  ring TEMPRING = 0, ( F(1..N) ), dp;
105   
106  list RingList = ringlist( TEMPRING );
107 
108  setring NCRING;
109 
110 
111  if( !defined(RingList) )
112  {
113    list RingList = imap( TEMPRING, RingList );   
114  }
115 
116
117  RingList[1] = CurrentField;   
118 
119//  RingList;
120   
121  // New Commutative Ring with correct field!
122  def COMMUTATIVERING = ring( RingList );
123 
124  ////////////////////////////////////////////////////////////////////////
125
126  setring COMMUTATIVERING; // we are in COMMUTATIVERING now
127   
128  ideal PBWBasis = PBW_maxDeg( D ); // All monomials of degree(!) <= D.
129
130  // TODO: it would be better to compute weighted monomials of weight
131  // <= W[1] \cdots W[N].
132   
133  setring NCRING; // and back to NCRING
134   
135  map Psi = COMMUTATIVERING, L; // F(i) \mapsto L[i]
136   
137  ideal Images = Psi( PBWBasis ); // Corresponding products of polynomials
138                                  // from L
139   
140  // ::MAIN STEP:: // Compute relations in NC ring:
141  def T = linearMapKernel( Images );
142       
143  ////////////////////////////////////////////////////////////////////////
144
145  // check the output of 'linearMapKernel':
146  int t = 0;
147   
148  if( (typeof(T) != "module") and (typeof(T) != "int" ) )
149    {
150      ERROR( "Wrong output from function 'linearMapKernel'!" );
151    }
152   
153  if( typeof(T) == "int" )
154    {
155      t = 1;
156      if( T != 0 )
157        {
158          ERROR( "Wrong output from function 'linearMapKernel'!" );
159        }
160    }       
161
162  ////////////////////////////////////////////////////////////////////////
163       
164  // Go back to commutative case in both cases:       
165  setring COMMUTATIVERING;       
166   
167  ideal Relations; // And generate Relations:
168
169  if( t == 0 ) // T is a module
170    {
171      module KER = imap( NCRING, T );
172      Relations = linearCombinations( PBWBasis, KER );
173       
174    } else
175      { // T == int(0) => all images are zero =>
176        Relations = PBWBasis;       
177      }
178     
179   
180  ////////////////////////////////////////////////////////////////////////
181
182  // we compute an std basis of the relations:   
183   
184  // save options
185  intvec v = option( get );
186   
187  // set right options
188  option( redSB );
189  option( redTail );
190   
191  // reduce everything in as far as possible
192  Relations = simplify( std( Relations ), 1 + 2 + 8 );
193   
194  // restore options
195  option( set, v );
196   
197  //    Relations;
198  export Relations;
199   
200  return( COMMUTATIVERING );   
201}
202example
203{
204"EXAMPLE:"; echo = 2;
205int p = 3;
206ring A = p,(x,y,z),dp;
207matrix D[3][3]=0;
208D[1,2]=-z; D[1,3]=2*x; D[2,3]=-2*y;
209ncalgebra(1,D); // this algebra is U(sl_2)
210ideal I = x^p, y^p, z^p-z, 4*x*y+z^2-2*z; // the center
211def RA = perron( I, p );
212setring RA;
213RA;
214Relations; // it was exported from perron to be in the returned ring.
215
216// perron can be also used in a commutative case, for example:
217ring B = 0,(x,y,z),dp;
218ideal J = xy+z2, z2+y2, x2y2-2xy3+y4;
219def RB = perron(J);
220setring RB;
221Relations;
222}
223
Note: See TracBrowser for help on using the repository browser.