# source:git/Singular/LIB/perron.lib@7a8ca6

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