Changeset 999b3a in git


Ignore:
Timestamp:
May 5, 2006, 4:37:36 PM (18 years ago)
Author:
Motsak Oleksandr <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b52fc4b2495505785981d640dcf7eb3e456778ef')
Children:
8492cb96ea713816ff1376eb6195c8eaa8b76c45
Parents:
d5f47f4d77a27dca0d58409071b7d42fa0db141e
Message:
minor: cosmetic changes


git-svn-id: file:///usr/local/Singular/svn/trunk@9106 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/perron.lib

    rd5f47f r999b3a  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: perron.lib,v 1.2 2006-04-03 13:14:05 motsak Exp $";
     2version="$Id: perron.lib,v 1.3 2006-05-05 14:37:36 motsak Exp $";
    33category="Noncommutative";
    44info="
     
    77
    88PROCEDURES:
    9 perron(L[, d]);    computes relations between pairwise commuting polynomials of L[, up to a given degree bound D]
     9perron(L[, D]);  relations between pairwise commuting polynomials
    1010
    1111KEYWORDS:  algebraic dependence; relations
     
    1616//////////////////////////////////////////////////////////////////////////////
    1717proc perron( ideal L, list # )
    18 "USAGE:     perron( L [, D] )
    19 RETURN:     a commutative ring, containing an exported ideal `Relations` with found polynomial relations.
    20 PURPOSE:    computes relations between pairwise commuting polynomials of L[, up to a given degree bound D]
    21 NOTE:       the implementation was partially inspired by the Perron's theorem.
    22 EXAMPLE:    example perron; shows an example
     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
    2324"
    2425{
    25     int N, D, i;
    26    
    27     if( nameof( basering ) == "basering" )
    28     {
    29         ERROR( "No current ring!" );
    30     }
    31 
    32 
    33     N = size(L);
    34 
    35     if( N == 0 )
    36     {
    37         ERROR( "Zero ideal!" );
    38     }
    39    
    40     intvec W; // weights
    41    
    42     for ( i = N; i > 0; i-- )
    43     {
    44         W[i] = deg(L[i]);
    45     }
    46 
    47 ////////////////////////////////////////////////////////////////////////
    48     D = -1;
    49    
    50     // Check whether the bound degree D is given:
    51     if( size(#)>0 )
    52     {
    53         if ( typeof(#[1]) == typeof(D) )
    54         {
    55             D = #[1];
     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];
    5651           
    57             if( D <= 0 )
     52          if( D <= 0 )
    5853            {
    59                 ERROR( "An optional parameter D must be positive!" );
     54              ERROR( "An optional parameter D must be positive!" );
    6055            }
    6156        }   
    6257    }
    6358   
    64     // , otherwise we try to estimate it after Perron Th:
    65     if( D < 0 )
    66     {
    67         D = 1;
    68         int d, min;
    69        
    70         min = -1;
    71        
    72         for ( i = size(L); i > 0 ; i-- )
    73         {
    74             d = W[i];
     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];
    7570           
    76             D = D * d;
    77             if( min == -1)
     71          D = D * d;
     72          if( min == -1)
    7873            {
    79                 min = d;
     74              min = d;
    8075            } else
    81             {
     76              {
    8277                if( min > d )
    83                 {
     78                  {
    8479                    min = d;               
    85                 }
    86             }           
     80                  }
     81              }           
    8782        }
    8883       
    89         if( (D == 0) or (min <= 0) )
    90         {
    91             ERROR( "Wrong set of polynomials!" );
     84      if( (D == 0) or (min <= 0) )
     85        {
     86          ERROR( "Wrong set of polynomials!" );
    9287        }
    9388       
    94         D = D / min;       
    95        
    96         kill d;
    97     }
    98    
    99 ////////////////////////////////////////////////////////////////////////
    100    
    101     def NCRING = basering;
    102    
    103     def CurrentField = ringlist( NCRING )[1];
    104    
    105     // We are going to construct a commutative ring in N variables:
    106    
    107     ring TEMPRING = 0, ( F(1..N) ), dp;
    108    
    109     list RingList = ringlist( TEMPRING );
    110    
    111     RingList[1] = CurrentField; // Take the Field from NC Ring!
    112    
    113     kill CurrentField; // !
    114    
    115     // New Commutative Ring with correct field!
    116    
    117     def COMMUTATIVERING = ring( RingList );
    118    
    119     setring COMMUTATIVERING;
    120    
    121     kill TEMPRING;
    122 
    123 ////////////////////////////////////////////////////////////////////////
    124 
    125     // we are in COMMUTATIVERING now:   
    126    
    127     ideal PBWBasis = PBW_maxDeg( D ); // All monomials of degree(!) <= D.
    128     // TODO: it would be better to compute weighted monomials of weight <= W[1] \cdot ... W[N].
    129    
    130 //    PBWBasis;
    131        
    132     setring NCRING;
    133    
    134 //    kill CurrentField; // we cleanup every bit of it.
    135    
    136     map Psi = COMMUTATIVERING, L; // F(i) \mapsto L[i]
    137    
    138     ideal Images = Psi( PBWBasis ); // Corresponding products of polynomials from L
    139    
    140 //    Images;
    141    
    142     def T = linearMapKernel( Images ); // Compute relations in NC ring
    143    
    144 //    T;
    145 
    146    
    147     // We check the output:
    148    
    149     if( (typeof(T) != "module") and (typeof(T) != "int" ) )
    150     {
    151         ERROR( "Wrong output from the 'linearMapKernel' function!" );
    152     }
    153    
    154     if( typeof(T) == "int" )
    155     {
    156         if( T != 0 )
    157         {
    158             ERROR( "Wrong output from the 'linearMapKernel' function!" );
     89      D = D / min;       
     90     
     91    }
     92   
     93  ////////////////////////////////////////////////////////////////////////
     94   
     95  def NCRING = basering;
     96   
     97  def CurrentField = ringlist( NCRING )[1];
     98   
     99  // We are going to construct a commutative ring in N variables F(i),
     100  // with the field specified by 'CurrentField':
     101   
     102  ring TEMPRING = 0, ( F(1..N) ), dp;
     103   
     104  list RingList = ringlist( TEMPRING );
     105  RingList[1] = CurrentField;
     106   
     107  // New Commutative Ring with correct field!
     108  def COMMUTATIVERING = ring( RingList );
     109 
     110  ////////////////////////////////////////////////////////////////////////
     111
     112  setring COMMUTATIVERING; // we are in COMMUTATIVERING now
     113   
     114  ideal PBWBasis = PBW_maxDeg( D ); // All monomials of degree(!) <= D.
     115
     116  // TODO: it would be better to compute weighted monomials of weight
     117  // <= W[1] \cdots W[N].
     118   
     119  setring NCRING; // and back to NCRING
     120   
     121  map Psi = COMMUTATIVERING, L; // F(i) \mapsto L[i]
     122   
     123  ideal Images = Psi( PBWBasis ); // Corresponding products of polynomials
     124                                  // from L
     125   
     126  // ::MAIN STEP:: // Compute relations in NC ring:
     127  def T = linearMapKernel( Images );
     128       
     129  ////////////////////////////////////////////////////////////////////////
     130
     131  // check the output of 'linearMapKernel':
     132  int t = 0;
     133   
     134  if( (typeof(T) != "module") and (typeof(T) != "int" ) )
     135    {
     136      ERROR( "Wrong output from function 'linearMapKernel'!" );
     137    }
     138   
     139  if( typeof(T) == "int" )
     140    {
     141      t = 1;
     142      if( T != 0 )
     143        {
     144          ERROR( "Wrong output from function 'linearMapKernel'!" );
    159145        }
    160146    }       
    161    
    162        
    163     // , and go back to commutative case in both cases:       
    164     if( typeof(T) == "module" )
    165     {
    166         // Back to
    167         setring COMMUTATIVERING;       
    168         module KER = imap( NCRING, T );
    169        
    170         // some clean up:
    171         setring NCRING;
    172         kill T;
    173         kill Psi;
    174        
    175         setring COMMUTATIVERING;
    176         ideal result = linearCombinations( PBWBasis, KER );
    177        
    178         kill KER;
    179        
    180            
     147
     148  ////////////////////////////////////////////////////////////////////////
     149       
     150  // Go back to commutative case in both cases:       
     151  setring COMMUTATIVERING;       
     152   
     153  ideal Relations; // And generate Relations:
     154
     155  if( t == 0 ) // T is a module
     156    {
     157      module KER = imap( NCRING, T );
     158      Relations = linearCombinations( PBWBasis, KER );
     159       
    181160    } else
    182     {
    183         // If all images are zero...       
    184         kill T;
    185         kill Psi;
    186         setring COMMUTATIVERING;
    187         ideal result = PBWBasis;       
    188     }
    189    
    190     // now we must be in COMMUTATIVERING and there must be an ideal result.
    191     kill PBWBasis;
    192 
    193 //    listvar(all);       
    194 
    195 ////////////////////////////////////////////////////////////////////////
    196     // we compute an std basis of the relations:   
    197    
    198     // save options
    199     intvec v = option( get );
    200    
    201     // set right options
    202     option( redSB );
    203     option( redTail );
    204    
    205     // compute everything in a right form
    206     ideal Relations = simplify( std( result ), 1 + 2 + 8 );
    207    
    208     // restore options
    209     option( set, v );
    210    
    211     kill result;
    212    
    213 //    Relations;
    214     export Relations;
    215    
    216     return( COMMUTATIVERING );   
     161      { // T == int(0) => all images are zero =>
     162        Relations = PBWBasis;       
     163      }
     164     
     165   
     166  ////////////////////////////////////////////////////////////////////////
     167
     168  // we compute an std basis of the relations:   
     169   
     170  // save options
     171  intvec v = option( get );
     172   
     173  // set right options
     174  option( redSB );
     175  option( redTail );
     176   
     177  // reduce everything in as far as possible
     178  Relations = simplify( std( Relations ), 1 + 2 + 8 );
     179   
     180  // restore options
     181  option( set, v );
     182   
     183  //    Relations;
     184  export Relations;
     185   
     186  return( COMMUTATIVERING );   
    217187}
    218188example
     
    224194D[1,2]=-z; D[1,3]=2*x; D[2,3]=-2*y;
    225195ncalgebra(1,D); // this algebra is U(sl_2)
    226 ideal L = x^p, y^p, z^p-z, 4*x*y+z^2-2*z; // the center
    227 def R = perron( L, p );
    228 setring R;
    229 R;
     196ideal I = x^p, y^p, z^p-z, 4*x*y+z^2-2*z; // the center
     197def RA = perron( I, p );
     198setring RA;
     199RA;
    230200Relations; // it was exported from perron to be in the returned ring.
    231 kill R;
     201
    232202// perron can be also used in a commutative case, for example:
    233 ring r=0,(x,y,z),dp;
     203ring B = 0,(x,y,z),dp;
    234204ideal J = xy+z2, z2+y2, x2y2-2xy3+y4;
    235 def R = perron(J);
    236 setring R;
     205def RB = perron(J);
     206setring RB;
    237207Relations;
    238208}
Note: See TracChangeset for help on using the changeset viewer.