Changeset 6035d5 in git for Singular/LIB/solve.lib


Ignore:
Timestamp:
Jun 28, 1999, 6:48:58 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
9a6c4ae84f7d2709f65215910c1238b8642ea6ff
Parents:
e858e7474c86dc4faa76dde10fcfb590dcdaabae
Message:
*hannes: style fixes


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/solve.lib

    re858e7 r6035d5  
    11///////////////////////////////////////////////////////////////////////////////
    22
    3 version="$Id: solve.lib,v 1.1 1999-06-28 13:35:06 wenk Exp $";
     3version="$Id: solve.lib,v 1.2 1999-06-28 16:48:58 Singular Exp $";
    44info="
    55LIBRARY: solve.lib     PROCEDURES TO SOLVE POLYNOMIAL SYSTEMS
     
    2020         l>0: defines precision of fractional part if groundfield is Q
    2121         m=0,1,2: number of iterations for approximation of roots (default=2)
    22 ASSUME:  i is a zerodimensional ideal with 
    23          nvars(basering) = ncols(i) = number of vars actually occuring in i 
     22ASSUME:  i is a zerodimensional ideal with
     23         nvars(basering) = ncols(i) = number of vars actually occuring in i
    2424RETURN:  list of all (complex) roots of the polynomial system i = 0,
    2525         of type number if the groundfield is the complex numbers,
     
    3232  int prec=30;
    3333
    34   if ( size(#) >= 1 ) 
    35     {
    36       typ= #[1];
    37       if ( typ < 0 || typ > 1 )
    38         {
    39           ERROR("// Valid values for second parameter are:
    40           // 0: use sparse Resultant (default)
    41           // 1: use Macaulay Resultant");
    42         }
    43     }
    44   if ( size(#) >= 2 ) 
    45     {
    46       prec= #[2];
    47       if ( prec == 0 ) { prec = 30; }
    48       if ( prec < 0 )
    49         {
    50           "// Fourth parameter must be positive!";
    51           return();
    52         }
    53     }
    54   if ( size(#) >= 3 ) 
    55     {
    56       polish= #[3];
    57       if ( polish < 0 || polish > 3 )
    58         {
    59           "// Valid values for third parameter are: ";
    60           "// 0,1,2: number of iterations for approximation of roots";
    61           return();
    62         }
    63       if ( polish == 0 ) { polish = 3; }
    64     }
    65 
    66   if ( size(#) > 3 ) 
    67     {
    68       // Error
    69       "// only three parameters allowed!";
    70       return();
    71     }
     34  if ( size(#) >= 1 )
     35  {
     36    typ= #[1];
     37    if ( typ < 0 || typ > 1 )
     38    {
     39      ERROR("// Valid values for second parameter are:
     40      // 0: use sparse Resultant (default)
     41      // 1: use Macaulay Resultant");
     42    }
     43  }
     44  if ( size(#) >= 2 )
     45  {
     46    prec= #[2];
     47    if ( prec == 0 ) { prec = 30; }
     48    if ( prec < 0 )
     49    {
     50      "// Fourth parameter must be positive!";
     51      return();
     52    }
     53  }
     54  if ( size(#) >= 3 )
     55  {
     56    polish= #[3];
     57    if ( polish < 0 || polish > 3 )
     58    {
     59      "// Valid values for third parameter are: ";
     60      "// 0,1,2: number of iterations for approximation of roots";
     61      return();
     62    }
     63    if ( polish == 0 ) { polish = 3; }
     64  }
     65
     66  if ( size(#) > 3 )
     67  {
     68    // Error
     69    "// only three parameters allowed!";
     70    return();
     71  }
    7272
    7373  int digits= system("setFloatDigits",prec);
    7474
    7575  return(uressolve(gls,typ,polish));
    76  
     76
    7777}
    7878example
     
    8686
    8787  pause;
    88   // now with complex coefficient field, precision is 10 digits 
     88  // now with complex coefficient field, precision is 10 digits
    8989  ring rsc= (real,10,I),(x,y),lp;
    9090  ideal i = x2 + y2 - 8,x2 + xy + 2y2;
     
    106106  int prec=30;
    107107
    108   if ( size(#) >= 1 ) 
    109     {
    110       prec= #[1];
    111       if ( prec == 0 ) { prec = 30; }
    112       if ( prec < 0 )
    113         {
    114           "// Fisrt parameter must be positive!";
    115           return();
    116         }
    117     }
    118   if ( size(#) >= 2 ) 
    119     {
    120       polish= #[2];
    121       if ( polish == 0 ) { polish = 3; }
    122       if ( polish < 0 || polish > 2 )
    123         {
    124           "// Valid values for third parameter are: ";
    125           "// 0,1,2: number of iterations for approximation of roots";
    126           return();
    127         }
    128     }
    129   if ( size(#) > 2 ) 
    130     {
    131       "// only two parameters allowed!";
    132       return();
    133     }
     108  if ( size(#) >= 1 )
     109  {
     110    prec= #[1];
     111    if ( prec == 0 ) { prec = 30; }
     112    if ( prec < 0 )
     113    {
     114      "// Fisrt parameter must be positive!";
     115      return();
     116    }
     117  }
     118  if ( size(#) >= 2 )
     119  {
     120    polish= #[2];
     121    if ( polish == 0 ) { polish = 3; }
     122    if ( polish < 0 || polish > 2 )
     123    {
     124      "// Valid values for third parameter are: ";
     125      "// 0,1,2: number of iterations for approximation of roots";
     126      return();
     127    }
     128  }
     129  if ( size(#) > 2 )
     130  {
     131    "// only two parameters allowed!";
     132    return();
     133  }
    134134
    135135  int digits= system("setFloatDigits",prec);
    136136
    137137  return(laguerre(f,polish));
    138  
     138
    139139}
    140140example
     
    163163         k=1: resultant matrix of Macaulay (k=0 is default)
    164164ASSUME:  nvars(basering) = ncols(i)-1 = number of vars actually occuring in i,
    165          for k=1 i must be homogeneous 
    166 RETURN:  module representing the multipolynomial resultant matrix 
     165         for k=1 i must be homogeneous
     166RETURN:  module representing the multipolynomial resultant matrix
    167167EXAMPLE: example mp_res_mat; shows an example
    168168"
     
    170170  int typ=2;
    171171
    172   if ( size(#) == 1 )
    173     {
    174       typ= #[1];
    175       if ( typ == 0 ) { typ = 2; }
    176       if ( typ < 0 || typ > 2 )
    177         {
    178           "// Valid values for third parameter are: ";
    179           "// 0: sparse resultant (default)";
    180           "// 1: Macaulay resultant";
    181           return();
    182         }
    183     }
    184   if ( size(#) > 1 )
    185     {
    186       "// only two parameters allowed!";
    187       return();
    188     }
    189 
     172  if ( size(#) == 1 )
     173  {
     174    typ= #[1];
     175    if ( typ == 0 ) { typ = 2; }
     176    if ( typ < 0 || typ > 2 )
     177    {
     178      "// Valid values for third parameter are: ";
     179      "// 0: sparse resultant (default)";
     180      "// 1: Macaulay resultant";
     181      return();
     182    }
     183  }
     184  if ( size(#) > 1 )
     185  {
     186    "// only two parameters allowed!";
     187    return();
     188  }
    190189  return(mpresmat(gls,typ));
    191  
    192190}
    193191example
     
    227225ASSUME:  ground field K is the rational or real or complex numbers,
    228226         p and v consist of numbers of the ground filed K, p must have
    229          n elements, v must have N=(d+1)^n elements where n=nvars(basering) 
    230          and d=deg(f) (f is the unknown polynomial in K[x1,...,xn]) 
     227         n elements, v must have N=(d+1)^n elements where n=nvars(basering)
     228         and d=deg(f) (f is the unknown polynomial in K[x1,...,xn])
    231229COMPUTE: polynomial f with values given by v at points p1,..,pN derived from p;
    232230         more precisely: consider p as point in K^n and v as N elements in K,
     
    246244  ring r1 = 0,(x),lp;
    247245  // First example:
    248   // deg(f) = 4, 
     246  // deg(f) = 4,
    249247  // v = values of f at points 3^0, 3^1, 3^2, 3^3, 3^4
    250248  ideal v=16,0,11376,1046880,85949136;
     
    252250
    253251  ring r2 = 0,(x,y),dp;
    254   // Second example: 
     252  // Second example:
    255253  // deg(f) = 3
    256254  // valuation point (2,3)
     
    261259}
    262260///////////////////////////////////////////////////////////////////////////////
    263 
    264 
    265 
    266 
    267 
    268 
Note: See TracChangeset for help on using the changeset viewer.