Changeset 50cbdc in git


Ignore:
Timestamp:
Aug 27, 2001, 4:48:02 PM (22 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
2567b5a6cb7109be5a83e53eb94abb1c38fb9945
Parents:
3de58c9ca0aeaafdf5cb29f986967bffa405b542
Message:
*hannes: merge-2-0-2


git-svn-id: file:///usr/local/Singular/svn/trunk@5619 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 added
109 edited
15 moved

Legend:

Unmodified
Added
Removed
  • Singular/GMPrat.cc

    r3de58c r50cbdc  
    2121
    2222#include <stdlib.h>
    23 #include <float.h>
    2423#include <math.h>
    2524#include <ctype.h>
     
    6261}
    6362
    64 Rational::Rational( long int a )
    65 {
    66     p = new rep;
    67     mpq_init( p->rat );
    68     mpq_set_si( p->rat,a,1 );
    69 }
    70 
    71 Rational::Rational( unsigned long int a )
    72 {
    73     p = new rep;
    74     mpq_init( p->rat );
    75     mpq_set_ui( p->rat,a,1 );
    76 }
    77 
    7863Rational::Rational( int a )
    7964{
     
    8368}
    8469
    85 Rational::Rational( unsigned int a )
    86 {
    87     p = new rep;
    88     mpq_init( p->rat );
    89     mpq_set_ui( p->rat,(unsigned long)a,1 );
    90 }
    91 
    9270Rational::Rational( const Rational& a )
    9371{
     
    9674}
    9775
    98 Rational::Rational( double a )
    99 {
    100     mpz_t   h1,h2;
    101     int     i=0;
    102     double  aa=a;
    103 
    104     p = new rep;
    105     mpq_init( p->rat );
    106     mpz_init_set_ui( h1,1 );
    107 
    108     while( fabs( 10.0*aa ) < DBL_MAX && i<DBL_DIG )
    109     {
    110         aa *= 10.;
    111         mpz_mul_ui( h1,h1,10 );
    112         i++;
    113     }
    114     mpz_init_set_d( h2,aa );
    115     mpq_set_num( p->rat,h2 );
    116     mpq_set_den( p->rat,h1 );
    117     mpq_canonicalize( p->rat );
    118     mpz_clear( h1 );
    119     mpz_clear( h2 );
    120 }
    121 
    122 Rational::Rational(float a)
    123 {
    124     mpz_t h1,h2;
    125     int i=0;
    126     double aa=a;
    127 
    128     p=new rep;
    129     mpq_init(p->rat);
    130     mpz_init_set_ui(h1,1);
    131     while(fabs(10.*aa) < FLT_MAX && i<FLT_DIG){
    132         aa*=10.;
    133         mpz_mul_ui(h1,h1,10);
    134         i++;
    135     }
    136     mpz_init_set_d(h2,aa);
    137     mpq_set_num(p->rat,h2);
    138     mpq_set_den(p->rat,h1);
    139     mpq_canonicalize(p->rat);
    140     mpz_clear(h1);
    141     mpz_clear(h2);
    142 }
    143 
    144 // ----------------------------------------------------------------------------
    145 //  Create a Rational from a string like "+1234.5678e-1234"
    146 // ----------------------------------------------------------------------------
    147 
    148 Rational::Rational( char *s )
    149 {
    150     mpz_t   h1;
    151     int     exp=0,i=0;
    152     char    *s1,*s2,*ss;
    153 
    154     ss = new char[strlen(s)+1];
    155     strcpy( ss,s );
    156     s1 = ss;
    157     p = new rep;
    158     mpq_init( p->rat );
    159     if( isdigit(s1[0]) || s1[0]=='-' || s1[0]=='+' )
    160     {
    161         if (s1[0]=='+') ++s1;
    162         if (s1[0]=='-') ++i;
    163 
    164         while( isdigit( s1[i] ) )
    165         {
    166             ++i;
    167         }
    168         if (s1[i]=='.')
    169         {
    170             ++i;
    171             while( isdigit( s1[i] ) )
    172             {
    173                 s1[i-1]=s1[i];
    174                 ++i;
    175                 --exp;
    176             }
    177             s1[i-1]='\0';
    178         }
    179         if (s1[i]=='e' || s1[i]=='E')
    180         {
    181             s2=s1+i+1;
    182         }
    183         else
    184             s2="";
    185 
    186         s1[i]='\0';
    187         i=exp+atoi(s2);
    188         mpz_init_set_str(h1,s1,10);
    189         delete[] ss;
    190         mpq_set_z(p->rat,h1);
    191         mpq_set_ui(save.p->rat,10,1);
    192         if (i>0)
    193         {
    194             for(int j=0;j<i;j++)
    195                 mpq_mul(p->rat,p->rat,save.p->rat);
    196         }
    197         else if (i<0)
    198         {
    199             for(int j=0;j>i;j--)
    200                 mpq_div(p->rat,p->rat,save.p->rat);
    201         }
    202         mpq_canonicalize(p->rat);
    203         mpz_clear(h1);
    204     }
    205 }
    206 
    20776// ----------------------------------------------------------------------------
    20877//  Constructors with two arguments: numerator and denominator
    20978// ----------------------------------------------------------------------------
    210 
    211 Rational::Rational(long int a, unsigned long int b)
    212 {
    213     p = new rep;
    214     mpq_init( p->rat );
    215     mpq_set_si( p->rat,a,b );
    216     mpq_canonicalize( p->rat );
    217 }
    218 
    219 Rational::Rational(unsigned long int a, unsigned long int b)
    220 {
    221     p=new rep;
    222     mpq_init(p->rat);
    223     mpq_set_ui(p->rat,a,b);
    224     mpq_canonicalize(p->rat);
    225 }
    226 
    227 Rational::Rational(int a, unsigned int b)
    228 {
    229     p=new rep;
    230     mpq_init(p->rat);
    231     mpq_set_si(p->rat,(long int) a,(unsigned long int) b);
    232     mpq_canonicalize(p->rat);
    233 }
    234 
    235 Rational::Rational(unsigned int a, unsigned int b)
    236 {
    237     p=new rep;
    238     mpq_init(p->rat);
    239     mpq_set_ui(p->rat,(unsigned long) a,(unsigned long int) b);
    240     mpq_canonicalize(p->rat);
    241 }
    24279
    24380Rational::Rational(const Rational& a, const Rational& b)
     
    24683    mpq_init(p->rat);
    24784    mpq_div(p->rat, a.p->rat, b.p->rat);
    248 }
    249 
    250 Rational::Rational(long int a, long int b)
    251 {
    252     if (b<0) a=-a;
    253     p=new rep;
    254     mpq_init(p->rat);
    255     mpq_set_si(p->rat,a,abs(b));
    256     mpq_canonicalize(p->rat);
    25785}
    25886
     
    26694}
    26795
    268 Rational::Rational(char *sn, char *sd)
    269 {
    270   Rational
    271     h=sd;
    272 
    273   p=new rep;
    274   mpq_init(p->rat);
    275   *this=sn;
    276   mpq_div(p->rat,p->rat,h.p->rat);
    277 }
    278 
    27996// ----------------------------------------------------------------------------
    28097//  Destructor
     
    292109//  Assignment operators
    293110// ----------------------------------------------------------------------------
     111
    294112Rational& Rational::operator=(int a)
    295113{
    296114  disconnect();
    297115  mpq_set_si(p->rat,(long int) a,1);
    298   return *this;
    299 }
    300 
    301 Rational& Rational::operator=(double a)
    302 {
    303   mpz_t
    304     h1,
    305     h2;
    306   int
    307     i=0;
    308   double
    309     aa=a;
    310 
    311   disconnect();
    312   mpz_init_set_ui(h1,1);
    313   while(fabs(10.*aa) < DBL_MAX && i<DBL_DIG){
    314     aa*=10.;
    315     mpz_mul_ui(h1,h1,10);
    316     i++;
    317   }
    318   mpz_init_set_d(h2,aa);
    319   mpq_set_num(p->rat,h2);
    320   mpq_set_den(p->rat,h1);
    321   mpq_canonicalize(p->rat);
    322   mpz_clear(h1);
    323   mpz_clear(h2);
    324   return *this;
    325 }
    326 
    327 Rational& Rational::operator=(float a)
    328 {
    329   mpz_t
    330     h1,
    331     h2;
    332   int
    333     i=0;
    334   double
    335     aa=a;
    336 
    337   disconnect();
    338   mpz_init_set_ui(h1,1);
    339   while(fabs(10.*aa) < FLT_MAX && i<FLT_DIG){
    340     aa*=10.;
    341     mpz_mul_ui(h1,h1,10);
    342     i++;
    343   }
    344   mpz_init_set_d(h2,aa);
    345   mpq_set_num(p->rat,h2);
    346   mpq_set_den(p->rat,h1);
    347   mpq_canonicalize(p->rat);
    348   mpz_clear(h1);
    349   mpz_clear(h2);
    350   return *this;
    351 }
    352 
    353 Rational& Rational::operator=(char *s)
    354 {
    355   mpz_t
    356     h1;
    357   int
    358     exp=0,
    359     i=0;
    360   char
    361     *s1=s,
    362     *s2,
    363     *ss;
    364 
    365   ss=new char[strlen(s)+1];
    366   strcpy(ss,s);
    367   s1=ss;
    368   disconnect();
    369   if (isdigit(s1[0]) || s1[0]=='-' || s1[0]=='+'){
    370     if (s1[0]=='+') ++s1;
    371     if (s1[0]=='-') ++i;
    372     while(isdigit(s1[i]))
    373       ++i;
    374     if (s1[i]=='.'){
    375       ++i;
    376       while(isdigit(s1[i])){
    377         s1[i-1]=s1[i];
    378         ++i;
    379         --exp;
    380       }
    381       s1[i-1]='\0';
    382     }
    383     if (s1[i]=='e' || s1[i]=='E'){
    384       s2=s1+i+1;
    385     }
    386     else
    387       s2="";
    388     s1[i]='\0';
    389     i=exp+atoi(s2);
    390     mpz_init_set_str(h1,s1,10);
    391     delete[] ss;
    392     mpq_set_z(p->rat,h1);
    393     mpq_set_ui(save.p->rat,10,1);
    394     if (i>0){
    395       for(int j=0;j<i;j++)
    396         mpq_mul(p->rat,p->rat,save.p->rat);
    397     }
    398     else if (i<0){
    399       for(int j=0;j>i;j--)
    400         mpq_div(p->rat,p->rat,save.p->rat);
    401     }
    402     mpq_canonicalize(p->rat);
    403     mpz_clear(h1);
    404   }
    405   else
    406     mpq_set_ui(p->rat,0,1);
    407116  return *this;
    408117}
     
    455164// ----------------------------------------------------------------------------
    456165
    457 Rational::operator bool()
    458 {
    459     if (mpq_sgn(p->rat)) return true;
    460     return false;
    461 }
    462 
    463 Rational::operator long int()
     166Rational::operator int()
    464167{
    465168  mpz_t
     
    474177
    475178  return ret_val;
    476 }
    477 
    478 Rational::operator unsigned long int()
    479 {
    480   mpz_t
    481     h;
    482   unsigned long int
    483     ret_val;
    484 
    485   mpz_init(h);
    486   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    487   ret_val=mpz_get_ui(h);
    488   mpz_clear(h);
    489   return ret_val;
    490 }
    491 
    492 Rational::operator int()
    493 {
    494   mpz_t
    495     h;
    496   long int
    497     ret_val;
    498 
    499   mpz_init(h);
    500   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    501   ret_val=mpz_get_si(h);
    502   mpz_clear(h);
    503 
    504   return ret_val;
    505 }
    506 
    507 Rational::operator unsigned int()
    508 {
    509   mpz_t
    510     h;
    511   unsigned long int
    512     ret_val;
    513 
    514   mpz_init(h);
    515   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    516   ret_val=mpz_get_ui(h);
    517   mpz_clear(h);
    518   return ret_val;
    519 }
    520 
    521 Rational::operator short int()
    522 {
    523   mpz_t
    524     h;
    525   short int
    526     ret_val;
    527 
    528   mpz_init(h);
    529   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    530   ret_val=mpz_get_si(h);
    531   mpz_clear(h);
    532   return ret_val;
    533 }
    534 
    535 Rational::operator unsigned short int()
    536 {
    537   mpz_t
    538     h;
    539   unsigned short int
    540     ret_val;
    541 
    542   mpz_init(h);
    543   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    544   ret_val=mpz_get_ui(h);
    545   mpz_clear(h);
    546   return ret_val;
    547 }
    548 
    549 Rational::operator char()
    550 {
    551   mpz_t
    552     h;
    553   char
    554     ret_val;
    555 
    556   mpz_init(h);
    557   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    558   ret_val=mpz_get_si(h);
    559   mpz_clear(h);
    560   return ret_val;
    561 }
    562 
    563 Rational::operator unsigned char()
    564 {
    565   mpz_t
    566     h;
    567   unsigned char
    568     ret_val;
    569 
    570   mpz_init(h);
    571   mpz_tdiv_q(h,mpq_numref(p->rat),mpq_denref(p->rat));
    572   ret_val=mpz_get_ui(h);
    573   mpz_clear(h);
    574   return ret_val;
    575 }
    576 
    577 Rational::operator double()
    578 {
    579   return mpq_get_d(p->rat);
    580 }
    581 
    582 Rational::operator float()
    583 {
    584   return mpq_get_d(p->rat);
    585179}
    586180
  • Singular/GMPrat.h

    r3de58c r50cbdc  
    2929
    3030    Rational( );
    31     Rational( long int );
    32     Rational( unsigned long int );
    3331    Rational( int );
    34     Rational( unsigned int );
    35     Rational( double );
    36     Rational( float );
    37     Rational( char* );
    3832    Rational( const Rational& );
    39     Rational( long int,unsigned long int );
    40     Rational( unsigned long int,unsigned long int );
    41     Rational( int, unsigned int );
    42     Rational( unsigned int,unsigned int );
    4333    Rational( const Rational&,const Rational& );
    44     Rational( long int,long int );
    4534    Rational( int,int );
    46     Rational( char*,char* );
    4735    ~Rational( );
    4836
    4937    Rational& operator = ( int );
    50     Rational& operator = ( double );
    51     Rational& operator = ( float );
    5238    Rational& operator = ( char *s );
    5339    Rational& operator = ( const Rational& );
     
    5844    int      get_num_si( );
    5945    int      get_den_si( );
    60     operator bool( );
    61     operator long int( );
    62     operator unsigned long int( );
    6346    operator int( );
    64     operator unsigned int( );
    65     operator short int( );
    66     operator unsigned short int( );
    67     operator char( );
    68     operator unsigned char( );
    69     operator double( );
    70     operator float( );
    7147
    7248    Rational  operator - ( );
  • Singular/LIB/all.lib

    r3de58c r50cbdc  
    1 // $Id: all.lib,v 1.36 2001-05-17 14:36:29 Singular Exp $
     1// $Id: all.lib,v 1.37 2001-08-27 14:47:46 Singular Exp $
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: all.lib,v 1.36 2001-05-17 14:36:29 Singular Exp $";
     3version="$Id: all.lib,v 1.37 2001-08-27 14:47:46 Singular Exp $";
    44category = "General purpose";
    55info="
  • Singular/LIB/brnoeth.lib

    r3de58c r50cbdc  
    1 version="$Id: brnoeth.lib,v 1.11 2001-02-09 13:11:35 lossen Exp $";
     1version="$Id: brnoeth.lib,v 1.12 2001-08-27 14:47:46 Singular Exp $";
     2category="Miscellaneous";
    23info="
    34LIBRARY:   brnoeth.lib  Brill-Noether Algorithm, Weierstrass-SG and AG-codes
     
    19811982          In the intvec L[4] (conductor) the i-th entry corresponds to the
    19821983          i-th entry in the list of places L[3].
    1983          
     1984
    19841985          With no optional arguments, the conductor is computed by
    19851986          local invariants of the singularities; otherwise it is computed
     
    19891990          of the places above P in the list of closed places L[3]. @*
    19901991          If the point is at infinity, P[1] is a homogeneous irreducible
    1991           polynomial in two variables. 
    1992 
    1993           If @code{printlevel>=0} additional comments are displayed (default: 
    1994           @code{printlevel=0}). 
     1992          polynomial in two variables.
     1993
     1994          If @code{printlevel>=0} additional comments are displayed (default:
     1995          @code{printlevel=0}).
    19951996KEYWORDS: Hamburger-Noether expansions; adjunction divisor
    19961997SEE ALSO: closed_points, NSplaces
     
    21262127  Aff_SLocus;             // ideal of the affine singular locus
    21272128  Aff_SPoints[1];         // 1st affine singular point: (1:1:1), no.1
    2128   Inf_Points[1];          // singular point(s) at infinity: (1:0:0), no.4 
     2129  Inf_Points[1];          // singular point(s) at infinity: (1:0:0), no.4
    21292130  Inf_Points[2];          // list of non-singular points at infinity
    21302131  //
     
    21392140  //
    21402141  pause("press RETURN");
    2141   // we look at the place(s) of degree 2 by changing to the ring 
     2142  // we look at the place(s) of degree 2 by changing to the ring
    21422143  C[5][2][1];
    2143   def S(2)=C[5][2][1];         
     2144  def S(2)=C[5][2][1];
    21442145  setring S(2);
    21452146  POINTS;                // base point(s) of place(s) of degree 2: (1:a:1)
     
    21642165          See @ref{Adj_div} for a description of the entries in L.
    21652166NOTE:     The list_expression should be the output of the procedure Adj_div.@*
    2166           If @code{printlevel>=0} additional comments are displayed (default: 
    2167           @code{printlevel=0}). 
     2167          If @code{printlevel>=0} additional comments are displayed (default:
     2168          @code{printlevel=0}).
    21682169SEE ALSO: closed_points, Adj_div
    21692170EXAMPLE:  example NSplaces; shows an example
     
    33693370  list C=Adj_div(x3y+y3+x);
    33703371  C=NSplaces(3,C);
    3371   // the first 3 Places in C[3] are of degree 1. 
     3372  // the first 3 Places in C[3] are of degree 1.
    33723373  // we define the rational divisor G = 4*C[3][1]+4*C[3][3] (of degree 8):
    33733374  intvec G=4,0,4;
     
    34013402  // programm
    34023403  poly auxp=gcd(F[1],F[2]);
    3403   return(ideal(division(auxp,F)[1]));
     3404  return(ideal(division(F,auxp)[1]));
    34043405}
    34053406///////////////////////////////////////////////////////////////////////////////
     
    35223523NOTE:     The procedure must be called from the ring CURVE[1][2],
    35233524          where CURVE is the output of the procedure @code{NSplaces}.
    3524 @*        i represents the place CURVE[3][i]. 
     3525@*        i represents the place CURVE[3][i].
    35253526@*        Rational functions are represented by numerator/denominator
    35263527          in form of ideals with two homogeneous generators.
     
    39153916  def ER=HC[1][4];
    39163917  setring ER;
    3917   intvec G=5;      // the rational divisor G = 5*HC[3][1] 
     3918  intvec G=5;      // the rational divisor G = 5*HC[3][1]
    39183919  intvec D=2..9;   // D = sum of the rational places no. 2..9 over F_4
    39193920  // let us construct the corresponding evaluation AG code :
     
    39623963  def ER=HC[1][4];
    39633964  setring ER;
    3964   intvec G=5;      // the rational divisor G = 5*HC[3][1] 
     3965  intvec G=5;      // the rational divisor G = 5*HC[3][1]
    39653966  intvec D=2..9;   // D = sum of the rational places no. 2..9 over F_4
    39663967  // let us construct the corresponding residual AG code :
     
    43664367  def ER=HC[1][4];
    43674368  setring ER;
    4368   intvec G=5;      // the rational divisor G = 5*HC[3][1] 
     4369  intvec G=5;      // the rational divisor G = 5*HC[3][1]
    43694370  intvec D=2..9;   // D = sum of the rational places no. 2..9 over F_4
    43704371  // construct the corresp. residual AG code of type [8,3,>=5] over F_4:
    43714372  matrix C=AGcode_Omega(G,D,HC);
    4372   // we can correct 1 error and the genus is 1, thus F must have degree 2 
     4373  // we can correct 1 error and the genus is 1, thus F must have degree 2
    43734374  // and support disjoint from that of D;
    43744375  intvec F=2;
     
    45164517  def ER=HC[1][4];
    45174518  setring ER;
    4518   intvec G=5;      // the rational divisor G = 5*HC[3][1] 
     4519  intvec G=5;      // the rational divisor G = 5*HC[3][1]
    45194520  intvec D=2..9;   // D = sum of the rational places no. 2..9 over F_4
    45204521  // construct the corresp. residual AG code of type [8,3,>=5] over F_4:
  • Singular/LIB/classify.lib

    r3de58c r50cbdc  
    11// KK,GMG last modified: 17.12.00
    22///////////////////////////////////////////////////////////////////////////////
    3 version  = "$Id: classify.lib,v 1.48 2001-02-06 11:26:15 anne Exp $";
     3version  = "$Id: classify.lib,v 1.49 2001-08-27 14:47:48 Singular Exp $";
    44category="Singularities";
    55info="
     
    5757"USAGE:    classify(f);  f=poly
    5858COMPUTE:  normal form and singularity type of f with respect to right
    59           equivalence, as given in the book \"Singularities of differentiable 
     59          equivalence, as given in the book \"Singularities of differentiable
    6060          maps, Volume I\" by V.I. Arnold, S.M. Gusein-Zade, A.N. Varchenko
    6161RETURN:   normal form of f, of type poly
    6262REMARK:   This version of classify is only beta. Please send bugs and
    6363          comments to: \"Kai Krueger\" <krueger@mathematik.uni-kl.de> @*
    64           Be sure to have at least Singular version 1.0.1. Updates can be 
     64          Be sure to have at least Singular version 1.0.1. Updates can be
    6565          found at: @*
    6666          URL=http://www.mathematik.uni-kl.de/~krueger/Singular/
  • Singular/LIB/equising.lib

    r3de58c r50cbdc  
    1 version="$Id: equising.lib,v 1.7 2001-02-05 12:01:37 lossen Exp $";
     1version="$Id: equising.lib,v 1.8 2001-08-27 14:47:49 Singular Exp $";
    22category="Singularities";
    33info="
     
    767767         printlevel > 0 displays comments and pauses after intermediate
    768768         computations (default: printlevel=0) @*
    769          This procedure uses @code{execute} or calls a procedure using 
     769         This procedure uses @code{execute} or calls a procedure using
    770770         @code{execute}.
    771771EXAMPLE: example esStratum; shows an example
     
    11681168         on the deformation parameters.
    11691169RETURN:  list l of two integers, where
    1170 @format       
     1170@format
    11711171   l[1]=1 if F is an equisingular deformation,  l[1]=0 otherwise.
    11721172   l[2]=1 if some error has occured,  l[2]=0 otherwise.
    11731173@end format
    11741174NOTE:    If m is given, the computation stops after m steps of the iteration. @*
    1175          This procedure uses @code{execute} or calls a procedure using 
     1175         This procedure uses @code{execute} or calls a procedure using
    11761176         @code{execute}.
    11771177EXAMPLE: example isEquising; shows an example
  • Singular/LIB/general.lib

    r3de58c r50cbdc  
    22//anne, added deleteSublist and watchdog 12.12.2000
    33///////////////////////////////////////////////////////////////////////////////
    4 version="$Id: general.lib,v 1.39 2001-03-26 14:05:30 Singular Exp $";
     4version="$Id: general.lib,v 1.40 2001-08-27 14:47:50 Singular Exp $";
    55category="General purpose";
    66info="
     
    11611161      ERROR("First argument of watchdog has to be a positive integer.");
    11621162    }
     1163  }
     1164  else
     1165  {
    11631166    ERROR("MP-support is not enabled in this version of Singular.");
    11641167  }
  • Singular/LIB/hnoether.lib

    r3de58c r50cbdc  
    33// This library is for Singular 1-3-7 or newer
    44
    5 version="$Id: hnoether.lib,v 1.29 2001-02-05 13:27:00 Singular Exp $";
     5version="$Id: hnoether.lib,v 1.30 2001-08-27 14:47:51 Singular Exp $";
    66category="Singularities";
    77info="
     
    5050proc further_hn_proc()
    5151"USAGE: further_hn_proc();
    52 NOTE:  The library @code{hnoether.lib} contains some more procedures which 
    53        are not shown when typing @code{help hnoether.lib;}. They may be useful 
     52NOTE:  The library @code{hnoether.lib} contains some more procedures which
     53       are not shown when typing @code{help hnoether.lib;}. They may be useful
    5454       for interactive use (e.g. if you want to do the calculation of an HN
    55        development \"by hand\" to see the intermediate results), and they 
     55       development \"by hand\" to see the intermediate results), and they
    5656       can be enumerated by calling @code{further_hn_proc()}. @*
    57        Use @code{help <procedure>;} for detailed information about each of 
     57       Use @code{help <procedure>;} for detailed information about each of
    5858       them.
    5959"
     
    7878 referencepoly(D);   a polynomial f s.t. D is the Newton diagram of f";
    7979
    80 // extrafactor(f,M,N); try to factor charPoly(f,M,N) where 'factorize' cannot
    81 // (will hopefully become obsolete soon)
    82 //
    8380//       static procedures not useful for interactive use:
    8481// polytest(f);        tests coefficients and exponents of poly f
     
    261258ASSUME:  f is a bivariate polynomial (in the first 2 ring variables).
    262259RETURN:  poly, a squarefree divisor of f.
    263 NOTE:    Usually, the return value is the greatest squarefree divisor, but 
    264          there is one exception: factors with a p-th root, p the 
     260NOTE:    Usually, the return value is the greatest squarefree divisor, but
     261         there is one exception: factors with a p-th root, p the
    265262         characteristic of the basering, are lost.
    266263SEE ALSO: allsquarefree
     
    412409proc is_irred (poly f)
    413410"USAGE:   is_irred(f); f poly
    414 ASSUME:  f is a squarefree bivariate polynomial (in the first 2 ring 
     411ASSUME:  f is a squarefree bivariate polynomial (in the first 2 ring
    415412         variables).
    416 RETURN:  int (0 or 1): @* 
    417          - @code{is_irred(f)=1} if f is irreducible as a formal power 
    418          series over the algebraic closure of its coefficient field (f 
     413RETURN:  int (0 or 1): @*
     414         - @code{is_irred(f)=1} if f is irreducible as a formal power
     415         series over the algebraic closure of its coefficient field (f
    419416         defines an analytically irreducible curve at zero), @*
    420417         - @code{is_irred(f)=0} otherwise.
    421 NOTE:    0 and units in the ring of formal power series are considered to be 
     418NOTE:    0 and units in the ring of formal power series are considered to be
    422419         not irreducible.
    423420KEYWORDS: irreducible power series
     
    467464proc develop
    468465"USAGE:   develop(f [,n]); f poly, n int
    469 ASSUME:  f is a bivariate polynomial (in the first 2 ring variables) and 
     466ASSUME:  f is a bivariate polynomial (in the first 2 ring variables) and
    470467         irreducible as power series (for reducible f use @code{reddevelop}).
    471468RETURN:  list @code{L} with:
     
    476473         Hamburger-Noether expansion (HNE). The end of the line is marked in
    477474         the matrix by the first ring variable (usually x).
    478 @item @code{L[2]}; intvec: 
     475@item @code{L[2]}; intvec:
    479476         indicating the length of lines of the HNE
    480477@item @code{L[3]}; int:
    481478         0  if the 1st ring variable was transversal (with respect to f), @*
    482          1  if the variables were changed at the beginning of the 
     479         1  if the variables were changed at the beginning of the
    483480            computation, @*
    484         -1  if an error has occurred. 
    485 @item @code{L[4]}; poly: 
    486          the transformed polynomial of f to make it possible to extend the 
     481        -1  if an error has occurred.
     482@item @code{L[4]}; poly:
     483         the transformed polynomial of f to make it possible to extend the
    487484         Hamburger-Noether development a posteriori without having to do
    488485         all the previous calculation once again (0 if not needed)
    489486@item @code{L[5]}; int:
    490487         1  if the curve has exactly one branch (i.e., is irreducible), @*
    491          0  else (i.e., the curve has more than one HNE, or f is not valid). 
     488         0  else (i.e., the curve has more than one HNE, or f is not valid).
    492489@end table
    493490@end texinfo
     
    496493         the LAST line of the HNE. If it is given, the HN-matrix @code{L[1]}
    497494         will have at least @code{n} columns. @*
    498          Otherwise, the number of columns will be chosen minimal such that the 
    499          matrix contains all necessary information (i.e., all lines of the HNE 
     495         Otherwise, the number of columns will be chosen minimal such that the
     496         matrix contains all necessary information (i.e., all lines of the HNE
    500497         but the last (which is in general infinite) have place). @*
    501          If @code{n} is negative, the algorithm is stopped as soon as the 
    502          computed information is sufficient for @code{invariants(L)}, but the 
    503          HN-matrix @code{L[1]} may still contain undetermined elements, which 
     498         If @code{n} is negative, the algorithm is stopped as soon as the
     499         computed information is sufficient for @code{invariants(L)}, but the
     500         HN-matrix @code{L[1]} may still contain undetermined elements, which
    504501         are marked with the 2nd variable (of the basering). @*
    505502         For time critical computations it is recommended to use
    506503         @code{ring ...,(x,y),ls} as basering - it increases the algorithm's
    507504         speed. @*
    508          If @code{printlevel>=0} comments are displayed (default is 
    509          @code{printlevel=0}). 
     505         If @code{printlevel>=0} comments are displayed (default is
     506         @code{printlevel=0}).
    510507SEE ALSO: reddevelop, extdevelop, displayHNE
    511508EXAMPLES: example develop; shows an example
     
    908905proc param
    909906"USAGE:  param(L [,x]); L list, x any type (optional)
    910 ASSUME:  L is the output of @code{develop(f)}, or of 
    911         @code{extdevelop(develop(f),n)}, or one entry of the output of 
     907ASSUME:  L is the output of @code{develop(f)}, or of
     908        @code{extdevelop(develop(f),n)}, or one entry of the output of
    912909        @code{reddevelop(f)}.
    913910RETURN: a parametrization for f in the following format: @*
    914         - if only the list L is given, the result is an ideal of two 
     911        - if only the list L is given, the result is an ideal of two
    915912        polynomials p[1],p[2]: if the HNE was finite then f(p[1],p[2])=0};
    916         if not, the \"real\" parametrization will be two power series and 
    917         p[1],p[2] are truncations of these series.@* 
     913        if not, the \"real\" parametrization will be two power series and
     914        p[1],p[2] are truncations of these series.@*
    918915        - if the optional parameter x is given, the result is a list l:
    919         l[1]=param(L) (ideal) and l[2]=intvec with two entries indicating 
    920         the highest degree up to which the coefficients of the monomials in 
     916        l[1]=param(L) (ideal) and l[2]=intvec with two entries indicating
     917        the highest degree up to which the coefficients of the monomials in
    921918        l[1] are exact (entry -1 means that the corresponding parametrization
    922919        is exact).
    923 NOTE:   If the basering has only 2 variables, the first variable is chosen 
    924         as indefinite. Otherwise, the 3rd variable is chosen. 
     920NOTE:   If the basering has only 2 variables, the first variable is chosen
     921        as indefinite. Otherwise, the 3rd variable is chosen.
    925922SEE ALSO: develop, extdevelop
    926923KEYWORDS: parametrization
     
    10491046proc invariants
    10501047"USAGE:   invariants(L); L list
    1051 ASSUME:  L is the output of @code{develop(f)}, or of 
    1052          @code{extdevelop(develop(f),n)}, or one entry of the output of 
     1048ASSUME:  L is the output of @code{develop(f)}, or of
     1049         @code{extdevelop(develop(f),n)}, or one entry of the output of
    10531050         @code{reddevelop(f)}.
    10541051RETURN:  list, if L contains a valid HNE:
     
    11531150proc displayInvariants
    11541151"USAGE:  displayInvariants(L); L list
    1155 ASSUME:  L is the output of @code{develop(f)}, or of 
    1156          @code{extdevelop(develop(f),n)}, or (one entry of) the output of 
     1152ASSUME:  L is the output of @code{develop(f)}, or of
     1153         @code{extdevelop(develop(f),n)}, or (one entry of) the output of
    11571154         @code{reddevelop(f)}.
    11581155RETURN:  none
     
    12401237proc multiplicities
    12411238"USAGE:   multiplicities(L); L list
    1242 ASSUME:  L is the output of @code{develop(f)}, or of 
    1243          @code{extdevelop(develop(f),n)}, or one entry of the output of 
    1244          @code{reddevelop(f)}. 
     1239ASSUME:  L is the output of @code{develop(f)}, or of
     1240         @code{extdevelop(develop(f),n)}, or one entry of the output of
     1241         @code{reddevelop(f)}.
    12451242RETURN:  intvec of the different multiplicities that occur when successively
    12461243         blowing-up the curve singularity corresponding to f.
     
    12841281
    12851282proc puiseux2generators (intvec m, intvec n)
    1286 "USAGE:   puiseux2generators(m,n); m,n intvec 
     1283"USAGE:   puiseux2generators(m,n); m,n intvec
    12871284ASSUME:  m, resp. n, represent the 1st, resp. 2nd, components of Puiseux pairs
    1288          (e.g., @code{m=invariants(L)[3]}, @code{n=invariants(L)[4]}). 
     1285         (e.g., @code{m=invariants(L)[3]}, @code{n=invariants(L)[4]}).
    12891286RETURN:  intvec of the generators of the semigroup of values.
    12901287SEE ALSO: invariants
     
    13151312proc intersection (list hn1, list hn2)
    13161313"USAGE:   intersection(hne1,hne2); hne1, hne2 lists
    1317 ASSUME:  hne1, hne2 represent a HNE (i.e., are the output of 
    1318         @code{develop(f)}, or of @code{extdevelop(develop(f),n)}, or 
     1314ASSUME:  hne1, hne2 represent a HNE (i.e., are the output of
     1315        @code{develop(f)}, or of @code{extdevelop(develop(f),n)}, or
    13191316        one entry of the output of @code{reddevelop(f)}).
    13201317RETURN:  int, the intersection multiplicity of the branches corresponding to
     
    14241421  list hne=reddevelop((x2-y3)*(x2+y3));
    14251422  intersection(hne[1],hne[2]);
    1426   kill HNEring,r; 
     1423  kill HNEring,r;
    14271424  printlevel=plevel; echo = 0;
    14281425  // --- restore HNEring if previously defined ---
     
    14371434proc multsequence
    14381435"USAGE:   multsequence(L); L list
    1439 ASSUME:  L is the output of @code{develop(f)}, or of 
    1440          @code{extdevelop(develop(f),n)}, or one entry of the output of 
     1436ASSUME:  L is the output of @code{develop(f)}, or of
     1437         @code{extdevelop(develop(f),n)}, or one entry of the output of
    14411438         @code{reddevelop(f)}.
    1442 RETURN:  intvec corresponding to the multiplicity sequence of (a branch) 
     1439RETURN:  intvec corresponding to the multiplicity sequence of (a branch)
    14431440         of the curve (the same as @code{invariants(L)[6]}).
    14441441ASSUME:  L is the output of @code{reddevelop(f)}.
     
    14471444@table @asis
    14481445@item  @code{multsequence(L)[1][i,*]}
    1449    contains the multiplicities of the branches at their infinitely near point 
    1450    of 0 in its (i-1) order neighbourhood (i.e., i=1: multiplicity of the 
    1451    branches themselves, i=2: multiplicity of their 1st quadratic transformed, 
     1446   contains the multiplicities of the branches at their infinitely near point
     1447   of 0 in its (i-1) order neighbourhood (i.e., i=1: multiplicity of the
     1448   branches themselves, i=2: multiplicity of their 1st quadratic transformed,
    14521449   etc., @*
    1453    Hence, @code{multsequence(L)[1][*,j]} is the multiplicity sequence 
     1450   Hence, @code{multsequence(L)[1][*,j]} is the multiplicity sequence
    14541451   of branch j.
    1455 @item  @code{multsequence(L)[2][i,*]}: 
     1452@item  @code{multsequence(L)[2][i,*]}:
    14561453   contains the information which of these infinitely near points coincide.
    14571454@end table
    14581455@end texinfo
    1459 NOTE:  The order of elements of the list obtained from @code{reddevelop(f)} 
     1456NOTE:  The order of elements of the list obtained from @code{reddevelop(f)}
    14601457       must not be changed (because then the coincident infinitely near points
    14611458       couldn't be grouped together, cf. meaning of 2nd intmat in example).
     
    15421539  }
    15431540  // ------ the example starts here -------
    1544   "EXAMPLE:"; echo = 2;   
     1541  "EXAMPLE:"; echo = 2;
    15451542  int plevel=printlevel; printlevel=-1;
    15461543  ring r=0,(x,y),dp;
     
    15651562proc displayMultsequence
    15661563"USAGE:   displayMultsequence(L);
    1567 ASSUME:  L is the output of @code{develop(f)}, or of 
    1568          @code{extdevelop(develop(f),n)}, or (one entry of) the output of 
     1564ASSUME:  L is the output of @code{develop(f)}, or of
     1565         @code{extdevelop(develop(f),n)}, or (one entry of) the output of
    15691566         @code{reddevelop(f)}.
    15701567RETURN:  nothing
    15711568DISPLAY: the sequence of multiplicities:
    15721569@format
    1573  -  if @code{L=develop(f)} or @code{L=reddevelop(f)[i]}: 
    1574                       @code{a , b , c , ....... , 1} 
    1575  - if @code{L=reddevelop(f)}: 
     1570 -  if @code{L=develop(f)} or @code{L=reddevelop(f)[i]}:
     1571                      @code{a , b , c , ....... , 1}
     1572 - if @code{L=reddevelop(f)}:
    15761573                      @code{[(a_1, .... , b_1 , .... , c_1)],}
    15771574                      @code{[(a_2, ... ), ... , (... , c_2)],}
    15781575                      @code{ ........................................ ,}
    15791576                      @code{[(a_n),(b_n), ....., (c_n)]}
    1580      with: 
     1577     with:
    15811578       @code{a_1 , ... , a_n} the sequence of multiplicities of the 1st branch,
    15821579       @code{[...]} the multiplicities of the j-th transformed of all branches,
     
    16371634  displayMultsequence(hne);
    16381635  kill HNEring,r;
    1639   printlevel=plevel; 
     1636  printlevel=plevel;
    16401637  echo = 0;
    16411638  // --- restore HNEring if previously defined ---
     
    16501647proc separateHNE (list hn1,list hn2)
    16511648"USAGE:    separateHNE(hne1,hne2);  hne1, hne2 lists
    1652 ASSUME:   hne1, hne2 are HNEs (=output of 
    1653           @code{develop(f)}, @code{extdevelop(develop(f),n)}, or 
     1649ASSUME:   hne1, hne2 are HNEs (=output of
     1650          @code{develop(f)}, @code{extdevelop(develop(f),n)}, or
    16541651          one entry of the output of @code{reddevelop(f)}).
    1655 RETURN:   number of quadratic transformations needed to separate both curves 
     1652RETURN:   number of quadratic transformations needed to separate both curves
    16561653          (branches).
    16571654SEE ALSO: develop, reddevelop, multsequence, displayMultsequence
     
    17511748proc displayHNE(list ldev,list #)
    17521749"USAGE:   displayHNE(L[,n]); L list, n int
    1753 ASSUME:  L has the format of the output of @code{develop(f)}, resp. of 
     1750ASSUME:  L has the format of the output of @code{develop(f)}, resp. of
    17541751         @code{reddevelop(f)}.
    17551752RETURN:  - if only one argument is given, no return value, but
     
    17621759     HNE[r+1]=           []*z(r)^2+[]*z(r)^3+......
    17631760     @end example
    1764      where @code{x},@code{y} are the first 2 variables of the basering. 
    1765      The values of @code{[]} are the coefficients of the Hamburger-Noether 
    1766      matrix, the values of @code{<>} are represented by @code{x} in the 
    1767      HN-matrix.@* 
     1761     where @code{x},@code{y} are the first 2 variables of the basering.
     1762     The values of @code{[]} are the coefficients of the Hamburger-Noether
     1763     matrix, the values of @code{<>} are represented by @code{x} in the
     1764     HN-matrix.@*
    17681765     - if a second argument is given, create and export a new ring with
    1769      name @code{displayring} containing an ideal @code{HNE} as described 
     1766     name @code{displayring} containing an ideal @code{HNE} as described
    17701767     above.@*
    1771      - if L corresponds to the output of @code{reddevelop(f)}, 
    1772      @code{displayHNE(L[,n])} shows the HNE's of all branches of f in the form 
     1768     - if L corresponds to the output of @code{reddevelop(f)},
     1769     @code{displayHNE(L[,n])} shows the HNE's of all branches of f in the form
    17731770     described above. The optional parameter is then ignored.
    17741771NOTE:  The 1st line of the above ideal (i.e., @code{HNE[1]}) means that
    17751772     @code{y=[]*z(0)^1+...}, the 2nd line (@code{HNE[2]}) means that
    1776      @code{x=[]*z(1)^2+...}, so you can see which indeterminate 
    1777      corresponds to which line (it's also possible that @code{x} corresponds 
     1773     @code{x=[]*z(1)^2+...}, so you can see which indeterminate
     1774     corresponds to which line (it's also possible that @code{x} corresponds
    17781775     to the 1st line and @code{y} to the 2nd).
    1779  
     1776
    17801777SEE ALSO: develop, reddevelop
    17811778EXAMPLE: example displayHNE; shows an example
     
    20142011
    20152012proc extdevelop (list l, int Exaktheit)
    2016 "USAGE:   extdevelop(L,N); list L, int N 
     2013"USAGE:   extdevelop(L,N); list L, int N
    20172014ASSUME:  L is the output of @code{develop(f)}, or of @code{extdevelop(l,n)},
    20182015         or one entry of the output of @code{reddevelop(f)}.
    2019 RETURN:  an extension of the Hamburger-Noether development of f as a list 
     2016RETURN:  an extension of the Hamburger-Noether development of f as a list
    20202017         in the same format as L has (up to the last entry in the output
    20212018         of @code{develop(f)}).@*
    2022          Type @code{help develop;}, resp. @code{help reddevelop;} for more 
     2019         Type @code{help develop;}, resp. @code{help reddevelop;} for more
    20232020         details.
    20242021NOTE:    The new HN-matrix will have at least N columns (if the HNE is not
    20252022         finite). In particular, if f is irreducible then (in most cases)
    2026          @code{extdevelop(develop(f),N)} will produce the same result as 
     2023         @code{extdevelop(develop(f),N)} will produce the same result as
    20272024         @code{develop(f,N)}.@*
    2028          If the matrix M of L has n columns then, compared with 
     2025         If the matrix M of L has n columns then, compared with
    20292026         @code{param(L)}, @code{param(extdevelop(L,N))} will increase the
    20302027         exactness by at least (N-n) more significant monomials.
     
    21612158  }
    21622159  // ------ the example starts here -------
    2163   "EXAMPLE:"; echo = 2; 
     2160  "EXAMPLE:"; echo = 2;
    21642161  ring exring=0,(x,y),dp;
    21652162  list hne=reddevelop(x14-3y2x11-y3x10-y2x9+3y4x8+y5x7+3y4x6+x5*(-y6+y5)
    21662163                      -3y6x3-y7x2+y8);
    2167   print(hne[1][1]);    // HNE of 1st branch is finite 
     2164  print(hne[1][1]);    // HNE of 1st branch is finite
    21682165  print(extdevelop(hne[1],5)[1]);
    21692166  print(hne[2][1]);    // HNE of 2nd branch can be extended
     
    21852182proc stripHNE (list l)
    21862183"USAGE:   stripHNE(L);  L list
    2187 ASSUME:  L is the output of @code{develop(f)}, or of 
    2188          @code{extdevelop(develop(f),n)}, or (one entry of) the output of 
     2184ASSUME:  L is the output of @code{develop(f)}, or of
     2185         @code{extdevelop(develop(f),n)}, or (one entry of) the output of
    21892186         @code{reddevelop(f)}.
    21902187RETURN:  list in the same format as L, but all polynomials L[4], resp.
     
    22112208}
    22122209example
    2213 { 
     2210{
    22142211  "EXAMPLE:"; echo = 2;
    22152212  int plevel=printlevel; printlevel=-1;
     
    23092306"USAGE:   HNdevelop(f); f poly
    23102307ASSUME:  f is a bivariate polynomial (in the first 2 ring variables)
    2311 CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering 
    2312          @code{ls} over a field extension of the current basering's ground 
     2308CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering
     2309         @code{ls} over a field extension of the current basering's ground
    23132310         field. @*
    23142311         Since the Hamburger-Noether development usually does not exist
    23152312         in the originally given basering, @code{HNdevelop} always defines
    2316          @code{HNEring} and CHANGES to it. The field extension is chosen 
     2313         @code{HNEring} and CHANGES to it. The field extension is chosen
    23172314         minimally.
    23182315RETURN:  list @code{L} of lists @code{L[i]} (corresponding to the output of
    2319          @code{develop(f[i])}, f[i] a branch of f, but the last entry being 
     2316         @code{develop(f[i])}, f[i] a branch of f, but the last entry being
    23202317         omitted).
    23212318@texinfo
     
    23232320@item @code{L[i][1]}; matrix:
    23242321         Each row contains the coefficients of the corresponding line of the
    2325          Hamburger-Noether expansion (HNE) for f[i]. The end of the line is 
     2322         Hamburger-Noether expansion (HNE) for f[i]. The end of the line is
    23262323         marked in the matrix by the first ring variable (usually x).
    2327 @item @code{L[i][2]}; intvec: 
     2324@item @code{L[i][2]}; intvec:
    23282325         indicating the length of lines of the HNE
    23292326@item @code{L[i][3]}; int:
    23302327         0  if the 1st ring variable was transversal (with respect to f[i]), @*
    2331          1  if the variables were changed at the beginning of the 
     2328         1  if the variables were changed at the beginning of the
    23322329            computation, @*
    2333         -1  if an error has occurred. 
    2334 @item @code{L[i][4]}; poly: 
    2335          the transformed polynomial of f[i] to make it possible to extend the 
     2330        -1  if an error has occurred.
     2331@item @code{L[i][4]}; poly:
     2332         the transformed polynomial of f[i] to make it possible to extend the
    23362333         Hamburger-Noether development a posteriori without having to do
    23372334         all the previous calculation once again (0 if not needed)
     
    23422339         If f is known to be irreducible as a power series, @code{develop(f)}
    23432340         should be chosen instead to avoid the change of basering. @*
    2344          If @code{printlevel>=0} comments are displayed (default is 
    2345          @code{printlevel=0}). 
     2341         If @code{printlevel>=0} comments are displayed (default is
     2342         @code{printlevel=0}).
    23462343SEE ALSO: develop, reddevelop, extdevelop, essdevelop, param, displayHNE
    23472344EXAMPLE: example HNdevelop;  shows an example
     
    24292426"USAGE:   reddevelop(f); f poly
    24302427ASSUME:  f is a bivariate polynomial (in the first 2 ring variables)
    2431 CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering 
    2432          @code{ls} over a field extension of the current basering's ground 
     2428CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering
     2429         @code{ls} over a field extension of the current basering's ground
    24332430         field. @*
    24342431         Since the Hamburger-Noether development of a reducible curve
    24352432         singularity usually does not exist in the originally given basering,
    2436          @code{reddevelop} always defines @code{HNEring} and CHANGES to it. 
     2433         @code{reddevelop} always defines @code{HNEring} and CHANGES to it.
    24372434         The field extension is chosen minimally.
    24382435RETURN:  list @code{L} of lists @code{L[i]} (corresponding to the output of
    2439          @code{develop(f[i])}, f[i] a branch of f, but the last entry being 
     2436         @code{develop(f[i])}, f[i] a branch of f, but the last entry being
    24402437         omitted).
    24412438@texinfo
     
    24432440@item @code{L[i][1]}; matrix:
    24442441         Each row contains the coefficients of the corresponding line of the
    2445          Hamburger-Noether expansion (HNE) for f[i]. The end of the line is 
     2442         Hamburger-Noether expansion (HNE) for f[i]. The end of the line is
    24462443         marked in the matrix by the first ring variable (usually x).
    2447 @item @code{L[i][2]}; intvec: 
     2444@item @code{L[i][2]}; intvec:
    24482445         indicating the length of lines of the HNE
    24492446@item @code{L[i][3]}; int:
    24502447         0  if the 1st ring variable was transversal (with respect to f[i]), @*
    2451          1  if the variables were changed at the beginning of the 
     2448         1  if the variables were changed at the beginning of the
    24522449            computation, @*
    2453         -1  if an error has occurred. 
    2454 @item @code{L[i][4]}; poly: 
    2455          the transformed polynomial of f[i] to make it possible to extend the 
     2450        -1  if an error has occurred.
     2451@item @code{L[i][4]}; poly:
     2452         the transformed polynomial of f[i] to make it possible to extend the
    24562453         Hamburger-Noether development a posteriori without having to do
    24572454         all the previous calculation once again (0 if not needed)
    24582455@end table
    24592456@end texinfo
    2460 NOTE:    If @code{printlevel>=0} comments are displayed (default is 
    2461          @code{printlevel=0}). 
     2457NOTE:    If @code{printlevel>=0} comments are displayed (default is
     2458         @code{printlevel=0}).
    24622459SEE ALSO: develop, extdevelop, essdevelop, param, displayHNE
    24632460EXAMPLE: example reddevelop;  shows an example
     
    24892486          +126x10y4+4x8y6-126x8y5+84x6y6-36x4y7+9x2y8-1y9;
    24902487  list hne=reddevelop(f);
    2491   size(hne);            // number of branches 
     2488  size(hne);            // number of branches
    24922489  print(hne[1][1]);     // HN-matrix of 1st branch
    24932490  print(hne[4][1]);     // HN-matrix of 4th branch
     
    28262823"USAGE:   essdevelop(f); f poly
    28272824ASSUME:  f is a bivariate polynomial (in the first 2 ring variables)
    2828 CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering 
    2829          @code{ls} over a field extension of the current basering's ground 
     2825CREATE:  ring with name @code{HNEring}, variables @code{x,y} and ordering
     2826         @code{ls} over a field extension of the current basering's ground
    28302827         field. @*
    28312828         Since the Hamburger-Noether development of a reducible curve
    28322829         singularity usually does not exist in the originally given basering,
    2833          @code{essdevelop} always defines @code{HNEring} and CHANGES to it. 
     2830         @code{essdevelop} always defines @code{HNEring} and CHANGES to it.
    28342831         The field extension is chosen minimally.
    28352832RETURN:  list @code{L} of lists @code{L[i]} (corresponding to the output of
    2836          @code{develop(f[i])}, f[i] an \"essential\" branch of f, but the last 
     2833         @code{develop(f[i])}, f[i] an \"essential\" branch of f, but the last
    28372834         entry being omitted).@*
    28382835         For more details type @code{help reddevelop;}.
     
    28442841         Use @code{reddevelop} or @code{HNdevelop} to compute a complete HNE,
    28452842         i.e., a HNE for all branches.@*
    2846          If @code{printlevel>=0} comments are displayed (default is 
    2847          @code{printlevel=0}). 
     2843         If @code{printlevel>=0} comments are displayed (default is
     2844         @code{printlevel=0}).
    28482845SEE ALSO: develop, reddevelop, HNdevelop, extdevelop
    28492846EXAMPLE: example essdevelop;  shows an example
     
    30503047 //---------- Sonderbehandlung: faktorisere einige Polynome ueber Q(a): -------
    30513048     if (charstr(basering)=="0,a") {
    3052        faktoren,flag=extrafactor(leitf,M,N);  // damit funktion. Bsp. Baladi 5
    3053        if (flag==0)
    3054          { ERROR("Could not factorize in field of type (0,a)!"); }
     3049       faktoren=factorize(charPoly(leitf,M,N),2);  // damit funktion. Bsp. Baladi 5
    30553050     }
    30563051     else {
     
    34953490}
    34963491///////////////////////////////////////////////////////////////////////////////
    3497 
    3498 proc extrafactor (poly leitf, int M, int N)
    3499 "USAGE:   factors,flag=extrafactor(f,M,N);
    3500          list factors, int flag,M,N, poly f in x,y
    3501 RETURN:  for some special f, factors is a list of the factors of
    3502          charPoly(f,M,N), same format as factorize
    3503          (see help charPoly; help factorize)
    3504          In this case, flag!=0 (TRUE). If extrafactor cannot factorize f,
    3505          flag will be 0 (FALSE), factors will be the empty list.
    3506 ASSUME:  basering is (0,a),(x,y),ds or ls
    3507          Newton polygon of f is one side with height N, length M
    3508 NOTE:    This procedure is designed to make reddevelop able to compute some
    3509          special cases that need a ring extension in char 0.
    3510          It becomes obsolete as soon as `factorize' works also in such rings.
    3511 EXAMPLE: example extrafactor;  shows an example
    3512 "
    3513 {
    3514  list faktoren;
    3515 
    3516       if (a2==-1) {
    3517        poly testpol=charPoly(leitf,M,N);
    3518        if (testpol==1+2y2+y4) {
    3519          faktoren=list(ideal(y+a,y-a),intvec(2,2));
    3520          testpol=0;
    3521        }
    3522  //------------ ist Poly von der Form q*i+r*y^n, n in N, q,r in Q ?: ----------
    3523        if ((size(testpol)==2) && (find(string(lead(testpol)),"a")>0)
    3524            && (find(string(testpol-lead(testpol)),"a")==0)) {
    3525         faktoren=list(ideal(testpol),intvec(1));
    3526         testpol=0;
    3527        }
    3528       }
    3529       if (a4==-625) {
    3530         poly testpol=charPoly(leitf,M,N);
    3531         if (testpol==4a2-4y2)
    3532          { faktoren=list(ideal(-4,y+a,y-a),intvec(1,1,1)); testpol=0;}
    3533         if (testpol==-4a2-4y2)
    3534          { faktoren=list(ideal(-4,y+1/25*a3,y-1/25*a3),intvec(1,1,1));
    3535            testpol=0;}
    3536       }
    3537       if (a2+a==-1) {
    3538         poly testpol=charPoly(leitf,M,N);
    3539         if (testpol==1+2y+3y2+2y3+y4)
    3540          { faktoren=list(ideal(1,y-a,y+a+1),intvec(1,2,2)); testpol=0;}
    3541       }
    3542       if (defined(testpol)==0) { poly testpol=1; }
    3543       if (testpol!=0) {
    3544         "factorize not implemented in char (0,a)!";
    3545         "could not factorize:",charPoly(leitf,M,N);
    3546         if (printlevel>0) { pause("Hit RETURN to continue:"); }
    3547       }
    3548  return(faktoren,(testpol==0)); // Test: faktoren==list() geht leider nicht
    3549 }
    3550 example
    3551 { "EXAMPLE:"; echo=2;
    3552   ring r=(0,a),(x,y),ds;
    3553   minpoly=a2+1;
    3554   poly f=x4+2x2y2+y4;
    3555   charPoly(f,4,4);
    3556   list factors;
    3557   int flag;
    3558   factors,flag=extrafactor(f,4,4);
    3559   if (flag!=0) {factors;}
    3560 }
  • Singular/LIB/latex.lib

    r3de58c r50cbdc  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: latex.lib,v 1.19 2001-02-09 10:19:33 lossen Exp $";
     2version="$Id: latex.lib,v 1.20 2001-08-27 14:47:53 Singular Exp $";
    33category="Visualization";
    44info="
     
    3030  @code{TeXwidth} (int) -1, 0, 1..9, >9:  controls breaking of long polynomials
    3131  @code{TeXnofrac} (int) flag:  write 1/2 instead of \\frac@{1@}@{2@}
    32   @code{TeXbrack} (string) \"@{\", \"(\", \"<\", \"|\", empty string: 
     32  @code{TeXbrack} (string) \"@{\", \"(\", \"<\", \"|\", empty string:
    3333                                   controls brackets around ideals and matrices
    3434  @code{TeXproj} (int) flag:  write \":\" instead of \",\" in vectors
     
    131131  texobj("exp001","An ideal ",I);
    132132  closetex("exp001");
    133   tex("exp001"); 
     133  tex("exp001");
    134134  echo=0;
    135135  pause("the created files will be deleted after pressing <RETURN>");
     
    284284proc texfactorize(string fname, poly f, list #)
    285285"USAGE:   texfactorize(fname,f); fname string, f poly
    286 RETURN:  if @code{fname=\"\"}: string, f as a product of its irreducible 
     286RETURN:  if @code{fname=\"\"}: string, f as a product of its irreducible
    287287         factors@*
    288          otherwise: append this string to the file @code{<fname>}, and 
     288         otherwise: append this string to the file @code{<fname>}, and
    289289         return nothing.
    290290NOTE:    preceeding \">>\" are deleted and suffix \".tex\" (if not given)
     
    369369proc texmap(string fname, def m, def @r1, def @r2, list #)
    370370"USAGE:   texmap(fname,m,@r1,@r2); fname string, m string/map, @r1,@r2 rings
    371 RETURN:  if @code{fname=\"\"}: string, the map m from @r1 to @r2 (preceeded 
     371RETURN:  if @code{fname=\"\"}: string, the map m from @r1 to @r2 (preceeded
    372372         by its name if m = string) in TeX-typesetting;@*
    373          otherwise: append this string to the file @code{<fname>}, and 
     373         otherwise: append this string to the file @code{<fname>}, and
    374374         return nothing.
    375 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     375NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    376376         (if not given) is added to @code{fname}.
    377377         If m is a string then it has to be the name of an existing map
     
    561561  n = n+5*(i-anf);
    562562  anf =i;            // the next text in ( , ) as exponent
    563   if (op) 
    564   { 
     563  if (op)
     564  {
    565565    if (s[i]== ","){anf = anf+1;}
    566566    while(s[i] !=")"){ i++;}
     
    580580"USAGE:   texname(fname,s);  fname,s  strings
    581581RETURN:  if @code{fname=\"\"}: string, the transformed string s, where the
    582          following rules apply: 
    583 @example 
     582         following rules apply:
     583@example
    584584      s' + \"~\"             -->  \"\\tilde@{\"+ s' +\"@}\"
    585      \"_\" + int             -->       \"_@{\" + int +\"@}\" 
     585     \"_\" + int             -->       \"_@{\" + int +\"@}\"
    586586  \"[\" + s' + \"]\"           -->      \"_@{\" + s' + \"@}\"
    587    \"A..Z\" + int            --> \"A..Z\" + \"^@{\" + int + \"@}\"   
     587   \"A..Z\" + int            --> \"A..Z\" + \"^@{\" + int + \"@}\"
    588588   \"a..z\" + int            --> \"a..z\" + \"_@{\" + int + \"@}\"
    589589\"(\" + int + \",\" + s' + \")\" --> \"_@{\"+ int +\"@}\" + \"^@{\" + s'+\"@}\"
    590590@end example
    591591         Anyhow, strings which begin with a @code{\"@{\"} are only changed
    592          by deleting the first and last character (intended to remove the 
     592         by deleting the first and last character (intended to remove the
    593593         surrounding curly brackets).
    594594
    595          if @code{fname!=\"\"}: append the transformed string s to the file 
     595         if @code{fname!=\"\"}: append the transformed string s to the file
    596596         @code{<fname>}, and return nothing.
    597 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     597NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    598598         (if not given) is added to @code{fname}.
    599599EXAMPLE: example texname; shows an example
     
    603603  st=manipul(s);
    604604  if (size(fname))
    605   { 
     605  {
    606606    int i=1;
    607607    while (fname[i]==">"){i++;}
    608608    fname = fname[i,size(fname)-i+1];
    609609    if (size(fname)>=4)            // check if filename is ending with ".tex"
    610     { 
     610    {
    611611      if(fname[size(fname)-3,4]!=".tex") {fname = fname +".tex"; }
    612612    }
     
    634634
    635635static proc absterm(poly f)
    636 { 
     636{
    637637  int k;
    638638  for (k=1; k<=nvars(basering); k++)
     
    645645"USAGE:   texobj(fname,l); fname string, l list
    646646RETURN:  if @code{fname=\"\"}: string, the entries of l in LaTeX-typesetting;@*
    647          otherwise: append this string to the file @code{<fname>}, and 
     647         otherwise: append this string to the file @code{<fname>}, and
    648648         return nothing.
    649 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     649NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    650650         (if not given) is added to @code{fname}.
    651651EXAMPLE: example texobj; shows an example
     
    687687   { if (defined(`obj`))
    688688     { if (typeof(`obj`)=="ideal")
    689        { 
     689       {
    690690         Iname = obj; def e = `obj`;     //convert to correct type ideal
    691691         kill obj; def obj = e; kill e;
     
    900900}
    901901example
    902 { 
     902{
    903903   echo=0;
    904904   // -------- prepare for example ---------
     
    942942"USAGE:   texproc(fname,pname); fname,pname strings
    943943ASSUME:  @code{`pname`} is a procedure.
    944 RETURN:  if @code{fname=\"\"}: string, the proc @code{`pname`} in a verbatim 
     944RETURN:  if @code{fname=\"\"}: string, the proc @code{`pname`} in a verbatim
    945945         environment in LaTeX-typesetting;@*
    946          otherwise: append this string to the file @code{<fname>}, and 
     946         otherwise: append this string to the file @code{<fname>}, and
    947947         return nothing.
    948 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     948NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    949949         (if not given) is added to @code{fname}.@*
    950950         @code{texproc} cannot be applied to itself correctly.
     
    10441044"USAGE:   texring(fname, r[,L]); fname string, r ring, L list
    10451045RETURN:  if @code{fname=\"\"}: string, the ring in TeX-typesetting;@*
    1046          otherwise: append this string to the file @code{<fname>} and 
     1046         otherwise: append this string to the file @code{<fname>} and
    10471047         return nothing.
    10481048NOTE:    preceeding \">>\" are deleted and suffix \".tex\" (if not given)
     
    11771177  texring("",ralg,"mipo");
    11781178  //
    1179   ring r49=(49,a),x,dp;                // Galois field 
     1179  ring r49=(49,a),x,dp;                // Galois field
    11801180  texring("",r49);
    11811181  //
     
    12001200proc rmx(string fname)
    12011201"USAGE:   rmx(fname); fname string
    1202 RETURN:  nothing; removes the @code{.log} and @code{.aux} files associated to 
     1202RETURN:  nothing; removes the @code{.log} and @code{.aux} files associated to
    12031203         the LaTeX file <fname>.@*
    1204 NOTE:    If @code{fname} ends by @code{\".dvi\"} or @code{\".tex\"}, the 
     1204NOTE:    If @code{fname} ends by @code{\".dvi\"} or @code{\".tex\"}, the
    12051205         @code{.dvi} or @code{.tex} file will be deleted, too.
    12061206EXAMPLE: example rmx; shows an example
     
    12861286{ "EXAMPLE:"; echo = 2;
    12871287  intmat m[3][4] = 9,2,4,5,2,5,-2,4,-6,10,-1,2,7;
    1288   opentex("exp001"); 
     1288  opentex("exp001");
    12891289  texobj("exp001","An intmat:  ",m);
    12901290  closetex("exp001");
     
    13001300
    13011301static proc parsr(string s)                     // parse real
    1302 { 
     1302{
    13031303  string t;
    13041304  if (s=="      Inf") { return("\\infty",3);}
     
    13121312    else {return(s[1,5]+"*10^"+t,23);}
    13131313  }
    1314   else 
     1314  else
    13151315  {
    13161316    return(s[1,5],12);
     
    13191319
    13201320static proc parsg(string s)                  // parse Galois field
    1321 { 
     1321{
    13221322  int i,j = 1,1;
    13231323  string t;
    13241324  if (short)
    1325   { 
     1325  {
    13261326    t =s[1];
    13271327    if(size(s)>1) {return(t+"^{" + s[2,size(s)-1] + "}",3+2*(size(s)-1));}
     
    13291329  }
    13301330  else
    1331   { 
     1331  {
    13321332    return(parselong(s+"!"));
    13331333  }
     
    13381338"USAGE:   texpoly(fname,p); fname string, p poly
    13391339RETURN:  if @code{fname=\"\"}: string, the poly p in LaTeX-typesetting;@*
    1340          otherwise: append this string to the file @code{<fname>}, and 
     1340         otherwise: append this string to the file @code{<fname>}, and
    13411341         return nothing.
    1342 NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\" 
     1342NOTE:    preceeding \">>\" are deleted in @code{fname}, and suffix \".tex\"
    13431343         (if not given) is added to @code{fname}.
    13441344EXAMPLE: example texpoly; shows an example
     
    18471847 This document illustrates the functionality of the library."+"\\\\" +  nl);
    18481848 write(fname,"\\begin{tabular}{ll}" + nl +
    1849 "LIBRARY: {\\tt latex.lib} &   PROCEDURES FOR TYPESETTING SINGULAR" + 
     1849"LIBRARY: {\\tt latex.lib} &   PROCEDURES FOR TYPESETTING SINGULAR" +
    18501850"\\\\" +  nl +
    18511851" & OBJECTS IN LATEX2E"+
     
    18591859"{\\tt  texdemo([n]);} & produces a file explaining the features of this lib"+
    18601860"\\\\" +  nl +
    1861 "{\\tt  texfactorize(fnm,f);} & creates string in \\LaTeX-format for 
     1861"{\\tt  texfactorize(fnm,f);} & creates string in \\LaTeX-format for
    18621862factors of poly f"+ "\\\\" +  nl +
    18631863"{\\tt  texmap(fnm,m,r1,r2);} & creates string in \\LaTeX-format for
    18641864map m:r1$\\rightarrow$r2"+ "\\\\" +  nl +
    1865 "{\\tt  texname(fnm,s);} &      creates string in \\LaTeX-format for 
     1865"{\\tt  texname(fnm,s);} &      creates string in \\LaTeX-format for
    18661866identifier"+ "\\\\" +  nl +
    18671867"{\\tt  texobj(l);} &           creates string in \\LaTeX-format for
     
    18711871"{\\tt  texproc(fnm,p);} &      creates string in \\LaTeX-format of
    18721872text from proc p"+ "\\\\" +  nl +
    1873 "{\\tt  texring(fnm,r[,l]);} &  creates string in \\LaTeX-lformat for 
     1873"{\\tt  texring(fnm,r[,l]);} &  creates string in \\LaTeX-lformat for
    18741874ring/qring"+ "\\\\" +  nl +
    18751875"{\\tt  rmx(s);} &              removes .aux and .log files of \\LaTeX-files"+
     
    18811881"\\\\" +  nl2 + "\\vspace{0.2cm}" + nl2 +
    18821882"The global variables {\\tt TeXwidth}, {\\tt TeXnofrac}, {\\tt
    1883  TeXbrack}, {\\tt TeXproj}, {\\tt TeXaligned}, {\\tt TeXreplace}, {\\tt 
     1883 TeXbrack}, {\\tt TeXproj}, {\\tt TeXaligned}, {\\tt TeXreplace}, {\\tt
    18841884 NoDollars} are used to control the typesetting: "
    18851885);
     
    19011901write(fname,"Notice that none of these global variables are defined when
    19021902loading \\verb|latex.lib|. A flag variable is set as soon as it is defined.");
    1903  
     1903
    19041904
    19051905//% The procs and
     
    19091909   write(fname,"\\section{Opening a \\LaTeX\\ file}");
    19101910   write(fname,"In order to create a \\LaTeX\\ document and write a standard
    1911 header into it, use the following command."+ 
     1911header into it, use the following command."+
    19121912bv+
    19131913"> string fname = \"" + fname + "\";" + nl +
    1914 "> texopen(fname);" + 
     1914"> texopen(fname);" +
    19151915ev + nl);
    19161916
     
    19341934
    19351935static proc part1(string fname)
    1936 { 
     1936{
    19371937
    19381938  int st = defined(texdemopart);
     
    19561956// -1a------ a ring in char 0, short varnames and poly. ordering ----------
    19571957write(fname,
    1958 " A ring in characteristic 0 with short names of variables and polynomial 
     1958" A ring in characteristic 0 with short names of variables and polynomial
    19591959ordering." +nl);
    19601960 ring r0=0,(x,y,z),dp;
     
    19651965"> texring(fname,r0);" +
    19661966ev);
    1967   texring(fname,r0);             
     1967  texring(fname,r0);
    19681968  write(fname,nl2);
    19691969write(fname,
     
    19721972"> texpoly(fname,g);" +nl +
    19731973ev);
    1974   texpoly(fname,g); 
     1974  texpoly(fname,g);
    19751975  write(fname,"\\\\"+nl2);
    19761976
     
    19861986ev
    19871987);
    1988   texpoly(fname,g/280);             
     1988  texpoly(fname,g/280);
    19891989  kill r0;
    1990  
     1990
    19911991write(fname,"\\\\"+nl2);
    19921992write(fname,"\\Line");
    19931993// -2-------- a ring in char 7, indexed varnames and series ordering ----------
    19941994write(fname,
    1995 " A ring in characteristic 7 with indexed names of variables and local 
     1995" A ring in characteristic 7 with indexed names of variables and local
    19961996ordering." +nl);
    19971997 ring r1=7,(x1,x2,x3,x4),Ds;
    1998  poly g=-2*x1+x4-1; 
    1999 write(fname,
    2000 bv +
    2001 "> ring r1=7,(x1,x2,x3,x4),Ds;" +nl +               
     1998 poly g=-2*x1+x4-1;
     1999write(fname,
     2000bv +
     2001"> ring r1=7,(x1,x2,x3,x4),Ds;" +nl +
    20022002"> texring(fname,r1);" +nl +
    20032003ev);
    2004 texring(fname,r1);             
     2004texring(fname,r1);
    20052005write(fname,lb);
    20062006
    20072007write(fname, bv +
    2008 "> poly g=-2*x1+x4-1;  g;" +nl +               
     2008"> poly g=-2*x1+x4-1;  g;" +nl +
    20092009"> texpoly(fname,g);" +nl +
    20102010ev);
    20112011
    20122012  texpoly(fname,g);
    2013  
     2013
    20142014write(fname,lb);
    20152015write(fname,"\\Line");
     
    20172017// -3-------- a ring in char 0, indexed varnames and local ordering ----------
    20182018write(fname,
    2019 " A ring in characteristic 0 with indexed names of variables and local 
     2019" A ring in characteristic 0 with indexed names of variables and local
    20202020ordering.
    20212021" +nl);
     
    20272027"> texring(fname,r2);" +nl +
    20282028ev);
    2029   texring(fname,r2);             
     2029  texring(fname,r2);
    20302030
    20312031write(fname,
    20322032bv +
    20332033"> poly g=-y(1)^3*x(5)+y(1)*x(2);  g;" +nl+
    2034  string(g) + nl +         
     2034 string(g) + nl +
    20352035"> texpoly(fname,g);"  +nl +
    20362036ev
    20372037);
    2038   texpoly(fname,g);             
     2038  texpoly(fname,g);
    20392039  write(fname,lb);
    2040  
     2040
    20412041write(fname,"\\Line");
    20422042
     
    20612061);
    20622062  texpoly(fname,g); write(fname,lb);
    2063  
     2063
    20642064write(fname,"\\Line");
    20652065
     
    20992099ev);
    21002100 texring(fname,r0t);
    2101 write(fname, 
     2101write(fname,
    21022102bv +
    21032103"> poly g=8*(-s+2t)/(st+t3)*x+t2*x-1;  g;"+nl+
     
    21732173
    21742174write(fname,
    2175 bv + 
     2175bv +
    21762176"> poly g=-(2a13+a)*x2+a2*x-a+1;  g;" +nl+
    21772177 string(g) +nl +
     
    21982198
    21992199write(fname,
    2200 bv + 
     2200bv +
    22012201"> poly g=-(i+1)*x+2i2y2+i+x;  g;" +nl+
    22022202 string(g) +nl +
     
    22952295"It is possible to display a ground field different from the
    22962296actual one by passing any letter in \\LaTeX \\ notation as additional
    2297 argument.  Predefined values are \\verb|\"\\\\C\"|, \\verb|\"\\\\R\"|, 
     2297argument.  Predefined values are \\verb|\"\\\\C\"|, \\verb|\"\\\\R\"|,
    22982298\\verb|\"k\"|, \\verb|\"K\"| and \\verb|\"R\"|."+nl+
    22992299"If for example a ground field of characteristic 0 should be written as
     
    23112311 special role when the ground field is an algebraic extension. In this case
    23122312the parameters will be omitted.");
    2313  
     2313
    23142314write(fname,
    23152315bv +
     
    23582358
    23592359write(fname,nl+ "\\vspace{0.2cm}" + nl2);
    2360  
     2360
    23612361write(fname,"The first and the last variable will always be printed.
    23622362In order to print only these it is sufficient to give a 1 as third argument.");
     
    23892389write(fname,"It is also possible to pass several of the arguments described
    23902390above at once (in any order).");
    2391  
     2391
    23922392
    23932393write(fname,
     
    24072407
    24082408static proc part2(string fname)
    2409 { 
     2409{
    24102410
    24112411  int st = defined(texdemopart);
     
    24272427write(fname,"\\subsection{Factorized polynomials}");
    24282428
    2429 write(fname,"The command \\verb|texfactorize| calls internally the 
    2430 {\\sc Singular} command \\verb|factorize| and returns the product of the 
    2431 irreducible factors. Note that, at the moment, it is not possible to pass 
     2429write(fname,"The command \\verb|texfactorize| calls internally the
     2430{\\sc Singular} command \\verb|factorize| and returns the product of the
     2431irreducible factors. Note that, at the moment, it is not possible to pass
    24322432any optional arguments for \\verb|factorize| through \\verb|texfactorize|.");
    24332433
     
    24662466// ---------------------------------------------
    24672467write(fname,"By setting the global variable \\verb|TeXreplace| it is possible
    2468 to define rules for replacing strings or variable names. 
     2468to define rules for replacing strings or variable names.
    24692469\\verb|TeXreplace| has to be a list of twoelemented lists where the first
    24702470entry is the text which should be replaced by the second entry.
    2471 This may be applied to replace names of variables, but is also used 
     2471This may be applied to replace names of variables, but is also used
    24722472when calling \\verb|texname| or \\verb|texmap|. Note that it
    24732473is necessary to write a double backslash \\verb|\\\\\| at the beginning of
     
    25342534"\\]",nl);
    25352535
    2536 write(fname,"Note that the size of terms is calculated with certain 
     2536write(fname,"Note that the size of terms is calculated with certain
    25372537multiplicities.",nl);
    25382538
     
    25502550ev);
    25512551
    2552   setring r0; 
     2552  setring r0;
    25532553  poly g=-x2y+2y13z+1;
    25542554  poly f=g^2;
     
    25902590write(fname,nl2,"\\Line");
    25912591
    2592 write(fname,"There are two possibilities to convert a polynomial into 
     2592write(fname,"There are two possibilities to convert a polynomial into
    25932593\\LaTeX \\ code: either by using \\verb|texpoly| or by calling \\verb|texobj|.
    25942594The difference is that \\verb|texpoly| puts the polynomial in textmode
     
    26032603
    26042604// setring r3;
    2605  
     2605
    26062606  ring r3=0,(x_1,x_2,x_3),wp(3,2,1);
    26072607  poly g=-x_1*x_2+2*x_2*x_3+x_1*x_3;
     
    26412641write(fname,"If the global variable \\verb|Texaligned| is set then the ideal
    26422642is displayed as a row vector.");
    2643  
     2643
    26442644write(fname,
    26452645bv +
     
    27252725
    27262726static proc part3(string fname)
    2727 { 
     2727{
    27282728  int st=defined(texdemopart);
    27292729  string nl=newline;
     
    27342734
    27352735  if (not(st) or st>=3)
    2736   { 
     2736  {
    27372737    print(" Call part2 first");
    27382738    return();
     
    27462746write(fname,"\\section{Typeseting maps between rings}");
    27472747write(fname,"By default, maps are displayed in the following way:");
    2748  
     2748
    27492749write(fname,
    27502750bv +
     
    27542754"> texmap(fname,phi,r4,r5);" + nl +
    27552755ev);
    2756  
     2756
    27572757  ring @r4_h=0,(x,y,z),dp;
    27582758  if(system("with","Namespaces")) { exportto(Current, @r4_h); }
     
    27672767write(fname,"If the global variable \\verb|TeXaligned| is set, then the
    27682768map is displayed in one line.");
    2769  
     2769
    27702770write(fname,
    27712771bv +
     
    27862786the second one contains the parameters for the domain. Note that if only one
    27872787list is present then it is applied to both of the rings.");
    2788  
     2788
    27892789write(fname,
    27902790bv +
     
    28022802ev );
    28032803
    2804  texmap(fname,@phi_h,@r4_h,r5,list(),list("{")); 
     2804 texmap(fname,@phi_h,@r4_h,r5,list(),list("{"));
    28052805
    28062806write(fname,nl+"\\Line");
     
    28362836write(fname, "Complex data structures such as matrices, vectors or modules
    28372837can be displayed by using the procedure \\verb|texobj|.");
    2838  
     2838
    28392839write(fname,"\\subsection{Matrices and vectors}");
    28402840//=======================================================================
     
    29372937ev );
    29382938
    2939   setring r; 
     2939  setring r;
    29402940  ideal I=3xz5+x2y3-3z,7xz5+y3z+x-z,-xyz2+4yz+2x;
    29412941  int TeXproj; export TeXproj;
    2942  
     2942
    29432943  texobj(fname,V);
    29442944  kill TeXproj;
     
    29482948"> kill TeXproj;"+nl+
    29492949ev);
    2950  
     2950
    29512951write(fname,"\\subsection{Modules}",nl2);
    29522952
     
    29842984
    29852985write(fname,"Integer matrices are displayed in the following way.");
    2986  
     2986
    29872987intmat m[3][4]=-1,3,5,2,-2,8,6,0,2,5,8,7;
    29882988
     
    30653065      "// not an isolated singularity";
    30663066    }
    3067     return(m_nr); 
     3067    return(m_nr);
    30683068  }
    30693069  export(milnor_number);
     
    30723072write(fname,"The following procedure allows to include the source code
    30733073of procedures into a \\LaTeX document.");
    3074 write(fname, 
     3074write(fname,
    30753075bv +
    30763076"> texproc(fname,\"milnor\_number\");" +nl+
    30773077ev);
    3078  
     3078
    30793079 texproc(fname,"milnor_number");
    30803080
    30813081  kill(milnor_number);
    3082  
     3082
    30833083// ------------------------------ closing the tex file -------------------
    30843084write(fname,"\\section{Closing the \\LaTeX\\ file}");
  • Singular/LIB/lll.lib

    r3de58c r50cbdc  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: lll.lib,v 1.2 2001-03-26 12:05:00 Singular Exp $";
     2version="$Id: lll.lib,v 1.3 2001-08-27 14:47:54 Singular Exp $";
    33category="Commutative Algebra";
    44info="
    5 LIBRARY: LLL.lib      Integral LLL-Algorithm 
     5LIBRARY: LLL.lib      Integral LLL-Algorithm
    66AUTHOR:  Alberto Vigneron-Tenorio and Alfredo Sanchez-Navarro
    77         email: alberto.vigneron@uca.es, alfredo.sanchez@uca.es
     
    5757  {
    5858    dummy=system("sh","rm -f "+file+" "+resfile);
    59   } 
     59  }
    6060  else
    6161  {
    6262    ERROR("external program returns "+string(dummy)+newline+
    6363          "see "+file+" and "+resfile+" for details");
    64   }       
     64  }
    6565
    6666  execute(solution); // result is now in list "res"
     
    7272  list l=list(1,-2,4),list(2,1,-7);
    7373  LLL(l);
    74 } 
     74}
    7575///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/mprimdec.lib

    r3de58c r50cbdc  
    1 // $Id: mprimdec.lib,v 1.3 2001-07-10 11:49:19 dreyer Exp $
     1// $Id: mprimdec.lib,v 1.4 2001-08-27 14:47:54 Singular Exp $
    22///////////////////////////////////////////////////////////////////////////////
    33// mprimdec.lib
    4 // algorithms for primary decomposition for modules based on 
    5 // the algorithms of Gianni, Trager and Zacharias and 
     4// algorithms for primary decomposition for modules based on
     5// the algorithms of Gianni, Trager and Zacharias and
    66// Shimoyama and Yokoyama (generalization of the latter
    7 // suggested by Hans-Gert Gräbe, Leipzig  ) 
    8 // using elments of primdec.lib 
    9 // written by Alexander Dreyer 
     7// suggested by Hans-Gert Gräbe, Leipzig  )
     8// using elments of primdec.lib
     9// written by Alexander Dreyer
    1010//
    1111// $Log: not supported by cvs2svn $
     12// Revision 1.3  2001/07/10 11:49:19  dreyer
     13// + changed commands factor to factorize(...,2), idealsEqual to modulesEqual
     14//   minAssPrimes to minAssGTZ;  minAssChar;
     15//
    1216//
    1317///////////////////////////////////////////////////////////////////////////////
    1418
    15 version="$Id: mprimdec.lib,v 1.3 2001-07-10 11:49:19 dreyer Exp $";
     19version="$Id: mprimdec.lib,v 1.4 2001-08-27 14:47:54 Singular Exp $";
    1620category="Commutative Algebra";
    1721
     
    162166  {
    163167    if( (size(#)>0) ){
    164       list pr = minAssChar(ann);   // causes message  "/ ** redefining @res **" 
     168      list pr = minAssChar(ann);   // causes message  "/ ** redefining @res **"
    165169    }
    166170    else{
    167       list pr = minAssGTZ(ann); 
     171      list pr = minAssGTZ(ann);
    168172    }
    169173  }
  • Singular/LIB/normal.lib

    r3de58c r50cbdc  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: normal.lib,v 1.35 2001-03-19 22:57:16 greuel Exp $";
     2version="$Id: normal.lib,v 1.36 2001-08-27 14:47:56 Singular Exp $";
    33category="Commutative Algebra";
    44info="
     
    88
    99PROCEDURES:
    10  normal(I);             computes the normalization of basering/I
     10 normal(I[,wd]);        computes the normalization of basering/I
     11                        resp. computes the normalization of basering/I and
     12                        the delta-invariante
    1113 HomJJ(L);              presentation of End_R(J) as affine ring, L a list
     14 genus(I);              computes the genus of the projective curve defined
     15                        by I
    1216";
    1317
     
    1923LIB "inout.lib";
    2024LIB "ring.lib";
     25LIB "hnoether.lib";
    2126///////////////////////////////////////////////////////////////////////////////
    22 static proc isR_HomJR (list Li)
    23 "USAGE:   isR_HomJR (Li);  Li = list: ideal SBid, ideal J, poly p
    24 COMPUTE: module Hom_R(J,R) = R:J and compare with R
    25 ASSUME:  R    = P/SBid,  P = basering
    26          SBid = standard basis of an ideal in P,
    27          J    = ideal in P containing the polynomial p,
    28          p    = nonzero divisor of R
    29 RETURN:  1 if R = R:J, 0 if not
    30 EXAMPLE: example isR_HomJR;  shows an example
    31 "
    32 {
    33    int n, ii;
    34  def P = basering;
    35    ideal SBid = Li[1];
    36    ideal J = Li[2];
    37    poly p = Li[3];
    38    attrib(SBid,"isSB",1);
    39    attrib(p,"isSB",1);
    40  qring R    = SBid;
    41    ideal J  = fetch(P,J);
    42    poly p   = fetch(P,p);
    43    ideal f  = quotient(p,J);
    44    ideal lp = std(p);
    45    n=1;
    46    for (ii=1; ii<=size(f); ii++ )
    47    {
    48       if ( reduce(f[ii],lp) != 0)
    49       { n = 0; break; }
    50    }
    51    return (n);
    52  //?spaeter hier einen Test ob Hom(I,R) = Hom(I,I)?
    53 }
    54 example
    55 {"EXAMPLE:";  echo = 2;
    56   ring r   = 0,(x,y,z),dp;
    57   ideal id = y7-x5+z2;
    58   ideal J  = x3,y+z;
    59   poly p   = xy;
    60   list Li  = std(id),J,p;
    61   isR_HomJR (Li);
    62 
    63   ring s   = 0,(t,x,y),dp;
    64   ideal id = x2-y2*(y-t);
    65   ideal J  = jacob(id);
    66   poly p   = J[1];
    67   list Li  = std(id),J,p;
    68   isR_HomJR (Li);
    69 }
    70 ///////////////////////////////////////////////////////////////////////////////
    7127
    7228proc HomJJ (list Li)
    73 "USAGE:   HomJJ (Li); Li list: ideal SBid, ideal id, ideal J, poly p, int count
     29"USAGE:   HomJJ (Li);  Li = list: ideal SBid, ideal id, ideal J, poly p
    7430ASSUME:  R    = P/id,  P = basering, a polynomial ring, id an ideal of P,
    7531@*       SBid = standard basis of id,
    7632@*       J    = ideal of P containing the polynomial p,
    7733@*       p    = nonzero divisor of R
    78 @*       count controls printlevel during recursive call
    7934COMPUTE: Endomorphism ring End_R(J)=Hom_R(J,J) with its ring structure as
    8035         affine ring, together with the canonical map R --> Hom_R(J,J),
     
    8641               endphi describes the canonical map R -> Hom_R(J,J)
    8742         l[2] : an integer which is 1 if phi is an isomorphism, 0 if not
     43         l[3] : an integer, the contribution to delta
    8844@end format
    8945NOTE:    printlevel >=1: display comments (default: printlevel=0)
     
    9349//---------- initialisation ---------------------------------------------------
    9450
    95    int isIso,isPr,isCo,isRe,isEq,ii,jj,q,y,count;
     51   int isIso,isPr,isCo,isRe,isEq,oSAZ,ii,jj,q,y;
    9652   intvec rw,rw1;
    9753   list L;
    98    if(size(Li)>=5)
    99    {
    100      count = Li[5];
    101    }
    102    y = printlevel-voice+count; 
    103  def P = basering;
     54   y = printlevel-voice+2;  // y=printlevel (default: y=0)
     55   def P = basering;
    10456   ideal SBid, id, J = Li[1], Li[2], Li[3];
    10557   poly p = Li[4];
     
    11668      if(attrib(id,"isPrim")==1)  { isPr=1; }
    11769   }
     70   if( typeof(attrib(id,"onlySingularAtZero"))=="int" )
     71   {
     72      if(attrib(id,"onlySingularAtZero")==1){oSAZ=1; }
     73   }
    11874   if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
    11975   {
     
    13389   }
    13490//-------------------------- go to quotient ring ------------------------------
    135  qring R  = SBid;
     91   qring R  = SBid;
    13692   ideal id = fetch(P,id);
    13793   ideal J  = fetch(P,J);
     
    13995   ideal f,rf,f2;
    14096   module syzf;
    141 
    14297//---------- computation of p*Hom(J,J) as R-ideal -----------------------------
    14398   if ( y>=1 )
     
    149104   }
    150105   f  = quotient(p*J,J);
     106
    151107   if ( y>=1 )
    152108   { "// the module p*Hom(J,J) = p*J:J, p a non-zerodivisor";
    153109      "// p"; p;
    154       "// f=p*J:J";
    155       if( y>=2 ) { f; }     
     110      "// f=p*J:J";f;
    156111   }
    157112   f2 = std(p);
    158 
    159    if(isIso==0)
    160    {
    161      ideal f1=std(f);
    162      attrib(f1,"isSB",1);
    163     // if( codim(f1,f2) >= 0 )
    164     // {
    165     //  dbprint(printlevel-voice+3,"// dimension of non-normal locus is zero");
    166     //    isIso=1;
    167     // }
    168   }
     113 
    169114//---------- Test: Hom(J,J) == R ?, if yes, go home ---------------------------
    170115
    171116   rf = interred(reduce(f,f2));       // represents p*Hom(J,J)/p*R = Hom(J,J)/R
     117
    172118   if ( size(rf) == 0 )
    173119   {
     
    186132      setring lastRing;
    187133
     134      attrib(endid,"onlySingularAtZero",oSAZ);
    188135      attrib(endid,"isCohenMacaulay",isCo);
    189136      attrib(endid,"isPrim",isPr);
     
    195142      L=lastRing;
    196143      L = insert(L,1,1);
     144      dbprint(y,"// case R = Hom(J,J)");
    197145      if(y>=1)
    198146      {
    199          "// case R = Hom(J,J), we are ready with this component";
     147         "//   R=Hom(J,J)";
    200148         "   ";
    201        if( y>=2 )
    202        {
    203         lastRing;
     149         lastRing;
    204150         "   ";
    205151         "//   the new ideal";
    206          if( y>=2 ) { endid; }
     152         endid;
    207153         "   ";
    208154         "//   the old ring";
     
    222168         pause();
    223169         newline;
    224        }
    225170      }
    226171      setring P;
     172      L[3]=0;
    227173      return(L);
    228174   }
     
    230176   {
    231177      "// R is not equal to Hom(J,J), we have to try again";
    232     if( y>=2 )
    233     {  pause();
    234        newline;
    235     }   
     178      pause();
     179      newline;
    236180   }
    237181//---------- Hom(J,J) != R: create new ring and map from old ring -------------
    238182// the ring newR1/SBid+syzf will be isomorphic to Hom(J,J) as R-module
    239183
     184   f=mstd(f)[2];
     185   ideal ann=quotient(f2,f);
     186   int delta;
     187   if(isIso&&isEq){delta=vdim(std(modulo(f,ideal(p))));}
     188
    240189   f = p,rf;          // generates pJ:J mod(p), i.e. p*Hom(J,J)/p*R as R-module
    241190   q = size(f);
     191
    242192   syzf = syz(f);
    243193
     
    261211   attrib(SBid,"isSB",1);
    262212
    263  qring newR = std(SBid);
     213   qring newR = std(SBid);
     214
    264215   map psi = R,ideal(X(1..nvars(R)));
    265216   ideal id = psi(id);
     
    286237      "//   the linear relations";
    287238      " ";
    288       if( y>=2 )
    289       {  Lin;     
    290          pause();
    291          "";
    292       }
    293    }
     239      Lin;
     240      "   ";
     241   }
     242
    294243   for (ii=2; ii<=q; ii++ )
    295244   {
     
    300249      }
    301250   }
     251
    302252   if(y>=1)
    303253   {
    304254      "//   the quadratic relations";
    305         if( y>=2 )
    306       {     
    307           "   ";
    308          interred(Quad);
    309          pause();
    310          newline;
    311       }
    312    }
    313    Q = Lin+Quad;
     255      "   ";
     256      interred(Quad);
     257      pause();
     258      newline;
     259   }
     260   Q = Lin,Quad;
    314261   Q = subst(Q,T(1),1);
    315    Q = interred(reduce(Q,std(0)));
     262   Q=mstd(Q)[2];
    316263//---------- reduce number of variables by substitution, if possible ----------
    317264   if (homo==1)
     
    324271   }
    325272
    326    ideal endid  = imap(newR,id)+imap(newR,Q);
     273   ideal endid  = imap(newR,id),imap(newR,Q);
    327274   ideal endphi = ideal(X(1..nvars(R)));
    328275
    329276   L=substpart(endid,endphi,homo,rw);
     277
    330278   def lastRing=L[1];
    331279   setring lastRing;
     280
     281   attrib(endid,"onlySingularAtZero",0);
     282   map sigma=R,endphi;
     283   ideal an=sigma(ann);
     284   export(an);  //noetig?
     285   ideal te=an,endid;
     286   if(isIso&&(size(reduce(te,std(maxideal(1))))==0))
     287   {
     288      attrib(endid,"onlySingularAtZero",oSAZ);
     289   }
     290   kill te;
    332291   attrib(endid,"isCohenMacaulay",isCo);
    333292   attrib(endid,"isPrim",isPr);
     
    337296   attrib(endid,"isCompleteIntersection",0);
    338297   attrib(endid,"isRad",0);
    339   // export(endid);
    340   // export(endphi);
    341298   if(y>=1)
    342299   {
    343300      "//   the new ring after reduction of the number of variables";
    344       show(lastRing);
    345       pause(); "
    346       ";
    347     if(y >=2)
    348     {
     301      "   ";
    349302      lastRing;
    350303      "   ";
     
    369322      pause();
    370323      newline;
    371     }
    372324   }
    373325   L = lastRing;
    374326   L = insert(L,0,1);
     327   L[3]=delta;
    375328   return(L);
    376329}
     
    394347
    395348proc normal(ideal id, list #)
    396 "USAGE:   normal(i [,choose]);  i a radical ideal, choose empty or 1
     349"USAGE:   normal(i [,choose]);  i a radical ideal, choose empty, 1 or "wd"
    397350         if choose=1 the normalization of the associated primes is computed
    398351         (which is sometimes more efficient)
     352         if choose="wd" the delta-invariant is computed simultaneously
     353         this may take much more time in the reducible case because the
     354         factorizing standardbasis algorithm cannot be used.
    399355ASSUME:  The ideal must be radical, for non radical ideals the output may
    400356         be wrong (i=radical(i); makes i radical)
    401 RETURN:   a list of rings, say nor:
     357RETURN:   a list of rings, say nor and in case of choose="wd" an integer
    402358@format
     359         at the end of the list.
    403360         each ring nor[i] contains two ideals
    404361         with given names norid and normap such that
     
    409366@end format
    410367NOTE:    to use the i-th ring type: def R=nor[i]; setring R;.
    411 @*       Not implemented for local or mixed orderings and quotient rings.
     368@*       Increasing printlevel displays more comments (default: printlevel=0)
     369@*       Not implemented for local or mixed orderings.
    412370@*       If the input ideal i is weighted homogeneous a weighted ordering may
    413371         be used (qhweight(i); computes weights).
    414 @*       printlevel = 1: count normalization loops (default: printlevel=0)
    415 @*       printlevel > 1: protocoll of normalization steps
    416 @*       printlevel > 2: protocoll of all normalization steps, pauses
    417 @*       printlevel > 3: display some (>4 all) intermediate results, pauses
    418372EXAMPLE: example normal; shows an example
    419373"
    420374{
    421    int i,j,y;
     375   int i,j,y,withdelta;
    422376   string sr;
    423377   list result,prim,keepresult;
    424378   y = printlevel-voice+2;
    425 
     379   if(size(#)>0)
     380   {
     381     if(typeof(#[1])=="string")
     382     {
     383       kill #;
     384       list #;
     385       withdelta=1;
     386     }
     387   }
    426388   attrib(id,"isRadical",1);
    427389   if ( ord_test(basering) != 1)
     
    473435      if(y>=1)
    474436      {
    475         "";
    476          "// we have ",size(prim),"equidimensional component(s)";
     437         "// we have ",size(prim),"equidimensional components";
     438      }
     439      if(withdelta &&(size(prim)>1))
     440      {
     441         withdelta=0;
     442         "WARNING!  cannot compute delta,";
     443         "the ideal is not equidimensional";
     444      }
     445      if(!withdelta)
     446      {
     447         option(redSB);
     448         for(j=1;j<=size(prim);j++)
     449         {
     450            keepresult=keepresult+facstd(prim[j]);
     451         }
     452         prim=keepresult;
     453         option(noredSB);
    477454      }
    478455   }
     
    487464         else
    488465         {
    489             prim=minAssGTZ(id);
     466            prim=minAssPrimes(id);
    490467         }
    491468      }
    492469      else
    493470      {
    494          prim=minAssGTZ(id);
     471         prim=minAssPrimes(id);
    495472      }
    496473      if(y>=1)
    497474      {
    498          "";
    499          "// we have ",size(prim),"irreducible component(s)";
     475         "// we have ",size(prim),"irreducible components";
    500476      }
    501477   }
     
    504480      if(y>=1)
    505481      {
    506          "";
    507          "// BEGIN with equidimensional/irreducible component",i;
     482         "// we are in loop ",i;
    508483      }
    509484      attrib(prim[i],"isCohenMacaulay",0);
     
    520495      attrib(prim[i],"isEquidimensional",1);
    521496      attrib(prim[i],"isCompleteIntersection",0);
     497      attrib(prim[i],"onlySingularAtZero",0);
     498      if( typeof(attrib(id,"onlySingularAtZero"))=="int" )
     499      {
     500            if(attrib(id,"onlySingularAtZero")==1)
     501             {attrib(prim[i],"onlySingularAtZero",1); }
     502      }
    522503
    523504      if( typeof(attrib(id,"isIsolatedSingularity"))=="int" )
     
    533514      }
    534515      keepresult=normalizationPrimes(prim[i],maxideal(1),0);
    535       for(j=1;j<=size(keepresult);j++)
     516
     517      for(j=1;j<=size(keepresult)-1;j++)
    536518      {
    537519         result=insert(result,keepresult[j]);
    538520      }
    539       sr = string(size(result));
     521      sr = string(size(result));     
     522   }
     523   if(withdelta)
     524   {
     525      sr = string(size(keepresult)-1);
     526      result=keepresult;
    540527   }
    541528      dbprint(y+1,"
    542529// 'normal' created a list of "+sr+" ring(s).
     530// nor["+sr+"+1] is the delta-invariant in case of choose=wd.
    543531// To see the rings, type (if the name of your list is nor):
    544      show(nor);
     532     show( nor);
    545533// To access the 1-st ring and map (similar for the others), type:
    546534     def R = nor[1]; setring R;  norid; normap;
     
    561549   norid;
    562550   normap;
     551
     552   ring s=0,(x,y),dp;
     553   ideal i=(x-y^2)^2 - y*x^3;
     554   nor=normal(i,"wd");
     555   //the delta-invariant
     556   nor[size(nor)];
    563557}
    564558
    565559///////////////////////////////////////////////////////////////////////////////
    566 static proc normalizationPrimes(ideal i,ideal ihp, int count, list #)
    567 "USAGE:   normalizationPrimes(i,ihp[,si,countt]);  i prime ideal, ihp map
    568          (partial normalization), si ideal of singular locus,
    569          count = integer to count the number of normalization loops
    570 RETURN:  a list of one ring L=R, in  R are two ideals
    571          S,M such that R/M is the normalization of original basering
    572          S is a standardbasis of M
    573 NOTE:    to use the ring: def r=L[1];setring r;
    574          printlevel = 1: count normalization loops (default: printlevel=0)
    575          printlevel > 1: protocoll of normalization steps
    576          printlevel > 2: protocoll of all normalization steps, pauses
    577          printlevel > 3: display some (>4 all) intermediate results, pauses
     560static proc normalizationPrimes(ideal i,ideal ihp,int delta, list #)
     561"USAGE:   normalizationPrimes(i,ihp[,si]);  i equidimensional ideal, ihp map
     562         (partial normalization),delta partial delta-invariant,
     563          # ideal of singular locus
     564RETURN:   a list of rings, say nor, and an integer, the delta-invariant
     565          at the end of the list.
     566          each ring nor[i] contains two ideals
     567          with given names norid and normap such that
     568           - the direct sum of the rings nor[i]/norid is
     569             the normalization of basering/id;
     570           - normap gives the normalization map from basering/id
     571             to nor[i]/norid (for each i)
    578572EXAMPLE: example normalizationPrimes; shows an example
    579573"
    580574{
    581    count = count+1;   
    582    int y = printlevel-voice+count+1;  // y=printlevel (default: y=0)
    583    if(y>=0)
    584    {
    585      "// START normalization LOOP ",count;
    586    }
    587    if( y>=3)
    588    {
    589      "// with ideal";  "";
     575
     576   int y = printlevel-voice+2;  // y=printlevel (default: y=0)
     577
     578   if(y>=1)
     579   {
     580     "";
     581     "// START a normalization loop with the ideal";  "";
    590582     i;  "";
    591583     basering;  "";
     
    593585     newline;
    594586   }
    595 
    596587
    597588   def BAS=basering;
     
    614605         export normap;
    615606         result=newR7;
     607         result[size(result)+1]=delta;
    616608         setring BAS;
    617609         return(result);
     
    620612   if(y>=1)
    621613   {
    622    "// SB-computation of ideal of size",size(i),"in ring with",nvars(basering),"variables";
    623    }
    624 // -------------- SB-computation of the input ideal ----------------------
    625    list SM=mstd(i);                //here the work starts, SM[1] a SB of i
    626                                    //SM[2] a smaller set of generators of i
    627    int dimSM =  dim(SM[1]);        //dimension of i, V(i)=variety to normalize
     614     "// SB-computation of the input ideal";
     615   }
     616   list SM=mstd(i);                //here the work starts
     617   int dimSM =  dim(SM[1]);        //dimension of variety to normalize
    628618  // Case: Get an ideal containing a unit
    629619   if( dimSM == -1)
     
    643633         export normap;
    644634         result=newR6;
     635         result[size(result)+1]=delta;
    645636         setring BAS;
    646637         return(result);
     
    652643      dimSM;"";
    653644   }
    654 
    655    if(size(#)>0)                   //ideal of sing locus is given in #[1]
    656    {
    657       list JM=mstd(#[1]);
    658       if( typeof(attrib(#[1],"isRad"))!="int" )
    659       {
    660          attrib(JM[2],"isRad",0);
    661       }
    662    }
    663 
    664 // -------- transfer attributes from ideal i to SM[2], SM = mstd(i) --------
     645   if(size(#)>0)
     646   {
     647      if(attrib(i,"onlySingularAtZero"))
     648      {
     649         list JM=maxideal(1),maxideal(1);
     650         attrib(JM[1],"isSB",1);
     651         attrib(JM[2],"isRad",1);
     652      }
     653      else
     654      {
     655         ideal te=#[1],SM[2];
     656         list JM=mstd(te);
     657         kill te;
     658         if( typeof(attrib(#[1],"isRad"))!="int" )
     659         {
     660            attrib(JM[2],"isRad",0);
     661         }
     662      }
     663   }
     664
    665665   if(attrib(i,"isPrim")==1)
    666666   {
     
    703703      attrib(SM[2],"isEquidimensional",0);
    704704   }
    705     if(attrib(i,"isCompleteIntersection")==1)
     705   if(attrib(i,"isCompleteIntersection")==1)
    706706   {
    707707      attrib(SM[2],"isCompleteIntersection",1);
     
    711711      attrib(SM[2],"isCompleteIntersection",0);
    712712   }
    713 
    714 //************* case 0: check and prepare special cases ****************
    715 //no computation for the normalization in case 0
    716 
    717 //-------------------------- the smooth case ----------------------------
     713   if(attrib(i,"onlySingularAtZero")==1)
     714   {
     715      attrib(SM[2],"onlySingularAtZero",1);
     716   }
     717   else
     718   {
     719      attrib(SM[2],"onlySingularAtZero",0);
     720   }
     721   if((attrib(SM[2],"isIsolatedSingularity")==1)&&(homog(SM[2])==1))
     722   {
     723      attrib(SM[2],"onlySingularAtZero",1);
     724   }
     725
     726   //the smooth case
    718727   if(size(#)>0)
    719728   {
     
    725734         }
    726735         MB=SM[2];
    727          intvec rw;
     736         intvec rw;;
    728737         list LL=substpart(MB,ihp,0,rw);
    729738         def newR6=LL[1];
     
    735744         export normap;
    736745         result=newR6;
     746         result[size(result)+1]=delta;
    737747         setring BAS;
    738748         return(result);
    739749     }
    740750   }
    741    // recall: SM = mstd(i), i = ideal to start with in normaliztion loop
    742    //         JM = mstd(#[1]), #[1]= ideal of singular locus of i
    743    //              #[1] is given after the first normalization loop
    744 
    745 //---------------- the homogeneous zero-dimensional case ----------------
     751
     752   //the zero-dimensional case
    746753   if((dim(SM[1])==0)&&(homog(SM[2])==1))
    747754   {
     
    761768      export normap;
    762769      result=newR5;
     770      result[size(result)+1]=delta;
    763771      setring BAS;
    764772      return(result);
    765773   }
    766774
    767 //------------- the homogeneous one-dimensional case -------------------
    768 //in this case i defines a line because it is irreducible and homogeneous
     775   //the one-dimensional case
     776   //in this case it is a line because
     777   //it is irreducible and homogeneous
    769778   if((dim(SM[1])==1)&&(attrib(SM[2],"isPrim")==1)
    770779        &&(homog(SM[2])==1))
     
    785794      export normap;
    786795      result=newR4;
     796      result[size(result)+1]=delta;
    787797      setring BAS;
    788798      return(result);
    789799   }
    790 //----------------------- the higher dimensional case ----------------------
     800
     801   //the higher dimensional case
    791802   //we test first of all CohenMacaulay and
    792803   //complete intersection
     
    802813      }
    803814   }
    804 
    805    //compute the singular locus+lower dimensional components
    806 
    807 //------- case: not(isolated singularity and homogeneous) -------------------
    808    if((attrib(SM[2],"isIsolatedSingularity")==0) && (size(#)==0))
    809    {
    810 //---------- computation of ideal of singular locus -------------------------
     815   if((attrib(SM[2],"onlySingularAtZero")==0)&&(size(i)==1))
     816   {
     817      int tau=vdim(std(i+jacob(i)));
     818      if(tau>=0)
     819      {
     820        execute("ring BASL="+charstr(BAS)+",("+varstr(BAS)+"),ds;");
     821        ideal i=imap(BAS,i);
     822        int tauloc=vdim(std(i+jacob(i)));
     823        setring BAS;
     824        attrib(SM[2],"onlySingularAtZero",(tau==tauloc));
     825        kill BASL;
     826      }
     827   }
     828
     829   //compute the singular locus
     830   if((attrib(SM[2],"onlySingularAtZero")==0)&&(size(#)==0))
     831   {
    811832      J=minor(jacob(SM[2]),nvars(basering)-dim(SM[1]));
    812       //ti=timer;
    813833      if(y >=1 )
    814834      {
    815          "// SB of singular locus will be computed ";
    816          if(y >=2 )
    817          {
    818            "//in ring:";
    819            show(basering);
    820          }
    821       }
    822      
    823       J = simplify(J,16);  //this makes ist for huge J much faster
    824       ideal sin=J,SM[2];
     835         "// SB of singular locus will be computed";
     836      }
     837      ideal sin=J,SM[1];
    825838      list JM=mstd(sin);
    826      
    827       //JM[1] SB of singular locus, JM[2] minbasis of singular locus
    828       //SM[1] SB of ideal in normalisation loop, SM[2] minbasis
    829 
     839      attrib(JM[1],"isSB",1);
     840
     841      //JM[1] SB of singular locus, JM[2]=minbasis of singular locus
     842      //SM[1] SB of the input ideal, SM[2] minbasis
    830843      if(y>=1)
    831844      {
     
    833846         dim(JM[1]); "";
    834847      }
    835       //   timer-ti;
    836       attrib(JM[1],"isSB",1);
     848
    837849      if(dim(JM[1])==-1)
    838850      {
     
    852864         export normap;
    853865         result=newR3;
     866         result[size(result)+1]=delta;
    854867         setring BAS;
    855868         return(result);
    856869      }
    857       if(dim(JM[1])==0 && (homog(SM[2])==1))
     870      if(dim(JM[1])==0)
    858871      {
    859872         attrib(SM[2],"isIsolatedSingularity",1);
     873         if(homog(SM[2])){attrib(SM[2],"onlySingularAtZero",1);}
    860874      }
    861875      if(dim(JM[1])<=dim(SM[1])-2)
     
    864878      }
    865879   }
    866    
    867 //------------ case: isolated singularity and homogeneous -----------------
    868    if(attrib(SM[2],"isIsolatedSingularity")==1)   
     880   else
    869881   {
    870882     if(size(#)==0)
    871883     {
    872         if(defined(JM)==voice)
    873         {  JM=maxideal(1),maxideal(1);
    874         }
    875         else
    876         {  list JM=maxideal(1),maxideal(1);
    877        
    878         }
     884        list JM=maxideal(1),maxideal(1);
     885
    879886        attrib(JM[1],"isSB",1);
     887        if(dim(SM[1])>=2){attrib(SM[2],"isRegInCodim2",1);}
    880888     }
    881889   }
    882 
    883 //------------ case: Cohen Macaulay and regular in codim 2 -----------------
    884 //in this case we are ready, the ring is normal 
    885890   if((attrib(SM[2],"isRegInCodim2")==1)&&(attrib(SM[2],"isCohenMacaulay")==1))
    886891   {
     
    900905      export normap;
    901906      result=newR6;
     907      result[size(result)+1]=delta;
    902908      setring BAS;
    903909      return(result);
    904910   }
    905911
    906 //************* case 1: isolated singularity and homogeneous ****************
    907 
    908    // recall: SM = mstd(i), i = ideal to start with in normaliztion loop
    909    //         JM = mstd(#[1]), #[1]= ideal of singular locus of i
    910    //              #[1] is given after the first normalization loop
    911    //if SM is an isolated singularity and homogeneous, we know that this
    912    //persists in the following normalization loops and things are easier
    913    //since the radical of the singular locus is the maximal ideal
     912   //if it is an isolated singularity only at 0 things are easier
    914913   //JM ideal of singular locus, SM ideal of variety
    915 
    916    if(attrib(SM[2],"isIsolatedSingularity")==1)
    917    {
    918       if(y>=1)
    919       {
    920          "// CASE 1: unique isolated singularity at 0";
    921          "// radial of singular locus is the maximal ideal";
    922       }
     914   if(attrib(SM[2],"onlySingularAtZero"))         
     915   {
     916      attrib(SM[2],"isIsolatedSingularity",1);
    923917      ideal SL=simplify(reduce(maxideal(1),SM[1]),2);
    924       //SL = vars not contained in ideal
     918      //vars not contained in ideal
    925919      ideal Ann=quotient(SM[2],SL[1]);
    926       ideal qAnn=simplify(reduce(Ann,SM[1]),2);     
     920      ideal qAnn=simplify(reduce(Ann,SM[1]),2);
    927921      //qAnn=0 ==> the first var(=SL[1]) not contained in SM is a nzd of R/SM
    928   //--------------- case: a nonzero-divisor was found ---------------
    929922      if(size(qAnn)==0)
    930923      {
     
    932925         {
    933926            "";
    934             "//   a nonzero-divisor was found";
    935927            "//   the ideal rad(J):";
    936928            "";
    937929            maxideal(1);
    938930            newline;
    939             "// TEST for normality: R=Hom(J,J)?";
    940             "";
    941931         }
    942     //test for normality:
    943          //?spaeter: test for normality, Hom(I,R)==R?
     932         //again test for normality
     933         //Hom(I,R)=R
    944934         list RR;
    945          RR=SM[1],SM[2],maxideal(1),SL[1],count;
    946          //  ti=timer;
    947          RR=HomJJ(RR);
    948          //  timer-ti;
    949          if(RR[2]==0)
    950     //the ring is not normal, start a new normalization loop
     935         RR=SM[1],SM[2],maxideal(1),SL[1];
     936
     937         RR=HomJJ(RR,y);
     938         if(RR[2]==0)
    951939         {
    952940            def newR=RR[1];
    953941            setring newR;
    954942            map psi=BAS,endphi;
    955          //  ti=timer;
    956             list tluser=normalizationPrimes(endid,psi(ihp),count);
    957          //  timer-ti;
     943            list tluser=normalizationPrimes(endid,psi(ihp),delta+RR[3],an);
    958944            setring BAS;
    959945            return(tluser);
    960946         }
    961     //the ring is normal, prepare output and go home
    962947         MB=SM[2];
    963948         execute("ring newR7="+charstr(basering)+",("+varstr(basering)+"),("
     
    965950         ideal norid=fetch(BAS,MB);
    966951         ideal normap=fetch(BAS,ihp);
     952         delta=delta+RR[3];
    967953         export norid;
    968954         export normap;
    969955         result=newR7;
     956         result[size(result)+1]=delta;
    970957         setring BAS;
    971958         return(result);
    972959
    973960       }
    974   //--------------- case: a zero-divisor was found ---------------
    975       //Now the case where qAnn!=0, i.e.SL[1] is a zero-divisor of R/SM
     961      //Now the case where qAnn!=0, i.e.SL[1] is a zero divisor of R/SM
    976962      //and we have found a splitting: id and id1
    977       //id=qAnn+SM[2] defines components of R/SM in the complement of V(SL[1])
     963      //id=Ann defines components of R/SM in the complement of V(SL[1])
    978964      //id1 defines components of R/SM in the complement of V(id)
    979       //?????instead of id1 we can take SL[1]+Ann+SM[2]???????????
    980965       else
    981966       {
    982          if(y>=0)
    983          {
    984             "//   a zero-divisor was found, we have SPLITTING of ideals";
    985            if(y >=2 )
    986            {
    987              "// in ring:";
    988              show(basering);
    989             }
    990             "";
    991          }
    992          
    993           ideal id=qAnn+SM[2];
    994 
     967          ideal id=Ann;
    995968          attrib(id,"isCohenMacaulay",0);
    996969          attrib(id,"isPrim",0);
     
    999972          attrib(id,"isCompleteIntersection",0);
    1000973          attrib(id,"isEquidimensional",0);
    1001 
    1002           if(y>=0)
    1003           {
    1004     "//   start a normalization loop with 1st split ideal (size",size(id),"in",nvars(basering),"vars)";
    1005           }
    1006           keepresult1=normalizationPrimes(id,ihp,count);
    1007           ideal id1=quotient(SM[2],Ann)+SM[2];
    1008 //          evtl. qAnn statt Ann nehmen
    1009 //          ideal id=SL[1]+SM[2];
    1010 
     974          attrib(id,"onlySingularAtZero",1);
     975
     976          ideal id1=quotient(SM[2],Ann);
     977          //ideal id=SL[1],SM[2];
    1011978          attrib(id1,"isCohenMacaulay",0);
    1012979          attrib(id1,"isPrim",0);
     
    1015982          attrib(id1,"isCompleteIntersection",0);
    1016983          attrib(id1,"isEquidimensional",0);
    1017 
    1018           if(y>=0)
    1019           {
    1020               "//   start a normalization loop with 2nd split ideal (size",size(id),"in",nvars(basering),"vars)";
    1021           }
    1022           keepresult2=normalizationPrimes(id1,ihp,count);
    1023 
    1024           for(lauf=1;lauf<=size(keepresult2);lauf++)
     984          attrib(id1,"onlySingularAtZero",1);
     985         
     986          ideal t1=id,id1;
     987          int mul=vdim(std(t1));
     988          kill t1;
     989
     990          keepresult1=normalizationPrimes(id,ihp,0);
     991
     992          keepresult2=normalizationPrimes(id1,ihp,0);
     993           
     994          delta=delta+mul+keepresult1[size(keepresult1)]
     995                         +keepresult1[size(keepresult1)];
     996
     997          for(lauf=1;lauf<=size(keepresult2)-1;lauf++)
    1025998          {
    1026999             keepresult1=insert(keepresult1,keepresult2[lauf]);
    10271000          }
     1001          keepresult1[size(keepresult1)]=delta;
    10281002          return(keepresult1);
    10291003       }
    10301004   }
    10311005
    1032 //********** case 2: no unique isolated singularity at 0 *************
    1033 
    1034    //in this case the radical must be computed
    1035    // recall: SM = mstd(i), i = ideal to start with in normaliztion loop
    1036    //         JM = mstd(#[1]), #[1]= ideal of singular locus of i
    1037    //              #[1] is given after the first normalization loop
    1038    //test for normality:  Hom(J,J)=R
    1039    //test for non-normality: Hom(J,J)!=R, we can use Hom(J,J) to continue
    1040 
    1041       if(y>=1)
    1042       {
    1043          "// CASE 2: no unique isolated singularity";
    1044          "// radical has to be computed";
    1045       }
    1046 
     1006   //test for non-normality
     1007   //Hom(I,I)<>R
     1008   //we can use Hom(I,I) to continue
    10471009   ideal SL=simplify(reduce(JM[2],SM[1]),2);
    1048    //SL = elements of ideal of singular locus not contained in ideal i
    10491010   ideal Ann=quotient(SM[2],SL[1]);
    10501011   ideal qAnn=simplify(reduce(Ann,SM[1]),2);
    1051    //qAnn=0 ==> SL[1] is a nonzero-divisor of R/SM
    1052 
    1053   //--------------- case: a nonzero-divisor was found ---------------
     1012
    10541013   if(size(qAnn)==0)
    10551014   {
    10561015      list RR;
    10571016      list RS;
    1058     //now we have to compute the radical
     1017      //now we have to compute the radical
    10591018      if(y>=1)
    10601019      {
     1020         "// radical computation of singular locus";
     1021      }
     1022
     1023      J=radical(JM[2]);   //the singular locus
     1024      JM=mstd(J);
     1025     
     1026      if((vdim(JM[1])==1)&&(size(reduce(J,std(maxideal(1))))==0))
     1027      {
     1028         attrib(SM[2],"onlySingularAtZero",1);
     1029      }
     1030      if(y>=1)
     1031      {
     1032        "//   radical is equal to:";"";
     1033        J;
    10611034        "";
    1062          "//   a nonzero-divisor was found";
    1063          "//   radical computation of ideal of singular locus";
    1064       }
    1065      
    1066     //-------------- computation of the radical J --------------------
    1067     //We have at least two possibilities:
    1068     //J=radical(JM[2]), the radical of the full singular locus, or
    1069     //J=radical(SM[2]+ideal(SL[1])), JM[2] contains SM[2]+ideal(SL[1])
    1070       //the first is usually better!
    1071 
    1072       if(y>=1)
    1073       {
    1074         "// compute radical J of ideal of singular locus";"";
    1075       }
    1076 
    1077       J=radical(JM[2]);
    1078       // alternativ:   J=radical(SM[2]+ideal(SL[1]));
    1079 
    1080       if(y>=2)
    1081       {
    1082           "// the radical is equal to:";       
    1083           J;
    1084           newline;
    1085       }
    1086       if(y>=1)
    1087       {       
    1088         "// TEST for normality: R=Hom(J,J)?";
    1089         "";
    1090       }
    1091 
    1092       JM=J,J;              //J = new ideal for singular locus
     1035      }
     1036
     1037      if(deg(SL[1])>deg(J[1]))
     1038      {
     1039         Ann=quotient(SM[2],J[1]);
     1040         qAnn=simplify(reduce(Ann,SM[1]),2);
     1041         if(size(qAnn)==0){SL[1]=J[1];}
     1042      }
     1043
    10931044      //evtl. fuer SL[1] anderen Nichtnullteiler aus J waehlen
    1094 
    1095     //test for normality:
    1096       RR=SM[1],SM[2],JM[2],SL[1],count;
    1097       RS=HomJJ(RR);
    1098      
    1099     //--- the ring is normal, prepare output and go home
     1045      RR=SM[1],SM[2],JM[2],SL[1];
     1046
     1047      //   evtl eine geeignete Potenz von JM?
     1048     if(y>=1)
     1049     {
     1050        "// compute Hom(rad(J),rad(J))";
     1051     }
     1052
     1053     RS=HomJJ(RR,y);
     1054
    11001055      if(RS[2]==1)
    11011056      {
     
    11081063         export norid;
    11091064         export normap;
     1065         result=lastR;
     1066         result[size(result)+1]=delta+RS[3];
    11101067         setring BAS;
    1111          return(lastR);
    1112       }
    1113 
    1114     //--- the ring is not normal, start a new normalization loop       
     1068         return(result);
     1069      }
    11151070      int n=nvars(basering);
    11161071      ideal MJ=JM[2];
     
    11211076      map psi=BAS,endphi;
    11221077      list tluser=
    1123            normalizationPrimes(endid,psi(ihp),count,simplify(psi(MJ)+endid,4));
     1078             normalizationPrimes(endid,psi(ihp),delta+RS[3],psi(MJ));
    11241079      setring BAS;
    11251080      return(tluser);
    11261081   }
    1127   //--------------- case: a zero-divisor was found ---------------
    1128   //Now the case where qAnn!=0, i.e.SL[1] is a zero-divisor of R/SM
    1129   //and we have found a splitting: id and id1
    1130   //id=qAnn+SM[2] defines components of R/SM in the complement of V(SL[1])
    1131   //id1 defines components of R/SM in the complement of V(id)
    1132       //?????instead of id1 we can take SL[1]+Ann+SM[2]???????????
    1133 
    1134    // A component with singular locus the whole component found:
     1082    // A component with singular locus the whole component found
    11351083   if( Ann == 1)
    11361084   {
     
    11511099         export normap;
    11521100         result=newR6;
     1101         result[size(result)+1]=delta;
    11531102         setring BAS;
    11541103         return(result);
    11551104   }
    1156    // The general case with splitting of ring, i.e. qAnn!=0
    11571105   else
    11581106   {
    11591107      int equi=attrib(SM[2],"isEquidimensional");
    1160       ideal new1=qAnn+SM[2];
     1108      int oSAZ=attrib(SM[2],"onlySingularAtZero");
     1109      int isIs=attrib(SM[2],"isIsolatedSingularity");
     1110
     1111      ideal new1=Ann;
     1112      ideal new2=quotient(SM[2],Ann);
     1113      //ideal new2=SL[1],SM[2];
     1114
     1115      int mul;
     1116      if(equi&&isIs)
     1117      {
     1118          ideal t2=new1,new2;
     1119          mul=vdim(std(t2));
     1120      }
    11611121      execute("ring newR1="+charstr(basering)+",("+varstr(basering)+"),("
    11621122                      +ordstr(basering)+");");
    1163       if(y>=0)
    1164       {
    1165             "//   a zero-divisor was found, we have SPLITTING of ideals";
    1166             "";
     1123      if(y>=1)
     1124      {
     1125         "// zero-divisor found";
    11671126      }
    11681127      ideal vid=fetch(BAS,new1);
     
    11701129      attrib(vid,"isCohenMacaulay",0);
    11711130      attrib(vid,"isPrim",0);
    1172       attrib(vid,"isIsolatedSingularity",0);
     1131      attrib(vid,"isIsolatedSingularity",isIs);
    11731132      attrib(vid,"isRegInCodim2",0);
    1174       if(equi==1)
    1175       {
    1176          attrib(vid,"isEquidimensional",1);
    1177       }
    1178       else
    1179       {
    1180          attrib(vid,"isEquidimensional",0);
    1181       }
     1133      attrib(vid,"onlySingularAtZero",oSAZ);
     1134      attrib(vid,"isEquidimensional",equi);     
    11821135      attrib(vid,"isCompleteIntersection",0);
    11831136
    1184       if(y>=0)
    1185       {
    1186             "// start a normalization loop with 1st split ideal (size",size(vid),"in",nvars(basering),"vars)";
    1187       }
    1188 
    1189       keepresult1=normalizationPrimes(vid,ihp,count);
    1190 
     1137      keepresult1=normalizationPrimes(vid,ihp,0);
     1138      int delta1=keepresult1[size(keepresult1)];
    11911139      setring BAS;
    1192       ideal new2=quotient(SM[2],Ann)+SM[2];
    1193 // evtl. qAnn nehmen
     1140
    11941141      execute("ring newR2="+charstr(basering)+",("+varstr(basering)+"),("
    11951142                      +ordstr(basering)+");");
     
    11991146      attrib(vid,"isCohenMacaulay",0);
    12001147      attrib(vid,"isPrim",0);
    1201       attrib(vid,"isIsolatedSingularity",0);
     1148      attrib(vid,"isIsolatedSingularity",isIs);
    12021149      attrib(vid,"isRegInCodim2",0);
    1203       if(equi==1)
    1204       {
    1205          attrib(vid,"isEquidimensional",1);
    1206       }
    1207       else
    1208       {
    1209          attrib(vid,"isEquidimensional",0);
    1210       }
     1150      attrib(vid,"isEquidimensional",equi);     
    12111151      attrib(vid,"isCompleteIntersection",0);
    1212 
    1213       if(y>=0)
    1214       {
    1215             "// start a normalization loop with 2nd split ideal (size",size(vid),"in",nvars(basering),"vars)";
    1216       }
    1217 
    1218       keepresult2=normalizationPrimes(vid,ihp,count);
     1152      attrib(vid,"onlySingularAtZero",oSAZ);
     1153
     1154      keepresult2=normalizationPrimes(vid,ihp,0);
     1155      int delta2=keepresult2[size(keepresult2)];
    12191156
    12201157      setring BAS;
    1221       for(lauf=1;lauf<=size(keepresult2);lauf++)
     1158     
     1159      for(lauf=1;lauf<=size(keepresult2)-1;lauf++)
    12221160      {
    12231161         keepresult1=insert(keepresult1,keepresult2[lauf]);
    12241162      }
     1163      keepresult1[size(keepresult1)]=delta+mul+delta1+delta2;
    12251164      return(keepresult1);
    12261165   }
     
    12401179   b6c+bc6+a2b4e-3ab2c2de+c4d2e-a3cde2-abd3e2+bce5;
    12411180
    1242    list pr=normalizationPrimes(i,maxideal(1),1);
     1181   list pr=normalizationPrimes(i);
    12431182   def r1=pr[1];
    12441183   setring r1;
     
    12571196   int ii,jj;
    12581197   map phi = basering,maxideal(1);
    1259 
    1260    //endid=diagon(endid);
    12611198
    12621199   list Le = elimpart(endid);
     
    13341271   return(L);
    13351272}
    1336 ///////////////////////////////////////////////////////////////////////////////
    1337 static
    1338 proc diagon(ideal i)
     1273/////////////////////////////////////////////////////////////////////////////
     1274
     1275proc genus(ideal K,list #)
     1276"USAGE:   genus(I) or genus(i,1); I a 1-dimensional ideal
     1277RETURN:  an integer, the geometric genus p_g = p_a - delta of the projective
     1278         curve defined by I, where p_a is the arithmetic genus.
     1279NOTE:    delta is the sum of all local delta-invariants of the singularities,
     1280         i.e. dim(R'/R), R' the normalization of the local ring R of the
     1281         singularity.
     1282         genus(i,1) uses the normalization to compute delta. Usually this
     1283         is slow but sometimes not.
     1284EXAMPLE: example genus; shows an example
     1285"
    13391286{
    1340    matrix m;
    1341    intvec iv = option(get);
    1342    option(redSB);
    1343    ideal j=liftstd(jet(i,1),m);
    1344    option(set,iv);
    1345    return(ideal(matrix(i)*m));
     1287   int w = printlevel-voice+2;  // w=printlevel (default: w=0)
     1288
     1289   def R=basering;
     1290   K=std(K);
     1291 
     1292   if(nvars(R)==3)
     1293   {
     1294      if((dim(K)!=2)||(!homog(K))||(size(K)>1)){ERROR("Input is not a curve");}
     1295      execute("ring newR=("+charstr(R)+"),(x,y),dp;"); 
     1296      map kappa=R,x,y,1;
     1297      ideal K=kappa(K); 
     1298   }
     1299   if((nvars(R)>3)||(size(K)>1))
     1300   {  // hier geeignet projezieren
     1301      ERROR("This case is not implemented yet");
     1302   }
     1303   if(nvars(R)==2)
     1304   {
     1305      execute("ring newR=("+charstr(R)+"),(x,y),dp;"); 
     1306      map kappa=R,x,y;
     1307      ideal K=kappa(K); 
     1308   }
     1309   
     1310   // assume now that R is a ring with two variables 
     1311   poly p=K[1];   
     1312   ideal I;
     1313   if(homog(p))
     1314   {
     1315      if(deg(squarefree(p))<deg(p)){ERROR("Curve is not reduced");}
     1316      return(-deg(p)+1);
     1317   }
     1318   execute("ring S=("+charstr(R)+"),(x,y,t),dp;");
     1319   execute("ring C=("+charstr(R)+"),(x,y),ds;");
     1320   ideal I;
     1321   execute("ring A=("+charstr(R)+"),(x,t),dp;");
     1322   map phi=S,1,x,t;
     1323   map psi=S,x,1,t;
     1324   poly g,h;
     1325   ideal I,I1;
     1326   execute("ring B=("+charstr(R)+"),(x,t),ds;");
     1327   
     1328   setring S;
     1329   poly F=imap(newR,p);
     1330   F=homog(F,t);
     1331   int d=deg(F);
     1332   int genus=(d-1)*(d-2)/2;
     1333   
     1334//   if(w>=1){"test for smoothness";}
     1335//   if(dim(std(jacob(F)))==0)  //the smooth case
     1336//   {
     1337//      setring R;
     1338//      return(genus);
     1339//   }
     1340 
     1341   int delta,deltaloc,deltainf,tau,tauinf,cusps,iloc,iglob,
     1342       tauloc,tausing,k,rat,nbranchinf,nbranch,nodes;
     1343   list inv;
     1344
     1345   if(w>=1){"singularities at oo";}
     1346   setring A;       
     1347   g=phi(F);
     1348   h=psi(F);
     1349   I=g,jacob(g),var(2);
     1350   I=std(I);
     1351   if(deg(I[1])>0)
     1352   {
     1353      list qr=minAssGTZ(I);
     1354      for(k=1;k<=size(qr);k++)
     1355      {
     1356         inv=deltaLoc(g,qr[k]);
     1357         deltainf=deltainf+inv[1];
     1358         tauinf=tauinf+inv[2];
     1359         nbranchinf=nbranchinf+inv[3];
     1360      }
     1361   }
     1362   inv=deltaLoc(h,maxideal(1));
     1363   deltainf=deltainf+inv[1];
     1364   tauinf=tauinf+inv[2];
     1365   if(inv[2]>0){nbranchinf=nbranchinf+inv[3];}
     1366 
     1367   if(w>=1)
     1368   {
     1369      "branches at oo:";nbranchinf;
     1370      "tau at oo:";tauinf;
     1371      "delta at oo:";deltainf;
     1372      "singularities not at oo";
     1373   }
     1374                         
     1375   setring newR;         //the singularities at the affine part
     1376   map sigma=S,var(1),var(2),1;
     1377   I=sigma(F);
     1378
     1379   if((size(#)!=0)||((char(basering)<181)&&(char(basering)!=0)))     
     1380   {                              //uses the normalization to compute delta
     1381      list nor=normal(I,"wd");
     1382      delta=nor[size(nor)];
     1383      genus=genus-delta-deltainf;
     1384      setring R;
     1385      return(genus);
     1386   }
     1387
     1388   ideal I1=jacob(I);
     1389   matrix Hess[2][2]=jacob(I1);
     1390   ideal ID=I+I1+ideal(det(Hess));
     1391
     1392   if(w>=1){"the cusps and nodes";}
     1393   
     1394   ideal radID=std(radical(ID));
     1395   ideal IDsing=minor(jacob(ID),2)+radID;
     1396   iglob=vdim(std(IDsing));
     1397
     1398   if(iglob!=0)
     1399   {
     1400      ideal radIDsing=reduce(IDsing,radID);
     1401      if(size(radIDsing)==0)
     1402      {
     1403         radIDsing=radID;
     1404         attrib(radIDsing,"isSB",1);
     1405      }
     1406      else
     1407      {
     1408         radIDsing=std(radical(IDsing));
     1409      }
     1410      iglob=vdim(radIDsing);
     1411   }
     1412   cusps=vdim(radID)-iglob;
     1413       
     1414   if(w>=1){"the other singularities";}
     1415 
     1416   if(iglob==0)   //only cusps and double points
     1417   {
     1418      tau=vdim(std(I+jacob(I)));
     1419      nodes=tau-2*cusps;
     1420      delta=nodes+cusps;
     1421      nbranch=2*tau-3*cusps;   
     1422   }
     1423   else
     1424   {
     1425       setring C;                     
     1426       ideal I1=imap(newR,IDsing);
     1427       iloc=vdim(std(I1));
     1428       if(iglob==iloc)  // only cusps and nodes outside 0
     1429       { 
     1430          I=imap(newR,I);
     1431          tauloc=vdim(std(I+jacob(I)));
     1432          setring newR;
     1433          inv=deltaLoc(I[1],maxideal(1));
     1434          delta=inv[1];
     1435          tau=inv[2];
     1436          nodes=tau-tauloc-2*cusps;
     1437          nbranch=inv[3]+ 2*nodes+cusps;         
     1438          delta=delta+nodes+cusps;
     1439        }
     1440        else
     1441        {
     1442           setring newR;
     1443           list pr=minAssGTZ(IDsing);                   
     1444           for(k=1;k<=size(pr);k++)
     1445           {
     1446              inv=deltaLoc(I[1],pr[k]);
     1447              delta=delta+inv[1];
     1448              tausing=tausing+inv[2];
     1449              nbranch=nbranch+inv[3];
     1450           }
     1451           nodes=tau-tauloc-2*cusps;
     1452           tau=vdim(std(I+jacob(I)));
     1453           delta=delta+nodes+cusps; 
     1454           nbranch=nbranch+2*nodes+cusps;           
     1455        }
     1456   }
     1457
     1458   if(w>=1)
     1459   {
     1460      "branches :";nbranch;
     1461      "nodes:"; nodes;
     1462      "cusps:";cusps;
     1463      "tau :";tau;
     1464      "delta:";delta;
     1465   }
     1466   genus=genus-delta-deltainf;
     1467   setring R;
     1468   return(genus);
    13461469}
    1347 /////////////////////////////////////////////////////////////////////////////
     1470example
     1471{ "EXAMPLE:"; echo = 2;
     1472   ring r=0,(x,y),dp;
     1473   ideal i=y^9 - x^2*(x - 1)^9;
     1474   genus(i);
     1475}
     1476///////////////////////////////////////////////////////////////////////////
     1477proc deltaLoc(poly f,ideal singL)
     1478{
     1479   def R=basering;
     1480   execute("ring S=("+charstr(R)+"),(x,y),lp;");
     1481   map phi=R,x,y;
     1482   ideal singL=phi(singL);
     1483   singL=std(singL);
     1484   int d=vdim(singL);
     1485   poly f=phi(f);
     1486   int i;
     1487
     1488   if(d==1)
     1489   {
     1490      map alpha=S,var(1)-singL[2][2],var(2)-singL[1][2];
     1491      f=alpha(f);
     1492      execute("ring C=("+charstr(S)+"),("+varstr(S)+"),ds;");
     1493      poly f=imap(S,f);
     1494   }
     1495   else
     1496   {
     1497      poly p;
     1498      poly c;
     1499      map psi;
     1500      while((deg(singL[1])>1)&&(deg(singL[2])>1))
     1501      {
     1502         psi=S,x,y+random(-100,100)*x;
     1503         singL=psi(singL);
     1504         singL=std(singL);
     1505      }
     1506      if(deg(singL[2])==1){p=singL[1];c=singL[2][2];}
     1507      if(deg(singL[1])==1)
     1508      {
     1509         psi=S,y,x;
     1510         f=psi(f);
     1511         singL=psi(singL);
     1512         p=singL[2];
     1513         c=singL[1][2];
     1514      }
     1515      execute("ring B=("+charstr(S)+"),a,dp;");
     1516      map beta=S,a,a;
     1517      poly p=beta(p);
     1518      execute("ring C=("+charstr(S)+",a),("+varstr(S)+"),ds;");
     1519      number p=number(imap(B,p));
     1520      minpoly=p;
     1521      number c=number(imap(S,c));
     1522      map alpha=S,x-c,y+a;
     1523     
     1524      poly f=alpha(f);
     1525      f=cleardenom(f);
     1526   }
     1527   ideal fstd=std(ideal(f)+jacob(f));
     1528   poly hc=highcorner(fstd);
     1529   int tau=vdim(fstd);     
     1530   int o=ord(f);
     1531   int delta,nb;
     1532
     1533   if(tau==0)                 //smooth case
     1534   {
     1535      setring R;
     1536      return(list(0,0,1));
     1537   }
     1538   if((char(basering)>=181)||(char(basering)==0))
     1539   {
     1540      if(o==2)                //A_k-singularity
     1541      {
     1542         setring R;
     1543         delta=(tau+1)/2;
     1544         return(list(d*delta,d*tau,d*(2*delta-tau+1)));   
     1545      }
     1546      if((lead(f)==var(1)*var(2)^2)||(lead(f)==var(1)^2*var(2)))
     1547      {//D_k- singularity
     1548         setring R;
     1549         delta=(tau+2)/2;
     1550         return(list(d*delta,d*tau,d*(2*delta-tau+1)));
     1551      }
     1552
     1553      int mu=vdim(std(jacob(f)));
     1554      poly g=f+var(1)^mu+var(2)^mu;  //to obtain a convinient Newton-polygon
     1555 
     1556      list NP=newton(g);
     1557      int s=size(NP);
     1558      int nN=-NP[1][2]-NP[s][1]+1;  // computation of the Newton-number
     1559      intmat m[2][2];
     1560      for(i=1;i<=s-1;i++)
     1561      {
     1562         m=NP[i+1],NP[i];
     1563         nN=nN+det(m);
     1564      }
     1565
     1566      if(mu==nN)                   // the Newton-polygon is non-degenerate
     1567      {                            // compute nb, the number of branches
     1568        for(i=1;i<=s-1;i++)
     1569        {
     1570          nb=nb+gcd(NP[i][2]-NP[i+1][2],NP[i][1]-NP[i+1][1]);
     1571        }
     1572        return(list(d*(mu+nb-1)/2,d*tau,d*nb));
     1573      }
     1574
     1575   //da reddevelop nur benutzt wird, um die Anzahl der Zweige zu bestimmen
     1576   //kann man das sicher schneller machen:
     1577   //die Aufblasung durchfuehren und stets testen, ob das Newton-polyeder
     1578   //nicht ausgeartet ist.
     1579
     1580      if(s>2)    //  splitting of f
     1581      {
     1582         intvec v=NP[1][2]-NP[2][2],NP[2][1];
     1583         int de=w_deg(g,v);
     1584         int st=w_deg(hc,v)+v[1]+v[2];
     1585         poly f1=var(2)^NP[2][2];
     1586         poly f2=jet(g,de,v)/var(2)^NP[2][2];
     1587         poly h=g-f1*f2;
     1588         de=w_deg(h,v);
     1589         poly k;
     1590         ideal wi=var(2)^NP[2][2],f2;
     1591         matrix li;
     1592         while(de<st)
     1593         {
     1594           k=jet(h,de,v);
     1595           li=lift(wi,k);
     1596           f1=f1+li[2,1];
     1597           f2=f2+li[1,1];
     1598           h=g-f1*f2;
     1599           de=w_deg(h,v);
     1600         }
     1601         nb=deltaLoc(f1,maxideal(1))[3]+deltaLoc(f2,maxideal(1))[3];
     1602         return(list(d*(mu+nb-1)/2,d*tau,d*nb));
     1603      }
     1604
     1605      f=jet(f,deg(hc)+2);
     1606      list hne=reddevelop(f);
     1607      nb=size(hne);
     1608      setring R;
     1609      kill HNEring;       
     1610      return(list(d*(mu+nb-1)/2,d*tau,d*nb));
     1611   }
     1612   else             //the case of small characteristic
     1613   {
     1614      f=jet(f,deg(hc)+2);
     1615      list hne=reddevelop(f);
     1616      nb=size(hne);
     1617      if(nb==1)
     1618      {
     1619         delta=invariants(hne[1])[5]/2;
     1620         setring R;
     1621         kill HNEring;
     1622         return(list(d*delta,d*tau,d));
     1623      }
     1624      setring R;
     1625      kill HNEring;
     1626      //delta direkt aus reddevelop zurueckgeben
     1627      ERROR("the case of small characteristic is not fully implemented yet");
     1628   }
     1629}
     1630
     1631proc w_deg(poly p, intvec v)
     1632{
     1633   if(p==0){return(-1);}
     1634   int d=0;
     1635   while(jet(p,d,v)==0){d++;}
     1636   d=(transpose(leadexp(jet(p,d,v)))*v)[1];
     1637   return(d); 
     1638}
     1639
     1640proc newton (poly f)
     1641{
     1642   def R1=basering;
     1643   execute("ring R2=("+charstr(R1)+"),("+varstr(R1)+"),ls;");
     1644   poly f=imap(R1,f);
     1645   intvec A=(0,ord(subst(f,var(1),0)));
     1646   intvec B=(ord(subst(f,var(2),0)),0);
     1647   intvec C,H; list L;
     1648   int abbruch,i;
     1649   poly hilf;
     1650   L[1]=A;
     1651   f=jet(f,A[2]*B[1]-1,intvec(A[2],B[1]));
     1652   map xytausch=R2,var(2),var(1);
     1653   for (i=2; f!=0; i++)
     1654   {
     1655      abbruch=0;
     1656      while (abbruch==0)
     1657      {
     1658         C=leadexp(f);         
     1659         if(jet(f,A[2]*C[1]-A[1]*C[2]-1,intvec(A[2]-C[2],C[1]-A[1]))==0)
     1660         {
     1661            abbruch=1;
     1662         }       
     1663         else
     1664         {
     1665            f=jet(f,-C[1]-1,intvec(-1,0));
     1666         }
     1667     }
     1668     hilf=jet(f,A[2]*C[1]-A[1]*C[2],intvec(A[2]-C[2],C[1]-A[1]));
     1669     H=leadexp(xytausch(hilf));
     1670     A=H[2],H[1];
     1671     L[i]=A;
     1672     f=jet(f,A[2]*B[1]-1,intvec(A[2],B[1]-A[1]));
     1673   }
     1674   L[i]=B;
     1675   setring R1;
     1676   return(L);
     1677}
     1678
     1679///////////////////////////////////////////////////////////////////////////
     1680
    13481681/*
    1349 Aenderungen:
    1350 1. normal kommentiert, bei Berechnung de singulaeren Ortes ein simplify(J,16)
    1351 eingefuehrt, um bei riesigen Minorenzahlen, das Ideal zu verkleinern (bis
    1352 Faktor 10 Beschleunigung).
    1353 Protokoll mit printlevel so gesteuert, dass es bei rekursivem Aufruf korrekt
    1354 arbeitet.
    1355 list nor = normal(i);     //mit equidim Zerlegung
    1356 list nor = normal(i,1);   //mit prim Zerlegung
    1357 Zeiten au sony_pumuckel (P2, 500)
    13581682                           Examples:
    13591683LIB"normal.lib";
    1360 //1. Huneke, 1 Komponente
    1361 //prim: 2 sec equidim:1sec
     1684//Huneke
    13621685ring qr=31991,(a,b,c,d,e),dp;
    13631686ideal i=
     
    13721695
    13731696
    1374 //2. Vasconcelos (dauert laenger: 83 sec auf sony_pumuckel)
     1697//Vasconcelos (dauert laenger: 70 sec)
    13751698ring r=32003,(x,y,z,w,t),dp;
    13761699ideal i=
     
    13791702xw3+z3t+ywt2,
    13801703y2w4-xy2z2t-w3t3;
    1381 
    1382 //2a. Vasconcelos verkleinert
    1383 //prim:2Komp, 2 Ringe, 16 sec (manchmal lange, haengt am Faktorisierer)
    1384 //equidim: 1 Komp, 7 loops, 2 ringe, 12sec
    1385 ring r=32003,(x,y,z,w,t),dp;
    1386 ideal i=
    1387 x+zw,
    1388 y3+xwt,
    1389 xw3+z3t+ywt2;
    1390 
    1391 //3. GM1
    1392 // irreducible, 13 normalization loops, 1 Ring
    1393 //2sec mit prim, 1 sec mit equidim
    1394 ring r=32003,(x,y,z,u),dp;
    1395 ideal i = x2+y3,z2+u3,y2+z3;
    1396 
    1397 //3a. GM1
    1398 ring r=32003,(x,y),dp;
    1399 ideal i = intersect(y3+x2,y2+x3);  // beide 0 sec
    1400 ideal i = intersect(y3+x2,y2+x3,y2+x2+x3);
    1401 //prim 0sec,
    1402 //equidim sehr lange (Relationen in HomJJ zu gross)
    1403 
    1404 //4. GM2
    1405 //i nicht reduziert, equidim bricht ab (0 sec)
    1406 //prim: 11 irred comp, 11 loops, (1sec)
    1407 ring r=32003,(x,y,z,u),dp;
    1408 ideal i = x2+y3,z2+u3,y2+z3,x2+z3;
    1409 
    1410 //5. GM3,  radical von GM2
    1411 //prim: 11 irred comp, 11 loops, 11 Ringe, (1sec)
    1412 //equidim: 1 equidim comp, 1 loop, 1 Ring, (0sec)
    1413 ring r=32003,(x,y,z,u),dp;
    1414 ideal i =yu+u,yz+z,y2+y,xy+x,x2+y,u3+z2,z3-y;
    1415 
    1416 //GM4
    1417 //equidim: 2 equidim comp, 3 Ringe, (0sec);
    1418 //prim: 3 Komp, (0sec)
    1419 ring r=32003,(x,y,z,u),dp;
    1420 ideal i1 = x2+y3,u,z;
    1421 ideal i2 = u2+z3,x,y;
    1422 ideal i3 = x2+y2+z2+u4;
    1423 ideal i = intersect(i1,i2,i3);
    1424 
    1425 //GM4a  Hier dauert prim laenger! (## facstd)
    1426 //equidim: 3 equidim Komp, 4 Ringe(0sec)
    1427 //prim 13 Komp (63 sec), wegen facstd
    1428 //##ev minAssGTZ(i,1) verwenden (ohne facstd, ist noch fehlerhaft)
    1429 ring r=32003,(x,y,z,u),dp;
    1430 ideal i1 = x2+y3,u,z;
    1431 ideal i2 = u2+z3,x,y;
    1432 ideal i3 = x2+y2+z2+u4;
    1433 ideal i4 =yu+u,yz+z,y2+y,xy+x,x2+y,u3+z2,z3-y;
    1434 ideal i = intersect(i1,i2,i3,i4);
    1435 
    1436 //GM5
    1437 //equidim: 4 Komp,0sec, prim 13 Komp, 1sec
    1438 ring r=32003,(x,y,z,u,v),dp;
    1439 ideal i1 = x2+y3,v;                            //2dim
    1440 ideal i2 = u2+z3,x,y;                          //3dim
    1441 ideal i3 = x2+y2+z2+u4;                        //4dim
    1442 ideal i4 =yu+u,yz+z,y2+y,xy+x,x2+y,u3+z2,z3-y; //1dim
    1443 ideal i = intersect(i1,i2,i3,i4);
    1444 
    1445 //cyclic 5
    1446 //equidim: 1 Komp 0sec, prim: 20 Komp, 3 sec
    1447 ring r=32003,(x,y,z,u,v),dp;
    1448 ideal i =
    1449 x+y+z+u+v,
    1450 xy+yz+zu+xv+uv,
    1451 xyz+yzu+xyv+xuv+zuv,
    1452 xyzu+xyzv+xyuv+xzuv+yzuv,
    1453 xyzuv-1;
    1454 
    1455 // cyclic 5 hat Normalisierung (1 embim weniger)
    1456 ///equidim: 1 Komp 0sec, prim: 20 Komp, 2 sec
    1457 ring r=32003,(x,y,z,u),dp;
    1458 ideal i =
    1459 x2+xz-yz+2xu+yu+u2,
    1460 xy2-xyz+y2z-y2u+xzu+yzu+z2u-xu2-2yu2+zu2-u3,
    1461 xyz2+xyzu+y2zu-xz2u+yz2u-z3u-xyu2-xzu2-2z2u2+xu3+yu3-zu3+u4,
    1462 2xyzu2+y2zu2+2yz2u2-xyu3-2xzu3-yzu3-z2u3+xu4+yu4-2zu4+u5-1;
    1463 
    1464 //cyclic(6)
    1465 //equidim: 1Komp in 5 vars 1sec
    1466 //prim: 90 (!) Ringe, 12 sec
    14671704
    14681705//Theo1
     
    15111748ad;
    15121749
    1513 //Sturmfels, wo vorher Prim schneller (2 sec,sonst 860 sec)
    15141750//ist CM
    1515 //prim: 15 loops, 15 Komp, 1 sec,
    1516 //equidim:15 Ringe, 93 sec mit simplify(J,16),
    1517 //ohne simlify(J,16) 860sec?,
    1518 //andere simplify sind z.T. viel langsamer
     1751//Sturmfels
    15191752ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
    15201753ideal i=
     
    15481781
    15491782//Horrocks:
    1550 //CHAR 32003:mit prim 1 sec, equidim: 115 sec, beide 6 Ringe
    1551 //           Singulaere Ort hat zu Beginn > 106 000 Erzeuger!!
    1552 //char 31991: prim 1sec, 8 Ringe, equidim: 25 Ringe(!), 162 sec,
    1553 //            nicht reduziert!
    1554 //            Singulaere Ort hat zu Beginn > 28 000 Erzeuger!!
    1555 //            i=radical(i) -> 8 Ringe, 1sec (radical <1 sec)
    1556 //Horrocks:
    1557 ring r=31991,(a,b,c,d,e,f),dp;
     1783ring r=32003,(a,b,c,d,e,f),dp;
    15581784ideal i=
    15591785adef-16000be2f+16001cef2,
     
    15921818
    15931819
    1594 ring r=32003,(b,s,t,u,v,w,x,y,z),dp;   //3sec
     1820ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
    15951821ideal k=
    15961822wy-vz,
     
    16021828ideal i=mstd(intersect(j,k))[2];
    16031829
    1604 //22,
    1605 // neu, prim: 3 sec, equidim 1 sec, je 4 Ringe
     1830
    16061831ring r=32003,(b,s,t,u,v,w,x,y,z),dp;
    16071832ideal i=
     
    16131838
    16141839
    1615 //riemenschneider, 5 Komponenten
    1616 //33(alte Zeiten), normal+primary 3, primary 9, radical 1, minAssGTZ; 2
    1617 //neu: prim 0sec, equi 1 sec, je 5 Ringe
     1840//riemenschneider 
    16181841ring r=32000,(p,q,s,t,u,v,w,x,y,z),wp(1,1,1,1,1,1,2,1,1,1);
    16191842ideal i=
     
    16311854
    16321855ring r=0,(u,v,w,x,y,z),wp(1,1,1,3,2,1);
    1633 ideal i=wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;   //0sec
     1856ideal i=wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;
     1857
     1858//Yoshihiko Sakai
     1859ring r=0,(x,y),dp;   //genus 0 4 nodes and 6 cusps   
     1860ideal i=(x2+y^2-1)^3 +27x2y2;
     1861
     1862ring r=0,(x,y),dp;   //genus 0
     1863ideal i=(x-y^2)^2 - y*x^3;
     1864
     1865ring r=0,(x,y),dp;  //genus 4
     1866ideal i=y3-x6+1;
     1867
     1868int m=9;           // q=9: genus 0
     1869int p=2;
     1870int q=9;//2,...,9
     1871ring r=0,(x,y),dp; 
     1872ideal i=y^m - x^p*(x - 1)^q;
     1873
     1874ring r=0,(x,y),dp;  //genus 19
     1875ideal i=55*x^8+66*y^2*x^9+837*x^2*y^6-75*y^4*x^2-70*y^6-97*y^7*x^2;
     1876
     1877
     1878ring r=0,(x,y),dp;  //genus 34
     1879ideal i=y10+(-2494x2+474)*y8+(84366+2042158x4-660492)*y6
     1880        +(128361096x4-47970216x2+6697080-761328152x6)*y4
     1881        +(-12024807786x4-506101284x2+15052058268x6+202172841-3212x8)*y2
     1882        +34263110700x4-228715574724x6+5431439286x2+201803238
     1883        -9127158539954x10-3212722859346x8;
     1884
     1885//Rob Koelman
     1886ring r=0,(x,y,z),dp;//genus 10  with 26 cusps
     1887ideal i=
     1888761328152*x^6*z^4-5431439286*x^2*y^8+2494*x^2*z^8+228715574724*x^6*y^4+
     1889 9127158539954*x^10-15052058268*x^6*y^2*z^2+3212722859346*x^8*y^2-
     1890 134266087241*x^8*z^2-202172841*y^8*z^2-34263110700*x^4*y^6-6697080*y^6*z^4-
     1891 2042158*x^4*z^6-201803238*y^10+12024807786*x^4*y^4*z^2-128361096*x^4*y^2*z^4+
     1892 506101284*x^2*z^2*y^6+47970216*x^2*z^4*y^4+660492*x^2*z^6*y^2-
     1893 z^10-474*z^8*y^2-84366*z^6*y^4;
     1894
     1895ring r=0,(x,y),dp;//genus 10  with 26 cusps
     1896ideal i=9127158539954x10+3212722859346x8y2+228715574724x6y4-34263110700x4y6
     1897-5431439286x2y8-201803238y10-134266087241x8-15052058268x6y2+12024807786x4y4
     1898+506101284x2y6-202172841y8+761328152x6-128361096x4y2+47970216x2y4-6697080y6
     1899-2042158x4+660492x2y2-84366y4+2494x2-474y2-1;
     1900
     1901
     1902ring r=0,(x,y),dp;   // genuss 1  with 5 cusps
     1903ideal i=57y5+516x4y-320x4+66y4-340x2y3+73y3+128x2-84x2y2-96x2y;;
     1904
     1905//Mark van Hoeij
     1906ring r=0,(x,y),dp;  //genus 19
     1907ideal i=y20+y13x+x4y5+x3*(x+1)^2;
     1908
     1909ring r=0,(x,y),dp;  //genus 35
     1910ideal i=y30+y13x+x4y5+x3*(x+1)^2;
     1911
     1912ring r=0,(x,y),dp;   //genus 55
     1913ideal i=y40+y13x+x4y5+x3*(x+1)^2;
     1914
     1915ring r=0,(x,y),dp;  //genus 55
     1916ideal i=((x2+y3)^2+xy6)*((x3+y2)^2+x10y);
     1917
    16341918*/
    16351919
  • Singular/LIB/ntsolve.lib

    r3de58c r50cbdc  
    11//(GMG, last modified 16.12.00)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: ntsolve.lib,v 1.12 2001-02-19 14:17:47 lossen Exp $";
     3version="$Id: ntsolve.lib,v 1.13 2001-08-27 14:47:56 Singular Exp $";
    44category="Symbolic-numerical solving";
    55info="
     
    2323 ipar[1]: max. number of iterations
    2424 ipar[2]: accuracy (we have the l_2-norm ||.||): accept solution @code{sol}
    25           if ||gls(sol)|| < eps0*(0.1^ipar[2]) 
     25          if ||gls(sol)|| < eps0*(0.1^ipar[2])
    2626          where eps0 = ||gls(ini)|| is the initial error
    2727  @end format
  • Singular/LIB/paramet.lib

    r3de58c r50cbdc  
    11// last change:           17.01.2001
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: paramet.lib,v 1.11 2001-02-19 14:17:47 lossen Exp $";
     3version="$Id: paramet.lib,v 1.12 2001-08-27 14:47:57 Singular Exp $";
    44category="Visualization";
    55info="
     
    88SEE ALSO: normal_lib, primdec_lib, hnoether_lib
    99
    10 PROCEDURES:           
    11  parametrize(I);       parametrizes a prime ideal via the normalization         
     10PROCEDURES:
     11 parametrize(I);       parametrizes a prime ideal via the normalization
    1212 parametrizepd(I);     calculates the prim.dec. and parametrizes the components
    1313 parametrizesing(f);   parametrizes an isolated plane curve singularity
     
    2626proc parametrize(ideal I)
    2727"USAGE:   parametrize(I); I ideal in an arbitrary number of variables,
    28           whose radical is prime, in a ring with global ordering 
     28          whose radical is prime, in a ring with global ordering
    2929CREATE:   If the parametrization is successful, the basering will be changed to
    30           the parametrization ring, that is to the ring PR=0,(s,t),dp; 
    31           respectively PR=0,t(1..d),dp;, depending on the dimension of the 
     30          the parametrization ring, that is to the ring PR=0,(s,t),dp;
     31          respectively PR=0,t(1..d),dp;, depending on the dimension of the
    3232          parametrized variety.
    3333RETURN:   a list containing the parametrization ideal resp. the original ideal,
     
    104104"USAGE:   parametrizepd(I); I ideal in a polynomial ring with global ordering
    105105CREATE:   If the parametrization is successful, the basering will be changed to
    106           the parametrization ring, that is to the ring PR=0,(s,t),dp; 
    107           respectively PR=0,t(1..d),dp;, depending on the dimension of the 
     106          the parametrization ring, that is to the ring PR=0,(s,t),dp;
     107          respectively PR=0,t(1..d),dp;, depending on the dimension of the
    108108          parametrized variety.
    109109RETURN:   a list of lists, where each entry contains the parametrization
     
    186186          the parametrization ring, that is to the ring  0,(x,y),ls;
    187187RETURN:   a list containing the parametrizations of the different branches of the
    188           singularity at the origin resp. 0, if f was not of the desired kind 
     188          singularity at the origin resp. 0, if f was not of the desired kind
    189189SEE ALSO: hnoether_lib, reddevelop
    190190KEYWORDS: parametrization; curve singularities
  • Singular/LIB/presolve.lib

    r3de58c r50cbdc  
    11//last change: 13.02.2001 (Eric Westenberger)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: presolve.lib,v 1.17 2001-02-19 14:17:48 lossen Exp $";
     3version="$Id: presolve.lib,v 1.18 2001-08-27 14:47:57 Singular Exp $";
    44category="Symbolic-numerical solving";
    55info="
     
    748748          s1: name of new ring,@*
    749749          s2: new ordering@*
    750           (default: s1=\"R(n)\" where n is the # of vars in the new ring, 
     750          (default: s1=\"R(n)\" where n is the # of vars in the new ring,
    751751          s2=\"dp\" or \"ds\" depending whether the first block of the old
    752752          ordering is a p- resp. an s-ordering)
    753          
     753
    754754CREATE:  nothing, if id contains all vars of the basering.@*
    755755         Else, create a ring with same char as the basering, but possibly less
     
    884884         but with new ordering and vars sorted in the following manner:
    885885  @format
    886   - each block of vars occuring in pi is sorted w.r.t. its complexity in id, 
     886  - each block of vars occuring in pi is sorted w.r.t. its complexity in id,
    887887  - ni controls the sorting in i-th block (= vars occuring in pi):
    888888    ni=0 (resp.!=0) means that less (resp. more) complex vars come first
     
    893893      in one block
    894894  @end format
    895   Note that only simple ordstrings oi are allowed: 
     895  Note that only simple ordstrings oi are allowed:
    896896  \"lp\",\"dp\",\"Dp\",\"ls\",\"ds\",\"Ds\".
    897897RETURN:  nothing
    898898NOTE:    We define a variable x to be more complex than y (with respect to id)
    899899         if val(x) > val(y) lexicographically, where val(x) denotes the
    900          valuation vector of x:@* 
     900         valuation vector of x:@*
    901901         consider id as list of polynomials in x with coefficients in the
    902902         remaining variables. Then:@*
     
    953953{ "EXAMPLE:"; echo = 2;
    954954   ring s = 32003,(x,y,z),dp;
    955    ideal i=x3+y2,xz+z2; 
     955   ideal i=x3+y2,xz+z2;
    956956   sortandmap(i,"R_r","i");
    957957   // i is now an ideal in the new basering R_r
     
    987987NOTE:    We define a variable x to be more complex than y (with respect to id)
    988988         if val(x) > val(y) lexicographically, where val(x) denotes the
    989          valuation vector of x:@* 
     989         valuation vector of x:@*
    990990         consider id as list of polynomials in x with coefficients in the
    991991         remaining variables. Then:@*
     
    10211021{ "EXAMPLE:"; echo = 2;
    10221022   ring s=0,(x,y,z,w),dp;
    1023    ideal i = x3+y2+yw2,xz+z2,xyz-w2; 
     1023   ideal i = x3+y2+yw2,xz+z2,xyz-w2;
    10241024   sortvars(i,0,xy,1,zw);
    10251025}
     
    10531053         We define a variable x to be more complex than y (with respect to id)
    10541054         if val(x) > val(y) lexicographically, where val(x) denotes the
    1055          valuation vector of x:@* 
     1055         valuation vector of x:@*
    10561056         consider id as list of polynomials in x with coefficients in the
    10571057         remaining variables. Then:@*
  • Singular/LIB/primdec.lib

    r3de58c r50cbdc  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: primdec.lib,v 1.99 2001-03-29 11:34:59 Singular Exp $";
     2version="$Id: primdec.lib,v 1.100 2001-08-27 14:47:58 Singular Exp $";
    33category="Commutative Algebra";
    44info="
     
    379379///////////////////////////////////////////////////////////////////////////////
    380380
    381 static proc idealsEqual( ideal k, ideal j)
     381proc idealsEqual( ideal k, ideal j)
    382382{
    383383   return(stdIdealsEqual(std(k),std(j)));
     
    426426
    427427
    428 static proc primaryTest (ideal i, poly p)
     428proc primaryTest (ideal i, poly p)
    429429{
    430430   int m=1;
     
    797797    for(i=1;i<=size(keep);i++)
    798798    {
    799        l[size(l)+1]=keep[i];
    800        l[size(l)+1]=primaryTest(keep[i],keep[i][1]);
     799       if(deg(keep[i][1])>0)
     800       {
     801          l[size(l)+1]=keep[i];
     802          l[size(l)+1]=primaryTest(keep[i],keep[i][1]);
     803       }
    801804    }
    802805  }
     
    952955     }
    953956  }
     957
    954958  if(size(#)==0)
    955959  {
     
    31563160RETURN:  ideal, the radical of i.
    31573161NOTE:    Uses the algorithm of Eisenbud/Huneke/Vasconcelos, which
    3158          reduces the computation to the complete intersection case, 
     3162         reduces the computation to the complete intersection case,
    31593163         by taking, in the general case, a generic linear combination
    31603164         of the input.
     
    31773181   intvec op=option(get);
    31783182   matrix M;
    3179    
     3183
    31803184   option(redSB);
    31813185   list m=mstd(i);
  • Singular/LIB/primitiv.lib

    r3de58c r50cbdc  
    33// This library is for Singular 1.2 or newer
    44
    5 version="$Id: primitiv.lib,v 1.15 2001-02-05 12:01:39 lossen Exp $";
     5version="$Id: primitiv.lib,v 1.16 2001-08-27 14:47:59 Singular Exp $";
    66category="Commutative Algebra";
    77info="
     
    2121"USAGE:   primitive(i); i ideal
    2222ASSUME:   i is given by generators m[1],...,m[n] such that for j=1,...,n @*
    23           -  m[j] is a polynomial in k[x(1),...,x(j)] @* 
    24           -  m[j](a[1],...,a[j-1],x(j)) is the minimal polynomial for a[j] over 
     23          -  m[j] is a polynomial in k[x(1),...,x(j)] @*
     24          -  m[j](a[1],...,a[j-1],x(j)) is the minimal polynomial for a[j] over
    2525             k(a[1],...,a[j-1]) @*
    2626          (k the ground field of the current basering and x(1),...,x(n)
    27           the ring variables). 
     27          the ring variables).
    2828RETURN:   ideal j in k[x(n)] with
    29           - j[1] a minimal polynomial for a primitive element b of     
     29          - j[1] a minimal polynomial for a primitive element b of
    3030                 k(a[1],...,a[n]) over k,
    31           - j[2],...,j[n+1] polynomials in k[x(n)] such that j[i+1](b)=a[i] 
     31          - j[2],...,j[n+1] polynomials in k[x(n)] such that j[i+1](b)=a[i]
    3232                 for i=1,...,n.
    33 NOTE:     the number of variables in the basering has to be exactly n, 
     33NOTE:     the number of variables in the basering has to be exactly n,
    3434          the number of given generators (i.e., minimal polynomials).@*
    35           If the ground field k has only a few elements it may happen that no 
    36           linear combination of a[1],...,a[n] is a primitive element. In this 
     35          If the ground field k has only a few elements it may happen that no
     36          linear combination of a[1],...,a[n] is a primitive element. In this
    3737          case @code{primitive(i)} returns the zero ideal, and one should use
    3838          @code{primitive_extra(i)} instead.
     
    134134 j[2];
    135135 j[3];
    136  // no element was primitive -- the calculation of primitive elements 
     136 // no element was primitive -- the calculation of primitive elements
    137137 // is based on a random choice.
    138138}
     
    142142"USAGE:   primitive_extra(i); i ideal
    143143ASSUME:  The ground field of the basering is k=Q or k=Z/pZ and the ideal
    144          i is given by 2 generators f,g with the following properties: 
     144         i is given by 2 generators f,g with the following properties:
    145145@format
    146    f is the minimal polynomial of a in k[x], 
     146   f is the minimal polynomial of a in k[x],
    147147   g is a polynomial in k[x,y] s.th. g(a,y) is the minpoly of b in k(a)[y].
    148148@end format
     
    154154   j[2] is a polynomial s.th. j[2](c)=a.
    155155@end format
    156 NOTE:    While @code{primitive(i)} may fail for finite fields, 
    157          @code{primitive_extra(i)} tries all elements of k(a,b) and, hence, 
     156NOTE:    While @code{primitive(i)} may fail for finite fields,
     157         @code{primitive_extra(i)} tries all elements of k(a,b) and, hence,
    158158         always finds a primitive element. @*
    159159         In order to do this (try all elements), field extensions like Z/pZ(a)
    160160         are not allowed for the ground field k. @*
    161          @code{primitive_extra(i)} assumes that the second generator, g, is 
     161         @code{primitive_extra(i)} assumes that the second generator, g, is
    162162         monic as polynomial in (k[x])[y].
    163163EXAMPLE: example primitive_extra;  shows an example
     
    254254
    255255proc splitring
    256 "USAGE:   splitring(f,R[,L]); f poly, R string, L list of polys and/or ideals 
     256"USAGE:   splitring(f,R[,L]); f poly, R string, L list of polys and/or ideals
    257257         (optional)
    258258ASSUME:  f is univariate and irreducible over the active basering. @*
    259          The active ring must allow an algebraic extension (e.g., it cannot 
     259         The active ring must allow an algebraic extension (e.g., it cannot
    260260         be a transcendent ring extension of Q or Z/p).
    261261CREATE:  a ring with name R, in which f is reducible, and CHANGE to it.
    262262RETURN:  list L mapped into the new ring R, if L is given; else nothing
    263263NOTE:    If the old ring has no parameter, the name @code{a} is chosen for the
    264          parameter of R (if @code{a} is no ring variable; if it is, @code{b} is 
    265          chosen, etc.; if @code{a,b,c,o} are ring variables, 
    266          @code{splitring(f,R[,L])} produces an error message), otherwise the 
    267          name of the parameter is kept and only the minimal polynomial is 
     264         parameter of R (if @code{a} is no ring variable; if it is, @code{b} is
     265         chosen, etc.; if @code{a,b,c,o} are ring variables,
     266         @code{splitring(f,R[,L])} produces an error message), otherwise the
     267         name of the parameter is kept and only the minimal polynomial is
    268268         changed. @*
    269269         The names of the ring variables and the orderings are not affected. @*
    270270         It is also allowed to call @code{splitring} with R=\"\".
    271          Then the old basering will be REPLACED by the new ring (with the 
     271         Then the old basering will be REPLACED by the new ring (with the
    272272         same name as the old ring).
    273273KEYWORDS: algebraic field extension; extension of rings
     
    400400 ring r=0,(x,y),dp;
    401401 splitring(x2-2,"r1");   // change to Q(sqrt(2))
    402  // change to Q(sqrt(2),sqrt(sqrt(2)))=Q(a) and return the transformed 
     402 // change to Q(sqrt(2),sqrt(sqrt(2)))=Q(a) and return the transformed
    403403 // old parameter:
    404  splitring(x2-a,"r2",a); 
     404 splitring(x2-a,"r2",a);
    405405 // the result is (a)^2 = (sqrt(sqrt(2)))^2
    406406 nameof(basering);
  • Singular/LIB/reesclos.lib

    r3de58c r50cbdc  
    1515
    1616PROCEDURES:
    17  ReesAlgebra(I);        computes the Rees Algebra of an ideal I
    18  normalI(I[,p[,r]]);    computes the integral closure of an ideal I using R[It]
     17 ReesAlgebra(I);        computes the Rees Algebra of an ideal I
     18 normalI(I[,p[,r]]);    computes the integral closure of an ideal I using R[It]
    1919";
    2020
    21 LIB "normal.lib";       // for HomJJ 
     21LIB "normal.lib";       // for HomJJ
    2222LIB "standard.lib";     // for groebner
    2323
     
    4444  ideal m = maxideal(1);
    4545
    46  
     46
    4747  // Create a new ring with variables for each generator of I
    4848
    4949  execute ("ring Rees = "+oldchar+",("+oldvar+",U(1.."+string(n)+")),dp");
    5050
    51  
     51
    5252  // Kxt is the old ring with additional variable t
    5353  // Here I -> t*I, so the generators of I generate the subalgebra R[It] in Kxt
     
    5959  for (k=1;k<=n;k++)
    6060  {
    61     I[k]=t*I[k]; 
    62   }
    63  
     61    I[k]=t*I[k];
     62  }
     63
    6464
    6565  // Now we map from Rees to Kxt, identity on the original variables, and
     
    7676  ideal ker = preimage(Kxt,phi,zero);
    7777  export (ker);
    78  
     78
    7979  list result = Rees,Kxt;
    80  
     80
    8181  return(result);
    82  
     82
    8383}
    8484example
     
    9393  ker;                   // R[It] is isomorphic to Rees/ker
    9494}
    95  
     95
    9696
    9797////////////////////////////////////////////////////////////////////////////
     
    9999static
    100100proc ClosureRees (list L)
    101 "USAGE:    ClosureRees (L); L a list 
     101"USAGE:    ClosureRees (L); L a list
    102102ASSUME:   L is a list containing
    103           - a ring L[1], inside L[1] an ideal ker such that L[1]/ker is 
     103          - a ring L[1], inside L[1] an ideal ker such that L[1]/ker is
    104104            isomorphic to the Rees Algebra R[It] of an ideal I in k[x]
    105105          - a ring L[2]=k[x,t], inside L[1] an ideal mapI defining the
    106106            map L[1] --> L[2] with image R[It]
    107107RETURN:   quotients of elements of k[x,t] representing generators of the
    108           integral closure of R[It]. The result of ClosureRees is a list 
     108          integral closure of R[It]. The result of ClosureRees is a list
    109109          images, the first size(images)-1 entries are the numerators of the
    110110          generators, the last one is the universal denominator
    111111"
    112112{
    113   int dblvl=printlevel-voice+2;   // toggles how much data is printed 
     113  int dblvl=printlevel-voice+2;   // toggles how much data is printed
    114114                                  // during the procedure
    115115
     
    134134  {
    135135    "// STEP 1: Compute the integral closure of R[It]";
    136   } 
     136  }
    137137
    138138  list RS;
     
    182182        list JM=groebner(sin),sin;
    183183      }
    184  
     184
    185185      J=radical(JM[2]);
    186186    }
     
    189189      ideal J=radical(JM[2]);
    190190    }
    191    
     191
    192192    if (dblvl>0)
    193193    {
     
    199199    JM =J,J;
    200200    poly nzd=SL[1];           // universal denominator for HomJJ
    201    
     201
    202202    if (dblvl>0)
    203203    {
     
    223223    {                         // ring R(i+1)
    224224      ideal MJ=JM[2];
    225  
    226       def R(i+1)=RS[1];       // the data of and some variable decla- 
     225
     226      def R(i+1)=RS[1];       // the data of and some variable decla-
    227227      setring R(i+1);         // rations in R(i+1) needed in STEP 2
    228228      ideal ker(i+1)=endid;
     
    253253  list preimages;          // here the fractions are stored in the
    254254                           // form var(j)=preimages[j]/preimages[length+1]
    255                            // ('=' means identification via the inclusion) 
     255                           // ('=' means identification via the inclusion)
    256256                           // the last entry corresponds to nzd in R(i)
    257257
     
    283283    for (k=i;k>1;k--)
    284284    {
    285       // clear the fraction in the representation in R(i)   
    286 
    287       p=p*phi(nzd);     
     285      // clear the fraction in the representation in R(i)
     286
     287      p=p*phi(nzd);
    288288
    289289      // compute the preimage of [p mod ker(k)] under phi in R(k-1):
     
    294294         // compute this normal form h...
    295295
    296       if (j==1)    // in the first iteration: construct S(k)=R(k)[Z], fetch 
     296      if (j==1)    // in the first iteration: construct S(k)=R(k)[Z], fetch
    297297                   // endphi (the ideal defining phi) and ker(k) and construct
    298298                   // the ideal from above
     
    348348
    349349  // at the end: go back to the original basering and construct gene-
    350   // rators of the closure of I 
     350  // rators of the closure of I
    351351
    352352  setring Kxt;
    353353  map psi=R(1),mapI;              // from ReesAlgebra: the map Rees->Kxt
    354354
    355   list images=psi(preimages);   
    356  
     355  list images=psi(preimages);
     356
    357357  if (dblvl>-1)
    358358  {
     
    390390            (the first size(L)-1 elements are the numerators, the last one
    391391            is the denominator)
    392           - if # is given: #[1] is an integer, compute generators for the 
     392          - if # is given: #[1] is an integer, compute generators for the
    393393                           closure of I, I^2, ..., I^#[1]
    394394RETURN:   the integral closure of I, ... I^#[1]. If # is not given, compute
     
    399399          closure of the desired powers of I. "
    400400{
    401   int dblvl=printlevel-voice+2;   // toggles how much data is printed 
    402                                   // during the procedure 
     401  int dblvl=printlevel-voice+2;   // toggles how much data is printed
     402                                  // during the procedure
    403403
    404404  int j,k,d,computepow;                    // some counters
     
    421421
    422422  intmat m[nvars(basering)-1][1];  // an intvec used for jet and maxdeg1
    423   intvec tw=m,1;                   // such that t has weight 1 and all 
     423  intvec tw=m,1;                   // such that t has weight 1 and all
    424424                                   // other variables have weight 0
    425425
     
    443443      }
    444444    }
    445   } 
     445  }
    446446
    447447  if (dblvl>0)
     
    475475    {
    476476      image=images[j]-jet(images[j],k-1,tw);
    477       if (image<>0)                 
    478       {                                       
     477      if (image<>0)
     478      {
    479479        image=subst(image/t^k,t,0);
    480480        if (image<>0)
     
    497497
    498498  for (k=2;k<=pow;k++)
    499   { 
     499  {
    500500    for (j=1;j<=(k div 2);j++)
    501     { 
     501    {
    502502      result[k]=result[k]+result[j]*result[k-j];
    503503    }
    504504  }
    505  
     505
    506506  return(result);
    507507}
     
    537537    {
    538538      "// Trivial case: I is a principal ideal";
    539     } 
     539    }
    540540    list result=I;
    541541    if (size(#)>0)
     
    545545        result=insert(result,I*result[k],k);
    546546      }
    547     } 
     547    }
    548548    return(result);
    549549  }
     
    575575          result=insert(result,I*result[k],k);
    576576        }
    577       } 
     577      }
    578578      return(result);
    579579    }
     
    586586    "// We start with the Rees Algebra of I:";
    587587  }
    588  
     588
    589589  list Rees = ReesAlgebra(I);
    590590  def R(1)=Rees[1];
    591591  def Kxt=Rees[2];
    592592  setring R(1);
    593  
     593
    594594  if (dblvl>0)
    595595  {
     
    599599    "// Now ClosureRees computes generators for the integral closure";
    600600    "// of R[It] step by step";
    601   } 
     601  }
    602602
    603603  // ClosureRees computes fractions in R[x,t] representing the generators
     
    619619      "//I is integrally closed!";
    620620    }
    621    
     621
    622622    setring BAS;
    623623    list result=I;
     
    628628        result=insert(result,I*result[k],k);
    629629      }
    630     } 
     630    }
    631631    return(result);
    632632  }
    633    
     633
    634634  // construct the fractions corresponding to the generators of the
    635   // closure of I and its powers, depending on # (in fact, they will 
     635  // closure of I and its powers, depending on # (in fact, they will
    636636  // not be real fractions, of course). This is done in ClosurePower.
    637637
     
    642642  setring BAS;
    643643  list result=fetch(Kxt,result);
    644   return(result); 
     644  return(result);
    645645}
    646646example
  • Singular/LIB/solve.lib

    r3de58c r50cbdc  
    11//last change: 13.02.2001 (Eric Westenberger)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: solve.lib,v 1.21 2001-02-19 14:17:49 lossen Exp $";
     3version="$Id: solve.lib,v 1.22 2001-08-27 14:48:00 Singular Exp $";
    44category="Symbolic-numerical solving";
    55info="
     
    778778d>0: gives precision (1<d<p) for near-zero-determination,@*
    779779(default: d=1/2*p)
    780          
     780
    781781ASSUME:  the ground field has char 0;@*
    782782         l was computed using Algorithm of Lazard or Algorithm of Moeller
  • Singular/LIB/spcurve.lib

    r3de58c r50cbdc  
    11// (anne, last modified 31.5.99)
    22/////////////////////////////////////////////////////////////////////////////
    3 version="$Id: spcurve.lib,v 1.15 2001-02-06 11:38:07 anne Exp $";
     3version="$Id: spcurve.lib,v 1.16 2001-08-27 14:48:00 Singular Exp $";
    44category="Singularities";
    55info="
     
    720720              e.g. \"R\" leads to ring names R and R1
    721721           *  v of size n(n+1) leads to the following module ordering @*
    722               gen(v[1]) > gen(v[2]) > ... > gen(v[n(n+1)]) where the matrix 
     722              gen(v[1]) > gen(v[2]) > ... > gen(v[n(n+1)]) where the matrix
    723723              entry ij corresponds to gen((i-1)*n+j)
    724724ASSUME:    M is a quasihomogeneous n x (n+1) matrix where the n minors define
  • Singular/LIB/spectrum.lib

    r3de58c r50cbdc  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: spectrum.lib,v 1.15 2001-05-03 07:56:41 mschulze Exp $";
     2version="$Id: spectrum.lib,v 1.16 2001-08-27 14:48:00 Singular Exp $";
    33category="Singularities";
    44info="
     
    1414proc spectrumnd (poly f,list #)
    1515"USAGE:    spectrumnd(f[,1]); poly f
    16 ASSUME:   basering has characteristic 0 and local ordering, 
     16ASSUME:   basering has characteristic 0 and local ordering,
    1717          f has isolated singularity at 0 and nondegenerate principal part
    1818RETURN:
     
    2323    int S[2][i]: multiplicity of spectral number S[1][i]
    2424@end format
    25 NOTE:     if a second argument 1 is given, 
     25NOTE:     if a second argument 1 is given,
    2626          no test for a degenerate principal part will be done
    2727SEE_ALSO: gaussman_lib
     
    6969}
    7070///////////////////////////////////////////////////////////////////////////////
     71
     72proc spadd(list s1, list s2)
     73"USAGE:   spadd(s1,s2); list s1, s2
     74RETURN:  a list containing the sum of the two spectra s1 and s2
     75EXAMPLE: example spadd; shows an example
     76"
     77{
     78  return (system("spadd",s1,s2));
     79}
     80example
     81{ "EXAMPLE:"; echo = 2;
     82  ring r=0,(x,y),ds;
     83  list s1=spectrumnd(x5+x2y2+y5);
     84  s1;
     85  list s2=spectrumnd(x2+y3);
     86  s2;
     87  spadd(s1,s2);
     88}
     89///////////////////////////////////////////////////////////////////////////////
     90
     91proc spmul(list s, int k)
     92"USAGE:   spmul(s,k); list s, int k
     93RETURN:  a list containing the product of the spectrum s with the integer k
     94EXAMPLE: example spmul; shows an example
     95"
     96{
     97  return (system("spmul",s,k));
     98}
     99example
     100{ "EXAMPLE:"; echo = 2;
     101  ring r=0,(x,y),ds;
     102  list s=spectrumnd(x5+x2y2+y5);
     103  s;
     104  spmul(s,2);
     105>>>>>>> 1.12.2.1
     106}
     107///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/standard.lib

    r3de58c r50cbdc  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: standard.lib,v 1.58 2001-02-22 16:02:55 westenb Exp $";
     2version="$Id: standard.lib,v 1.59 2001-08-27 14:48:01 Singular Exp $";
    33category="Miscellaneous";
    44info="
     
    7171PURPOSE: computes the standard basis of the homogeneous ideal in the basering,
    7272         via a Hilbert driven standard basis computation.@*
    73          An optional second argument will be used as 1-st Hilbert function.
     73         An optional second argument will be used as 1st Hilbert function.
    7474ASSUME:  The optional second argument is the first Hilbert series as computed
    7575         by @code{hilb}.
     
    240240  // we are still here -- do the actual computation
    241241  string ordstr_P = ordstr(P);
    242   if (find(ordstr_P,"s") > 0)
     242  if ((find(ordstr_P,"s") > 0)||(find(ordstr_P,"M") > 0))
    243243  {
    244244    //spaeter den lokalen fall ueber lp oder aehnlich behandeln
     
    435435@item @strong{Purpose:}
    436436computes a (possibly minimal) free resolution of an ideal or module using
    437 a heuristically choosen method.
     437a heuristically chosen method.
    438438@* The second (int) argument (say, @code{k}) specifies the length of
    439439the resolution. If it is not positive then @code{k} is assumed to be the
     
    603603SYNTAX:  @code{quot (} module_expression@code{,} ideal_expression @code{)}
    604604TYPE:    module
    605 PURPOSE: computes the quotient of the first and the 2nd argument.
     605PURPOSE: computes the quotient of the 1st and the 2nd argument.
    606606         If a 3rd argument 'n' is given the n-th method is used
    607607         (n=1...5).
  • Singular/LIB/surf.lib

    r3de58c r50cbdc  
    11//last change: 02.03.2001 (Eric Westenberger)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: surf.lib,v 1.19 2001-03-02 13:41:19 westenb Exp $";
     3version="$Id: surf.lib,v 1.20 2001-08-27 14:48:01 Singular Exp $";
    44category="Visualization";
    55info="
     
    4040
    4141proc  plot(ideal I,list #)
    42 "USAGE:   plot(I);  I ideal
    43 ASSUME: I defines a plane curve or a surface
     42"USAGE:   plot(I);  I ideal or poly
     43ASSUME: I defines a plane curve or a surface given by one equation
    4444RETURN: nothing
    4545NOTE: requires the external program 'surf' to be installed
     
    7575  }
    7676  ideal I=simplify(phi(I),2);
     77  if (leadcoef(I[1]) <0) { I[1]=-I[1]; }
    7778  if (ncols(I)==1 and n<=2) // curve
    7879  {
     
    131132example
    132133{ "EXAMPLE:"; echo =2;
    133    // ---------  plane curves ------------
    134    ring rr0 = 0,(x1,x2),dp;
     134  // ---------  plane curves ------------
     135  ring rr0 = 0,(x1,x2),dp;
    135136
    136    ideal I = x1^3 - x2^2;
    137    plot(I);
     137  ideal I = x1^3 - x2^2;
     138  plot(I);
    138139
    139    ring rr1 = 0,(x,y,z),dp;
    140    ideal I(1) = 2x2-1/2x3 +1-y+1;
    141    plot(I(1));
     140  ring rr1 = 0,(x,y,z),dp;
     141  ideal I(1) = 2x2-1/2x3 +1-y+1;
     142  plot(I(1));
    142143
    143144  //  ---- Singular Logo --------------
     
    145146  plot(logo);
    146147
    147    // --------- implicit curves ------------
    148    // implicit curves
    149    ideal I(1) = y,-x2;
    150    plot(I(1));
    151    ideal I(2) = x2,-y2 +4;
    152    plot(I(2));
     148  // Steiner surface
     149  ideal J(2) = x^2*y^2+x^2*z^2+y^2*z^2-17*x*y*z;
     150  plot(J(2));
    153151
    154    //the lemniscate
    155 
    156    ideal I(3) = x4+2x2y2 + y4, x2-y2;
    157    plot(I(3));
    158 
    159    // ----------- surfaces -------------------
    160    ideal J(1) = 3xy4 + 2xy2, x5y3 + x + y6,10x2;
    161    plot(J(1));
    162 
    163    // Steiner surface
    164 
    165    ideal J(2) = x^2*y^2+x^2*z^2+y^2*z^2-17*x*y*z;
    166    plot(J(2));
    167 
     152  // --------------------
    168153  plot(x*(x2-y2)+z2);
    169154
  • Singular/LIB/zeroset.lib

    r3de58c r50cbdc  
    11// Last change 12.02.2001 (Eric Westenberger)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: zeroset.lib,v 1.7 2001-02-19 14:17:50 lossen Exp $";
     3version="$Id: zeroset.lib,v 1.8 2001-08-27 14:48:02 Singular Exp $";
    44category="Symbolic-numerical solving";
    55info="
     
    8686  - 'roots' is the list of roots of the polynomial f (no multiplicities)
    8787  - if the groundfield is Q(a') and the extension field is Q(a), then
    88     'newA' is the representation of a' in Q(a). 
     88    'newA' is the representation of a' in Q(a).
    8989    If the basering contains a parameter 'a' and the minpoly remains unchanged
    9090    then 'newA' = 'a'.
     
    312312    If the basering contains a parameter 'a' and the minpoly remains unchanged
    313313    then 'newA' = 'a'.
    314     If the basering does not contain a parameter then 'newA' = 'a' (default).   
     314    If the basering does not contain a parameter then 'newA' = 'a' (default).
    315315  - 'id' is the ideal I in Q(a)[x_1,...] (a' substituted by 'newA')
    316316  @end format
  • Singular/Makefile.in

    r3de58c r50cbdc  
    3434@SET_MAKE@
    3535CC              = @CC@
     36LD              = @LD@
    3637CXX             = @CXX@
    3738LEX             = @LEX@
     
    149150SOURCES=${CSOURCES} ${CXXSOURCES} \
    150151        grammar.y scanner.l libparse.l syz2.cc prCopyTemplate.cc \
    151         p_Delete__Template.cc p_ShallowCopyDelete__Template.cc \
    152         p_Copy__Template.cc p_Mult_nn__Template.cc  pp_Mult_nn__Template.cc \
    153         pp_Mult_mm__Template.cc p_Mult_mm__Template.cc \
    154         p_Minus_mm_Mult_qq__Template.cc p_Add_q__Template.cc \
    155         p_Neg__Template.cc pp_Mult_Coeff_mm_DivSelect__Template.cc \
    156         pp_Mult_Coeff_mm_DivSelectMult__Template.cc \
    157         p_Merge_q__Template.cc pp_Mult_mm_Noether__Template.cc\
    158         p_kBucketSetLm__Template.cc \
     152        p_Delete__T.cc p_ShallowCopyDelete__T.cc \
     153        p_Copy__T.cc p_Mult_nn__T.cc  pp_Mult_nn__T.cc \
     154        pp_Mult_mm__T.cc p_Mult_mm__T.cc \
     155        p_Minus_mm_Mult_qq__T.cc p_Add_q__T.cc \
     156        p_Neg__T.cc pp_Mult_Coeff_mm_DivSelect__T.cc \
     157        pp_Mult_Coeff_mm_DivSelectMult__T.cc \
     158        p_Merge_q__T.cc pp_Mult_mm_Noether__T.cc\
     159        p_kBucketSetLm__T.cc \
    159160        kInline.cc utils.cc utils.h febase.inc \
    160161        tesths.cc mpsr_Tok.cc claptmpl.cc
     
    217218# MAKE SURE THAT THIS IS UP_TO_DATE
    218219#
    219 SLIBS = ainvar.lib   algebra.lib   all.lib       brnoeth.lib    classify.lib \
     220SLIBS = COPYING \
     221        ainvar.lib   algebra.lib   all.lib       brnoeth.lib    classify.lib \
    220222        deform.lib   elim.lib      equising.lib  finvar.lib     gaussman.lib \
    221223        general.lib  graphics.lib  hnoether.lib  homolog.lib    inout.lib \
    222224        intprog.lib  latex.lib     linalg.lib    makedbm.lib    matrix.lib \
    223         mondromy.lib mprimdec.lib  mregular.lib  normal.lib     ntsolve.lib \
    224         paramet.lib  poly.lib      presolve.lib  primdec.lib    primitiv.lib \
    225         qhmoduli.lib random.lib    reesclos.lib  ring.lib       rinvar.lib \
    226         sing.lib     solve.lib     spcurve.lib   spectrum.lib   standard.lib \
    227         stratify.lib surf.lib     toric.lib     triang.lib    zeroset.lib
     225        mprimdec.lib \
     226        mondromy.lib mregular.lib  normal.lib    ntsolve.lib    paramet.lib \
     227        poly.lib     presolve.lib  primdec.lib   primitiv.lib   qhmoduli.lib \
     228        random.lib   reesclos.lib  ring.lib      rinvar.lib     sing.lib \
     229        solve.lib    spcurve.lib   spectrum.lib  standard.lib   stratify.lib \
     230        surf.lib     toric.lib     triang.lib    zeroset.lib
    228231
    229232SLIBS_FILES = $(addprefix LIB/,${SLIBS})
     
    362365
    363366p_Procs_%.so: p_Procs_Lib_%.dl_o
    364         ld ${SLDFLAGS} -o $@ $^
     367        $(LD) ${SLDFLAGS} -o $@ $^
    365368
    366369mpsr.so: $(MPSR_SOURCES:.cc=.dl_o)
    367         ld ${SLDFLAGS} -o $@ $^ -L${libdir} ${MP_LIBS}
     370        $(LD) ${SLDFLAGS} -o $@ $^ -L${libdir} ${MP_LIBS}
    368371
    369372dbmsr.so: $(DBMSR_SOURCES:.cc=.dl_o)
    370         ld ${SLDFLAGS} -o $@ $^
     373        $(LD) ${SLDFLAGS} -o $@ $^
    371374
    372375src: scanner.cc grammar.h grammar.cc libparse.cc
     
    429432        ${INSTALL_PROGRAM} ${SING_EXEC} ${SINGULAR}
    430433        ${INSTALL_PROGRAM} libparse ${RUN_SINGULARS} ${bindir}
    431         ${INSTALL_PROGRAM} ESingular ${bindir}
    432         ${INSTALL_PROGRAM} TSingular ${bindir}
    433         ${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
     434        ${INSTALL_PROGRAM} ESingular TSingular ${DL_LIBS} ${bindir}
    434435        chmod a+x ${SINGULAR}
    435436        rm -f ${bindir}/${SING_EXEC}${EXEC_EXT}
     
    486487        ${MKINSTALLDIRS} ${install_bindir}
    487488        ${INSTALL_PROGRAM} -s  ${SING_EXEC} ${install_bindir}/Singular
    488         ${INSTALL_PROGRAM} -s  libparse ${RUN_SINGULARS} ESingular TSingular ${install_bindir}
     489        ${INSTALL_PROGRAM} -s  libparse ${RUN_SINGULARS} ESingular TSingular ${DL_LIBS} ${install_bindir}
    489490        echo "#undef MAKE_DISTRIBUTION " > distrib.h
    490         ${INSTALL_PROGRAM} ${DL_LIBS} ${install_bindir}
    491491
    492492install-sharedist: ${SLIBS_FILES} LIB/gftables
  • Singular/clapsing.cc

    r3de58c r50cbdc  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.77 2001-02-21 10:17:57 Singular Exp $
     5// $Id: clapsing.cc,v 1.78 2001-08-27 14:46:49 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    615615ideal singclap_factorize ( poly f, intvec ** v , int with_exps)
    616616{
    617   // with_exps: 1 return only true factors
     617  // with_exps: 3,1 return only true factors, no exponents
    618618  //            2 return true factors and exponents
    619   //            0 return factors and exponents
     619  //            0 return coeff, factors and exponents
    620620
    621621  ideal res=NULL;
     622
     623  // handle factorize(0) =========================================
    622624  if (f==NULL)
    623625  {
     
    630632    return res;
    631633  }
     634  // handle factorize(mon) =========================================
     635  if (pNext(f)==NULL)
     636  {
     637    int i=0;
     638    int n=0;
     639    int e;
     640    for(i=pVariables;i>0;i--) if(pGetExp(f,i)!=0) n++;
     641    if (with_exps==0) n++; // with coeff
     642    res=idInit(max(n,1),1);
     643    switch(with_exps)
     644    {
     645      case 0: // with coef & exp.
     646        res->m[0]=pOne();
     647        pSetCoeff(res->m[0],nCopy(pGetCoeff(f)));
     648        // no break
     649      case 2: // with exp.
     650        (*v)=new intvec(n);
     651        (**v)[0]=1;
     652        // no break
     653      case 1: ;
     654      #ifdef TEST
     655      default: ;
     656      #endif
     657    }
     658    if (n==0)
     659    {
     660      res->m[0]=pOne();
     661      // (**v)[0]=1; is already done
     662      return res;
     663    }
     664    for(i=pVariables;i>0;i--)
     665    {
     666      e=pGetExp(f,i);
     667      if(e!=0)
     668      {
     669        n--;
     670        poly p=pOne();
     671        pSetExp(p,i,1);
     672        pSetm(p);
     673        res->m[n]=p;
     674        if (with_exps!=1) (**v)[n]=e;
     675      }
     676    }
     677    return res;
     678  }
     679  // use factory/libfac in general ==============================
    632680  Off(SW_RATIONAL);
    633681  On(SW_SYMMETRIC_FF);
     
    635683  number N=NULL;
    636684  number NN=NULL;
     685  number old_lead_coeff=nCopy(pGetCoeff(f));
    637686
    638687  if (rField_is_Q() || rField_is_Zp())
     
    689738  else if (rField_is_Extension())
    690739  {
    691     if (nGetChar()==1) setCharacteristic( 0 );
    692     else               setCharacteristic( -nGetChar() );
     740    if (rField_is_Q_a()) setCharacteristic( 0 );
     741    else                 setCharacteristic( -nGetChar() );
    693742    if ((currRing->minpoly!=NULL)
    694     && (nGetChar()<(-1)))
     743    )
    695744    {
    696745      CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     
    698747      CanonicalForm F( convSingAPClapAP( f,a ) );
    699748      L.insert(F);
    700       if (F.isUnivariate())
     749      if ((nGetChar()<(-1)) && F.isUnivariate())
    701750      {
    702751        L = factorize( F, a );
     
    704753      else
    705754      {
     755        CanonicalForm G( convSingTrPClapP( f ) );
     756#ifdef HAVE_LIBFAC_P
     757        CFList as(mipo);
     758        L = newfactoras( G, as, 1);
     759#else
    706760        WarnS("complete factorization only for univariate polynomials");
    707         CanonicalForm G( convSingTrPClapP( f ) );
    708761        if (nGetChar()==1) /* Q(a) */
    709762        {
     
    712765        else
    713766        {
    714 #ifdef HAVE_LIBFAC_P
    715           L = Factorize( G );
    716 #else
    717767          goto notImpl;
    718 #endif
    719768        }
     769#endif
    720770      }
    721771    }
     
    784834    }
    785835    // delete constants
    786     if ((with_exps!=0) && (res!=NULL))
     836    if (res!=NULL)
    787837    {
    788838      int i=IDELEMS(res)-1;
     
    790840      for(;i>=0;i--)
    791841      {
    792         if ((res->m[i]!=NULL) && (pNext(res->m[i])==NULL) && (pIsConstant(res->m[i])))
     842        if ((res->m[i]!=NULL)
     843        && (pNext(res->m[i])==NULL)
     844        && (pIsConstant(res->m[i])))
    793845        {
    794           pDelete(&(res->m[i]));
    795           if ((v!=NULL) && ((*v)!=NULL))
    796             (**v)[i]=0;
    797           j++;
    798         }
     846          if (with_exps!=0)
     847          {
     848            pDelete(&(res->m[i]));
     849            if ((v!=NULL) && ((*v)!=NULL))
     850              (**v)[i]=0;
     851            j++;
     852          }
     853          else if (i!=0)
     854          {
     855            res->m[0]=pMult(res->m[0],res->m[i]);
     856            res->m[i]=NULL;
     857            if ((v!=NULL) && ((*v)!=NULL))
     858              (**v)[i]=0;
     859            j++;
     860          }
     861        }
    799862      }
    800863      if (j>0)
     
    821884    }
    822885  }
     886  if (rField_is_Q_a() && (currRing->minpoly!=NULL))
     887  {
     888    int i=IDELEMS(res)-1;
     889    for(;i>=1;i--)
     890    {
     891      pNorm(res->m[i]);
     892    }
     893    pSetCoeff(res->m[0],old_lead_coeff);
     894  }
     895  else
     896    nDelete(&old_lead_coeff);
    823897notImpl:
    824898  if (res==NULL)
     
    885959  }
    886960
    887   LL=IrrCharSeries(L);
    888   int m= LL.length(); // Anzahl Zeilen
    889   int n=0;
     961  // a very bad work-around --- FIX IT in libfac
     962  // should be fixed as of 2001/6/27
     963  int tries=0;
     964  int m,n;
    890965  ListIterator<CFList> LLi;
    891   CFListIterator Li;
    892   for ( LLi = LL; LLi.hasItem(); LLi++ )
    893   {
    894     n = max(LLi.getItem().length(),n);
     966  loop
     967  {
     968    LL=IrrCharSeries(L);
     969    m= LL.length(); // Anzahl Zeilen
     970    n=0;
     971    for ( LLi = LL; LLi.hasItem(); LLi++ )
     972    {
     973      n = max(LLi.getItem().length(),n);
     974    }
     975    if ((m!=0) && (n!=0)) break;
     976    tries++;
     977    if (tries>=5) break;
    895978  }
    896979  if ((m==0) || (n==0))
     
    903986  }
    904987  res=mpNew(m,n);
     988  CFListIterator Li;
    905989  for ( m=1, LLi = LL; LLi.hasItem(); LLi++, m++ )
    906990  {
     
    11531237  intvec *v=NULL;
    11541238  int sw=(int)dummy->Data();
    1155   ideal f=singclap_factorize((poly)(u->Data()), &v, sw);
     1239  int fac_sw=sw;
     1240  if ((sw<0)||(sw>2)) fac_sw=1;
     1241  ideal f=singclap_factorize((poly)(u->Data()), &v, fac_sw);
    11561242  if (f==NULL)
    11571243    return TRUE;
  • Singular/claptmpl.cc

    r3de58c r50cbdc  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: claptmpl.cc,v 1.24 2000-07-06 13:26:22 pohl Exp $
     5// $Id: claptmpl.cc,v 1.25 2001-08-27 14:46:49 Singular Exp $
    66/*
    77* ABSTRACT - instantiation of all templates
     
    4141    template class ListIterator<CFFactor>;
    4242    template class List<CanonicalForm>;
     43    template class List<List<CanonicalForm> >;
    4344    template class ListIterator<CanonicalForm>;
    4445    template class Array<CanonicalForm>;
     
    5253    #ifndef NOSTREAMIO
    5354    template ostream & operator<<(ostream &, const List<Factor<CanonicalForm> > &);
     55    template ostream & operator<<(ostream &, const List<List<CanonicalForm> > &);
    5456    template ostream & operator<<(ostream &, const List<Variable> &);
    5557    #endif
     
    9294    T exp() const { return _exp; }
    9395#ifndef NOSTREAMIO
    94     friend ostream & operator <<(ostream &, const Substitution<T> &);
     96    friend ostream & operator <<<>(ostream &, Substitution<T> &);
     97    void Substitution<T>::print ( ostream& s ) const
     98    {
     99      s << "("  << factor() << ")^" << exp();
     100    }
    95101#endif
    96102};
     
    119125#ifndef NOSTREAMIO
    120126template <class T>
    121 ostream& operator<< ( ostream & os, const Substitution<T> & a ) { return os; }
     127ostream & operator <<(ostream & os, Substitution<T> &a)
     128{
     129  a.print(os);
     130  return os;
     131}
     132template ostream & operator <<(ostream &, Substitution<CanonicalForm> &);
     133template ostream & operator <<(ostream &, const List<CanonicalForm> &);
     134template ostream & operator <<(ostream &, const Array<CanonicalForm> &);
     135template ostream & operator<<(ostream &, const List<Substitution<CanonicalForm> > &);
    122136#endif
    123137
     
    152166
    153167// for charsets:
    154     template class List<CFList>;
    155168    template class ListIterator<CFList>;
    156169
  • Singular/cntrlc.cc

    r3de58c r50cbdc  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: cntrlc.cc,v 1.37 2001-03-05 11:48:54 Singular Exp $ */
     4/* $Id: cntrlc.cc,v 1.38 2001-08-27 14:46:50 Singular Exp $ */
    55/*
    66* ABSTRACT - interupt handling
     
    123123void sigsegv_handler(int sig, sigcontext s)
    124124{
    125   fprintf(stderr,"Singular : signal %d (v: %d/%lu):\n",sig,SINGULAR_VERSION,feVersionId);
     125  fprintf(stderr,"Singular : signal %d (v: %d/%u):\n",sig,SINGULAR_VERSION,feVersionId);
    126126  if (sig!=SIGINT)
    127127  {
     
    230230void sigsegv_handler(int sig, int code, struct sigcontext *scp, char *addr)
    231231{
    232   fprintf(stderr,"Singular : signal %d, code %d (v: %d/%lu):\n",
     232  fprintf(stderr,"Singular : signal %d, code %d (v: %d/%u):\n",
    233233    sig,code,SINGULAR_VERSION,feVersionId);
    234234  if ((sig!=SIGINT)&&(sig!=SIGABRT))
     
    275275void sigsegv_handler(int sig)
    276276{
    277   fprintf(stderr,"Singular : signal %d (v: %d/%lu):\n",
     277  fprintf(stderr,"Singular : signal %d (v: %d/%u):\n",
    278278    sig,SINGULAR_VERSION,feVersionId);
    279279  if (sig!=SIGINT)
  • Singular/configure

    r3de58c r50cbdc  
    600600SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-2}
    601601SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-1}
    602 SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-0}
     602SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-2}
    603603SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
    604 VERSION_DATE=${VERSION_DATE:-"March 2001"}
     604VERSION_DATE=${VERSION_DATE:-"August 2001"}
    605605
    606606