source: git/Singular/LIB/classify.lib @ d336d53

spielwiese
Last change on this file since d336d53 was d336d53, checked in by Kai Krüger <krueger@…>, 26 years ago
small fixes git-svn-id: file:///usr/local/Singular/svn/trunk@1340 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 89.0 KB
Line 
1// $Id: classify.lib,v 1.21 1998-04-06 16:31:31 krueger Exp $
2///////////////////////////////////////////////////////////////////////////////
3
4version  =       "$Id: classify.lib,v 1.21 1998-04-06 16:31:31 krueger Exp $";
5info="
6LIBRARY:  classify.lib  PROCEDURES FOR THE ARNOLD-CLASSIFIER OF SINGULARITIES 
7
8   A library for classifying isolated hypersurface singularities w.r.t. right
9   equivalence, based on the determinator of singularities by V.I. Arnold.
10   Author: Kai Krueger, krueger@mathematik.uni-kl.de
11   last modified: 04.04.1997
12
13basicinvariants(f);  computes Milnor number, determinacy-bound and corank of f
14classify(f);         normal form of poly f determined with Arnold's method
15corank(f);           computes the corank of f (i.e. of the Hessian of f)
16Hcode(v);            coding of intvec v acoording to the number repetitions
17init_debug([n]);     print trace and debugging information depending on int n 
18internalfunctions(); display names of internal procedures of this library
19milnorcode(f[,e]);   Hilbert poly of [e-th] Milnor algebra coded with Hcode
20morsesplit(f);       residual part of f after applying the splitting lemma
21quickclass(f)        normal form of f determined by invariants (milnorcode)
22singularity(s,[]);   normal form of singularity given by its name s and index
23swap (a,b);          returns b,a
24tschirnhaus(f,v);    Tschirnhaus transformation of f w.r.t. variable v
25A_L(s/f)              shortcut for quickclass(f) or normalform(s)
26normalform(s);       normal form of singularity given by its name s
27debug_log (lev,[])   print trace and debugging information w.r.t level>@DeBug
28           (parameters in square brackets [] are optional)
29";
30
31LIB "inout.lib";
32LIB "elim.lib";
33LIB "sing.lib";
34
35///////////////////////////////////////////////////////////////////////////////
36proc classify_init
37{
38  string s;
39  link l="DBM:r NFlist";
40  s = read(l,"VERSION");
41  if (s == "" ) {
42    "(classify.lib): Need to create database...";
43    LIB"makedbm.lib";
44    create_sing_dbm();
45  }
46  close(l);
47  l="DBM:r NFlist";
48  s = read(l,"VERSION");
49  //"(classify.lib): Creation done. Current version:", s;
50}
51///////////////////////////////////////////////////////////////////////////////
52
53proc classify (poly f_in)
54USAGE:    classify(f);  f=poly
55COMPUTE:  normal form and singularity type of f with respect to right
56          equivalence, as given in the book "Singularities of
57          differentiables maps, Volume I" by V.I. Arnold, S.M. Gusein-Zade,
58          A.N. Varchenko
59RETURN:   normal form of f, of type poly
60REMARK:   This version of classify is only alpha. Please send bugs and
61          comments to: "Kai Krueger" <krueger@mathematik.uni-kl.de>
62          Be sure to have at least Singular version 0.9.3, better 1.0.1
63          Updates can be found under:
64          URL=http://www.mathematik.uni-kl.de/~krueger/Singular/
65NOTE:     type init_debug(n); (0 <= n <= 10) in order to get intermediate
66          information, higher values of n give more information.
67          The proc creates several global objects with names all starting
68          with @, hence there should be no name conflicts
69EXAMPLE:  example classify; shows an example
70{
71//---------------------------- initialisation ---------------------------------
72  poly   f_out;
73  int    n, i, corank, show_nf;
74  string s2;
75  list   v;
76  def ring_ext = basering;
77
78  init_debug();                    // initialize trace/debug mode
79  if(checkring()) { return(f_in); }
80  n = nvars(basering);
81  show_nf  = 1;                // return normal form if set to '1'
82
83  // define new ring
84  ring ring_top=char(basering),(x(1..n)),(c,ds);
85
86  map conv_ext2top=ring_ext,maxideal(1);
87
88  if(defined(@ringdisplay)!=0) { kill @ringdisplay; }
89  string @ringdisplay = "ring_ext";
90  export @ringdisplay;
91
92  v = Klassifiziere(conv_ext2top(f_in));
93  poly f_out = v[1];
94  s2 = v[2];          // s2: Typ des Polynoms f z.b: E[18]
95  corank = v[3];
96
97//---------------- collect results and create return-value --------------------
98  if( s2=="error!" || s2=="NoClass") {
99      setring ring_ext;
100      return(f_in);
101  }
102
103  if(show_nf==1) {
104    poly f_nf = normalform(s2);
105    for(i=corank+1;i<=n;i=i+1) { f_nf = f_nf + x(i)^2; }
106    debug_log(2, "Normal form NF(f)=", f_nf);
107  }
108  if(corank>1) { for(i=corank+1;i<=n;i=i+1) { f_out = f_out + x(i)^2; } }
109  setring ring_ext;
110  map conv_top2ext=ring_top,maxideal(1);
111
112  if(show_nf == 1) { return(conv_top2ext(f_nf)); }
113  else { return(conv_top2ext(f_out)); }
114}
115example
116{"EXAMPLE"; echo=2;
117   ring r=0,(x,y,z),ds;
118   poly f=(x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3;
119   classify(f);
120   init_debug(3);
121   classify(f);
122}
123
124///////////////////////////////////////////////////////////////////////////////
125static
126proc Klassifiziere (poly f)
127{
128//--------------------------- initialisation ----------------------------------
129    string s1;
130    int    n, cnt, corank_f, K, Mu;
131    list   v, cstn;
132    map    PhiG;
133    def ring_top = basering;
134
135    n = nvars(basering);    // Zahl der Variablen des aktuellen Rings.
136    PhiG = ring_top, maxideal(1);
137    cstn[4] = PhiG;
138    if( defined(@ringdisplay) == 0) {
139      string @ringdisplay;               // Define always 'ringdisplay' to be
140      export @ringdisplay;               // able to run 'Show(f)'
141    }
142    @ringdisplay = "setring RingB;";
143    if(defined(RingB)!=0) { kill RingB; }
144    execute ("ring RingB="+charstr(basering)+",("+A_Z("x", n)+"),(c,ds);");
145    export RingB;
146    setring ring_top;
147
148//---------------------- compute basciinvariants ------------------------------
149    if(jet(f,0) != 0 ) {
150      cstn[1] = corank(f); cstn[2]=-1; cstn[3]=1;
151      return(printresult(1, f, "a unit", cstn, -1));
152    }
153
154    debug_log(1, "Computing Basicinvariants of f ...");
155    K, Mu, corank_f = basicinvariants(f);
156    debug_log(0, "About the singularity :");
157    debug_log(0, "          Milnor number(f)   = "+string(Mu));
158    debug_log(0, "          Corank(f)          = "+string(corank_f));
159    debug_log(0, "          Determinacy       <= "+string(K));
160    cstn[1] = corank_f;
161    cstn[2] = Mu;
162    cstn[3] = K;
163
164    if( Mu == 0) {
165      cstn[1]=1; cstn[3]=1;
166      return(printresult(1, f, "A[0]", cstn, 0)); }
167
168    if(Mu<0) {
169      debug_log(0, "The Milnor number of the function is infinite.");
170      debug_log(0, "The singularity is not in Arnolds list.");
171      return(printresult(1, 1, "error!", cstn, -1));
172    }
173
174    f = jet(f, K);
175    v = HKclass(milnorcode(f));
176    if(v[2]>0) { debug_log(0, "Guessing type via Milnorcode: ", v[1]);}
177    else {
178      debug_log(0, "Hilbert polynomial not recognised. Milnor code = ",
179                milnorcode(f));
180    }
181    debug_log(0, "");
182    debug_log(0, "Computing normal form ...");
183
184//------------ step 1, classification according to corank(f) ------------------
185    if(corank_f == 0) {
186       return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0)); }
187    if(corank_f == 1) {
188       return(printresult(2, f, "A["+string(Mu)+"]", cstn, 0)); }
189    cstn[4] = 0;
190    if(corank_f == 2) { return(Funktion1bis(f, cstn)); }
191    if(corank_f == 3) { return(Funktion1bis(f, cstn)); }
192    return(printresult(105, f, "NoClass", cstn, -1));
193}
194
195///////////////////////////////////////////////////////////////////////////////
196static
197proc Funktion1bis (poly f, list cstn)
198{
199//---------------------------- initialisation ---------------------------------
200   def ring_top=basering;
201   poly   g;
202   int    n, corank, K;
203   map    conv, PhiG;
204   string s1;
205   list   v_res, v_class, v, iv;
206 
207   corank = cstn[1];
208   K = cstn[3];
209   n = nvars(basering);
210
211//-------------------- apply morsesplit if n>corank ---------------------------
212   if( n > corank) {
213     debug_log(0,
214      "I have to apply the splitting lemma. This will take some time....:-)");
215     v_res = Morse(f, K, corank, 0);
216     g = v_res[1];
217     PhiG = v_res[2];
218
219     conv = ReOrder(g);
220     g = conv(g);
221     PhiG = conv(PhiG);
222
223     if(defined(RingB) != 0 ) { kill RingB; }
224     ring ring_rest=char(basering),(x(1..corank)),(c,ds);
225 
226     map MapReduce=ring_top,maxideal(1);
227     poly G = MapReduce(g);
228     map PhiG=ring_top,maxideal(1);// Konstruiere Id auf r
229     PhiG = MapReduce(PhiG);
230 
231     execute("ring RingB="+charstr(basering)+",("+A_Z("x",corank)+"),(c,ds);");
232     export RingB;
233     setring ring_rest;
234   }
235   else {
236     ring ring_rest=char(basering),(x(1..corank)),(c,ds);
237     map  PhiG=ring_top,maxideal(1);
238     poly G = PhiG(f);
239   }
240 
241//--------------------- step 1 of Arnold now finished -------------------------
242    map phi = ring_rest,maxideal(1);
243    cstn[4] = phi;
244    if(corank == 2) { v_class = Funktion3(G, cstn); }
245    else {
246      if(corank == 3) { v_class = Funktion50(G, cstn); }
247      else { v_class = printresult(1, f, "error!", cstn, -1); }
248    }
249//-------------------------- classification done ------------------------------
250    poly f_result = v_class[1];
251    v[2] = v_class[2];
252    v[3] = v_class[3];
253    map Phi = v_class[4];
254    PhiG = Phi(PhiG);
255    setring ring_top;
256    if(defined(conv)!=0) { kill conv; }
257    map conv=ring_rest,maxideal(1);
258    v[1] = conv(f_result);
259    return(v);
260}
261
262///////////////////////////////////////////////////////////////////////////////
263static
264proc Funktion3 (poly f, list cstn)
265{
266//---------------------------- initialisation ---------------------------------
267    poly f3 = jet(f, 3);
268    ideal Jf;
269    int Dim, Mult, Mu;
270    debug_log(1, "Step 3");
271
272    if( f3 == 0 ) { return(Funktion13(f, cstn)); }
273
274    // f3 ~ x3 , x2y+y3 , x2y
275    Jf = std(jacob(f3));
276    Dim = dim(Jf);
277    if(Dim == 0) { return(printresult(4, f, "D[4]", cstn, 0)); }
278
279    Mult = mult(Jf);
280    Mu = cstn[2];
281    if(Dim == 1) {
282      if( Mult == 1) { return(printresult(5,f,"D["+string(Mu)+"]", cstn, 0)); }
283      if( Mult == 2) { return(Funktion6(f, cstn));}         // series E,J
284      debug_log(0, "dimension 1 und deg != 1, 2 => error, ",
285                        "this should never occur");
286      return(printresult(3, f, "error!", cstn, -1));
287      // Should never reach this line
288    }
289    // Should never reach this line
290    return(printresult(3, f, "error!", cstn, -1));
291}
292
293///////////////////////////////////////////////////////////////////////////////
294static
295proc Funktion6 (poly f, list cstn)
296{ // Arnold's steps 6-12
297//---------------------------- initialisation ---------------------------------
298    poly   f3, fk;
299    ideal  JetId, Jf;
300    int    k, Dim, Mult, n, Mu;
301    map    PhiG, Phi;
302    intvec RFlg;
303    list   v;
304
305    def ring_top=basering;
306    f3   = jet(f, 3);            // 3-Jet von f
307    n    = nvars(basering);
308    Mu   = cstn[2];
309    PhiG = cstn[4];
310    k    = 1;
311    debug_log(1, "   Step 6");
312
313    RFlg = GetRf(f, n);
314    v    = Faktorisiere(f, f3, 3, 1, RFlg);
315    f    = v[1];
316    Phi  = v[2];
317    PhiG = Phi(PhiG);
318    cstn[4] = PhiG;
319
320//---------------------------- begin of loop ----------------------------------
321    while( (6*k) <= Mu ) {
322      JetId = x(1)^3+x(2)^(3*k);
323      fk    = jet(f, 3*k, weight(JetId));
324      //--------------------------- step 6(k) ---------------------------------
325      if( fk == Coeff(fk,x(1), x(1)^3)*x(1)^3 ) {
326        JetId = x(1)^3+x(2)^(3*k+1);           // check jet x3,y3k+1  : E[6k]
327        fk    = jet(f, 3*(3*k+1), weight(JetId));
328        if( Coeff(fk,x(2),x(2)^(3*k+1)) != 0 ) {
329          return(printresult(7, f, "E["+string(6*k)+"]", cstn, k-1));
330        }
331
332        JetId = x(1)^3+x(1)*x(2)^(2*k+1);      // check jet x3,xy2k+1 : E[6k+1]
333        fk    = jet(f, 3*(2*k+1), weight(JetId));
334        if( Coeff(fk, x(1)*x(2), x(1)*x(2)^(2*k+1)) != 0 ) {
335          return(printresult(8, f,"E["+string(6*k+1)+"]", cstn, k-1));
336        }
337
338        JetId = x(1)^3+x(2)^(3*k+2);           // check jet x3,y3k+1  : E[6k+2]
339        fk    = jet(f, 3*(3*k+2), weight(JetId));
340        if( Coeff(fk,x(2),x(2)^(3*k+2)) != 0 ) {
341          return(printresult(9, f,"E["+string(6*k+2)+"]", cstn, k-1));
342        }
343
344        //------------------------- step 10(k) --------------------------------
345        k++;
346        JetId = x(1)^3+x(2)^(3*k);
347        fk    = jet(f, 3*k, weight(JetId));
348        Jf    = std(jacob(fk));
349        Dim   = dim(Jf);
350
351        if(Dim==0) { return(printresult(11,f,"J["+string(k)+",0]",cstn,k-1)); }
352        Mult = mult(Jf);
353        if( Dim ==1  && Mult==1) {
354          return(printresult(12,f,"J["+string(k)+","+string(Mu - 6*k +2)+"]",
355                 cstn, k-1));
356        }
357        if( Dim == 1  && Mult == 2) {
358          if(Coeff(fk, x(2), x(2)^(3*k)) != 0) {
359            v    = Faktorisiere(f, fk, 3, k, RFlg);
360            f    = v[1];
361            Phi  = v[2];
362            PhiG = Phi(PhiG);
363            cstn[4] = PhiG;
364          }
365        }
366      }
367    }
368    // Should never reach this line
369    return(printresult(6, f, "error!", cstn, -1));
370}
371
372///////////////////////////////////////////////////////////////////////////////
373static
374proc Funktion13 (poly f, list cstn)
375{
376//---------------------------- initialisation ---------------------------------
377    poly f4;
378    ideal Jf;
379    int Dim, Mult, Mu;
380
381    debug_log(1, "   Step 13");
382    Mu = cstn[2];
383    f4 = jet(f, 4);
384    if( f4 == 0 ) { return(Funktion47(f, cstn)); }
385
386    // f4 ~ x4+ax2y2+y4, x4+x2y2, x2y2, x3y, x4
387    Jf  = std(jacob(f4));
388    Dim = dim(Jf);
389
390    if(Dim==0) { return(printresult(14,f,"X[9] = X[1,0] = T[2,4,4]",cstn,1)); }
391    Mult = mult(Jf);
392    if( Dim == 1) {
393      if( Mult == 1 ) {
394        return(printresult(15, f,
395              "X[1,"+string(Mu-9)+"] = T[2,4,"+string(Mu-5)+"]", cstn, 1));
396      }
397      if( Mult == 2 ) {
398        Jf = Jf, jacob(Jf);
399        Jf = std(Jf);
400        Dim = dim(Jf);
401        if(Dim==0){return(printresult(16,f,"Y[1,p,q] = T[2,4+p,4+q]",cstn,1));}
402        if( Dim == 1 ) { return(Funktion17(f, cstn)); }
403      }
404      if( Mult == 3 ) { return(Funktion25(f, cstn)); }
405    }
406    // Should never reach this line
407    return(printresult(13, f, "error!", cstn, -1));
408}
409
410///////////////////////////////////////////////////////////////////////////////
411static
412proc Funktion17 (poly f, list cstn)
413{ // Analog zu Fumktion 6, Kombination 17-24
414//---------------------------- initialisation ---------------------------------
415    poly  fk, ft;
416    ideal JetId, Jf;
417    int   p, Dim, Mult, Mu;
418    list  v;
419    map   PhiG, Phi;
420
421    def ring_top=basering;
422    debug_log(1, "      Step 17");
423    Mu   = cstn[2];
424    PhiG = cstn[4];
425    fk   = jet(f, 4);
426    p    = 1;
427
428//---------------------------- begin of loop ----------------------------------
429    while( 3*p<= Mu) {
430      debug_log(1, "         Step 18("+string(p)+")");
431      v   = Isomorphie_s17(f, fk, p, 1);
432      f, Phi  = v[1..2];
433      PhiG    = Phi(PhiG);
434      cstn[4] = PhiG;
435
436      if ( p>1) {
437        JetId = x(1)^3*x(2) + x(2)^(3*p);
438        fk = jet(f, 3*p, weight(JetId));
439      }
440      //--------------------------- step 18(p) --------------------------------
441      JetId = x(1)^3*x(2) + x(2)^(3*p+2);     // check jet x3y,y3k+2  : Z[6p+5]
442      fk = jet(f, 3*(3*p+2), weight(JetId));
443      if( Coeff(fk, x(2), x(2)^(3*p+2)) != 0) {
444        return(printresult(19,f, "Z["+string(6*p+5)+"]", cstn, p));
445      }
446
447      JetId = x(1)^3*x(2)+x(1)*x(2)^(2*p+2);  // check jet x3y,xy2k+2 : Z[6p+6]
448      fk = jet(f, 2*(3*p+2)+1, weight(JetId));
449      if( Coeff(fk, x(1)*x(2), x(1)*x(2)^(2*p+2)) != 0) {
450        return(printresult(20, f, "Z["+string(6*p+6)+"]", cstn, p));
451      }
452
453      JetId = x(1)^3*x(2) + x(2)^(3*p+3);     // check jet x3y,y3k+3  : Z[6p+7]
454      fk = jet(f, 3*(3*p+3), weight(JetId));
455      if( Coeff(fk, x(2), x(2)^(3*p+3)) != 0) {
456        return(printresult(21, f, "Z["+string(6*p+7)+"]", cstn, p));
457      }
458
459      //---------------------------- step 22 ----------------------------------
460      p = p+1;
461      JetId = x(1)^3*x(2) + x(2)^(3*p+1);
462      fk   = jet(f, 3*p+1, weight(JetId));
463      ft   = Teile(fk, x(2));
464      Jf   = std(jacob(ft));
465      Dim  = dim(Jf);
466      Mult = mult(Jf);
467      if(Dim==0) { return(printresult(23,f,"Z["+string(p-1)+",0]", cstn, p)); }
468      if( Mult == 1 ) {
469         return(printresult(24, f, "Z["+string(p-1)+","+string(Mu-3-6*p)+"]",
470                cstn, p));
471      }
472    }
473    // Should never reach this line
474    return(printresult(17, f, "error!", cstn, -1));
475}
476
477///////////////////////////////////////////////////////////////////////////////
478static
479proc Funktion25 (poly f, list cstn)
480{ // Analog zu Fumktion 6, Kombination 25-46
481//---------------------------- initialisation ---------------------------------
482    poly   fk, ft;
483    ideal  JetId, Jf;
484    int    k, Dim, Mult, Mu;
485    map    PhiG, Phi;
486    intvec RFlg;
487    list   v;
488    def ring_top=basering;
489
490    debug_log(1, "      Step 25");
491    Mu   = cstn[2];
492    PhiG = cstn[4];
493    fk   = jet(f, 4);
494    k    = 1;
495    RFlg = GetRf(f, 2);
496
497//---------------------------- begin of loop ----------------------------------
498    while (k<Mu) {
499      v    =  Faktorisiere(f, fk, 4 , k, RFlg);
500      f, Phi  = v[1..2];
501      PhiG    = Phi(PhiG);
502      cstn[4] = PhiG;
503
504      //--------------------------- step 26(k) --------------------------------
505      JetId = x(1)^4 + x(2)^(4*k+1);          // check jet x4,y4k+1  : W[12k]
506      fk    = jet(f, 4*(4*k+1), weight(JetId));
507      if( Coeff(fk, x(2), x(2)^(4*k+1)) != 0) {
508        return(printresult(27, f, "W["+string(12*k)+"]", cstn, 3*k-2));
509      }
510
511      JetId = x(1)^4 + x(1)*x(2)^(3*k+1);     // check jet x4,xy3k+1 : W[12k+1]
512      fk    = jet(f, 4*(3*k+1), weight(JetId));
513      if( Coeff(fk, x(1)*x(2), x(1)*x(2)^(3*k+1)) != 0) {
514        return(printresult(28, f, "W["+string(12*k+1)+"]", cstn, 3*k-2));
515      }
516
517      //--------------------------- step 29(k) --------------------------------
518      JetId = x(1)^4 + x(2)^(4*k+2);
519      fk    = jet(f, 2*(4*k+2), weight(JetId));
520      if( Coeff(fk, x(2), x(2)^(4*k+2)) != 0) {
521        Jf  = std(jacob(fk));
522        Dim = dim(Jf);
523        if(Dim==0) {return(printresult(30,f,"W["+string(k)+",0]",cstn,3*k-1));}
524        if(Dim==1) {
525           return(printresult(32, f,
526                  "W#["+string(k)+","+string(Mu-12*k-2)+"]", cstn, 3*k-1));
527        }
528        return(printresult(29, f, "error!", cstn, -1));
529      }
530      else {
531        // x^4 oder x^2(x^2+x(2)^2k+1)
532        ft  = Teile(fk, x(1)^2);
533        Jf  = std(jacob(ft));
534        Dim = dim(Jf);
535        if( Dim == 0 ) {
536           return(printresult(31, f, "W["+string(k)+","+string(Mu-12*k-3)+"]",
537                  cstn, 3*k-1));
538        }
539        if( Dim != 1 ) { return(printresult(29, f, "error!", cstn, -1)); }
540
541        //-------------------------- step 33(k) -------------------------------
542        JetId = x(1)^4 + x(1)*x(2)^(3*k+2);   // check jet x4,xy3k+2 : W[12k+5]
543        fk    = jet(f, 4*(3*k+2), weight(JetId));
544        if( Coeff(fk, x(1)*x(2), x(1)*x(2)^(3*k+2)) != 0) {
545          return(printresult(34, f,"W["+string(12*k+5)+"]", cstn, 3*k-1));
546        }
547
548        JetId = x(1)^4 + x(2)^(4*k+3);        // check jet x4,y4k+3  : W[12k+6]
549        fk    = jet(f, 4*(4*k+3), weight(JetId));
550        if( Coeff(fk, x(2), x(2)^(4*k+3)) != 0){
551          return(printresult(35, f,"W["+string(12*k+6)+"]", cstn, 3*k-1));
552        }
553
554        //-------------------------- step 36(k) -------------------------------
555        k = k+1;
556        JetId = x(1)^4 + x(2)^(4*k);
557        fk    = jet(f, (4*k), weight(JetId));
558        Jf    = std(jacob(fk));
559        Dim   = dim(Jf);
560        Mult  = mult(Jf);
561        if(Dim==0) {return(printresult(37,f,"X["+string(k)+",0]",cstn,3*k-1));}
562        if(Dim==1) {
563          if(Mult==1) {
564             return(printresult(38, f,"X["+string(k)+","+string(Mu-12*k+3)+"]",
565                    cstn, 3*k-1));
566          }
567          if(Mult==2) {
568            ft  = Teile(fk, x(1)^2);
569            Jf  = std(jacob(ft));
570            Dim = dim(Jf);
571            if( Dim == 0) { return(Funktion40(f, cstn, k)); }
572            if( Dim == 1) {
573               return(printresult(39, f, "Y["+string(k)+",r,s]", cstn,3*k-1));
574            }
575          }
576          if(Mult!=3) {
577            return(printresult(36, f, "error!", cstn, -1)); }
578        }
579        else { return(printresult(36, f, "error!", cstn, -1)); }
580      }
581    }  // Ende der While-Schleife
582    // Should never reach this line
583    return(printresult(25, f, "error!", cstn, -1));
584}
585
586///////////////////////////////////////////////////////////////////////////////
587static
588proc Funktion40 (poly f, list cstn, int k)
589{
590//---------------------------- initialisation ---------------------------------
591    int    r, kr, rr, sr, oldDebug;
592    poly   fk, f2, a, b, c;
593    ideal  JetId, Jfsyz;
594    string Typ, RestRing, s1;
595    list   v1, v2;
596    def ring_top=basering;
597
598    debug_log(1, "         Step 40" );
599
600//------------------------------ compute f2 -----------------------------------
601    JetId = x(1)^4 + x(2)^(4*k);
602    fk  = jet(f, (4*k), weight(JetId));
603    f2  = -fk / x(1)^3;
604    Jfsyz = f - fk, x(1)^3, f2;
605    matrix Mat = matrix(syz(Jfsyz));
606    a = Mat[2,1] / Mat[1,1] - Mat[2,2];
607    b = - Mat[3,1] / Mat[1,1] + Mat[3,2];
608    ring tmp_ring=char(basering), (x(1),x(2)),(c,ds);
609    map map_top2tmp=ring_top,maxideal(1);
610    oldDebug = @DeBug;
611    init_debug(-1);
612//------------------------------ classify f2 ----------------------------------
613    v1=Klassifiziere(map_top2tmp(b));
614    init_debug(oldDebug);
615    Typ = v1[2];
616    v2 = DecodeNormalFormString(Typ);
617    Typ, kr, rr, sr = v2[1..4];
618    r   = kr-k;
619    setring ring_top;
620    if( Typ == "E[6k]" ) {
621       return(printresult(42, f, "Z["+string(k)+","+string(12*k+6*r-1)+"]",
622              cstn, 3*k+r-2));
623    }
624    if( Typ == "E[6k+1]" ) {
625       return(printresult(43, f, "Z["+string(k)+","+string(12*k+6*r)+"]",
626              cstn, 3*k+r-2));
627    }
628    if( Typ == "E[6k+2]" ) {
629       return(printresult(44, f, "Z["+string(k)+","+string(12*k+6*r+1)+"]",
630              cstn, 3*k+r-2));
631    }
632    if( Typ == "J[k,0]" ) {
633       return(printresult(45, f, "Z["+string(k)+","+string(r)+",0]",
634              cstn, 3*k+r-2));
635    }
636    if( Typ == "J[k,r]" ) {
637       return(printresult(46,f,"Z["+string(k)+","+string(r)+","+string(rr)+"]",
638              cstn, 3*k+r-2));
639    }
640    // Should never reach this line
641    return(printresult(40, f, "error!", cstn, -1));
642}
643
644///////////////////////////////////////////////////////////////////////////////
645static
646proc Funktion50 (poly f, list cstn)
647{
648//---------------------------- initialisation ---------------------------------
649    poly  f3;
650    ideal Jf, Jf1, Jf2;
651    int   Dim, Mult, Mu;
652    debug_log(1, "Step 50");
653
654    f3 = jet(f, 3);
655    if( f3 == 0 ) { return(printresult(104, f, "NoClass", cstn, -1)); }
656
657    // f3 ~
658    Jf1  = jacob(f3);
659    Jf   = std(Jf1);
660    Dim  = dim(Jf);
661    Mult = mult(Jf);
662    Mu   = cstn[2];
663
664    if(Dim == 0) {
665       return(printresult(51, f, "P[8] = T[3,3,3]", cstn, 1));
666    } // x3 + y3 + z3 + axyz
667    if(Dim == 1) {
668      if (Mult == 1) {
669        return(printresult(52, f,"P["+string(Mu)+"] = T[3,3,"+string(Mu-5)+"]",
670               cstn, 1));
671      } // x3 + y3 + xyz
672      if(Mult == 2) {
673        Jf2 = wedge(jacob(Jf1),3-Dim), Jf1;
674        Jf2 = std(Jf2);
675        Dim = dim(Jf2);
676        if (Dim==0) { return(printresult(54,f,"R[p,q] = T[3,p,q]", cstn, 1)); }
677        if (Dim==1) { return(Funktion58(f, cstn)); }  // x3 + yz2
678      }
679      if(Mult == 3) {
680        Jf2 = wedge(jacob(Jf1),3-Dim), Jf1;
681        Jf2 = std(Jf2);
682        Dim = dim(Jf2);
683        if(Dim == 0) { return(printresult(56, f, "T[p,q,r]", cstn, 1)); }
684        if(Dim == 1) { return(Funktion66(f, cstn)); }   // x2z + yz2
685      }
686      if(Mult == 4) { return(Funktion82(f, cstn)); }    // x3 + xz2
687    }
688    if(Dim == 2) {
689      if(Mult == 1) { return(Funktion97(f, cstn)); }    // x2y
690      if(Mult == 2) { return(printresult(103,f,"NoClass", cstn, -1));}
691    }
692
693    // Should never reach this line
694    return(printresult(50, f, "error!", cstn, -1));
695}
696
697///////////////////////////////////////////////////////////////////////////////
698static
699proc Funktion58 (poly fin, list cstn)
700{
701//---------------------------- initialisation ---------------------------------
702    poly  f, f3, a, b, phi, b1, b2, b3, fa, fb, fc;
703    ideal B, Jf3, J1, J2, S, Jfsyz;
704    int   kx, ky, kz;
705    string tp;
706    matrix M[2][3];
707    matrix C[2][3], D;
708    list v;
709    map  PhiG, VERT;
710    def ring_top=basering;
711    debug_log(1, "   Step 58");
712
713    f    = fin;
714    f3   = jet(f, 3);
715    PhiG = cstn[4];
716    tp   = "Nix";
717    kx   = 1;     // Koordinate x
718    ky   = 2;     // Koordinate y
719    kz   = 3;     // Koordinate z
720    B    = maxideal(1);     // ideal fuer Abbildungen
721    Jf3  = jacob(f3);
722    S    = sat(Jf3, maxideal(1))[1];
723    J1   = diff(S[1], x(kx)), diff(S[1], x(ky)), diff(S[1], x(kz)),
724           diff(S[2], x(kx)), diff(S[2], x(ky)), diff(S[2], x(kz));
725    M    = J1;
726    J2   = minor(M, 2), S;
727 
728    //------------------ determine coordinate named 'x' -----------------------
729    S  = sat(J2, maxideal(1))[1];
730    J1 = Coeff(S[1], x(1), x(1)), Coeff(S[1], x(2), x(2)),
731          Coeff(S[1], x(3), x(3)), Coeff(S[2], x(1), x(1)),
732          Coeff(S[2], x(2), x(2)), Coeff(S[2], x(3), x(3));
733    C  = J1;
734    D  = syz(C);
735    kill C;
736
737    b1 = D[1,1];
738    b2 = D[2,1];
739    b3 = D[3,1];
740
741    debug_log(6, "f3,s1=", Show(f3));
742    if( b1 != 0) {
743      VERT=ring_top,-1*b1*x(1), -1*b2*x(1)+x(2), -1*b3*x(1) + x(3);
744      kx=1; ky=2; kz=3;
745    }
746    else {
747      if( b2 != 0) {
748        VERT=ring_top, x(1) + -1*b1*x(2), -1*b2*x(2), -1*b3*x(2) + x(3);
749        kx=2; ky=1; kz=3;
750      }
751      else {
752        if( b3 != 0) {
753          VERT=ring_top,x(1) + -1*b1*x(3), x(2) + -1*b2*x(3), -1*b3*x(3);
754          kx=3; ky=1; kz=2;
755        }
756      }
757    }
758    f       = VERT(f);
759    PhiG    = VERT(PhiG);
760    cstn[4] = PhiG;
761    debug_log(6, VERT);
762    f3 = jet(f,3);
763    debug_log(6, "f3,s2=", Show(f3));
764
765    //---------------- compute f_2 such that j3f = xf_2+f_3 -------------------
766    debug_log(6, "1) x=", kx, "  y=", ky, "  z=", kz );
767    matrix C = Coeffs(f3, x(kx));
768    fb=C[2,1];  // Coeff von x^1
769    fc=C[1,1];  // Coeff von x^0
770    if(diff(fb, x(ky)) != 0) {
771      Jfsyz = fb, diff(fb, x(ky));
772      matrix Mat = matrix(syz(Jfsyz));
773      B = maxideal(1);     // setze Abbildungs-ideal
774      if( nrows(Mat) == 2) {
775        poly Relation = -2 * Mat[2,1] / Mat[1,1];
776        b = Coeff(Relation, x(kz), x(kz));
777        B[rvar(x(ky))] = x(ky)-b*x(kz);
778      }
779      else {
780        Jfsyz = fb, diff(fb, x(kz));
781        Mat = matrix(syz(Jfsyz));
782        poly Relation = -2 * Mat[2,1];
783        a = Coeff(Relation, x(ky), x(ky));
784        B[rvar(x(kz))] = x(kz)-a*x(kz);
785        ky, kz = swap(ky, kz);
786      }
787      VERT = ring_top, B;
788      f    = VERT(f);
789      PhiG = VERT(PhiG);
790      cstn[4] = PhiG;
791      f3 = jet(f,3);
792      kill Mat;
793    }
794    else { ky,kz = swap(ky,kz); }
795
796    //------- compute tschirnhaus for 'z' and get f3=f_1(x,y,z)y^2+z^3 --------
797    C    = Coeffs(f3, x(kx));
798    fb   = C[2,1];  // Coeff von x^1
799    fc   = C[1,1];  // Coeff von x^0
800    v    = tschirnhaus(fc, x(kz));
801    fc, VERT = v[1..2];
802    f    = VERT(f);
803    PhiG = VERT(PhiG);
804    cstn[4] = PhiG;
805    f3 = jet(f,3);
806 
807    //------------------- compute f_1 and get f3=xy^2+z^3 ---------------------
808    fb = (f3 - 1*(Coeffs(f3, x(kz))[4,1])*x(kz)^3)/(x(ky)^2);
809    fc=(x(kx)-1*(Coeffs(fb,x(ky))[2,1])*x(ky)-1*(Coeffs(fb,x(kz))[2,1])*x(kz));
810    fa = Coeffs(fb, x(kx))[2,1];
811    if ( fa != 0 ) {
812      B = maxideal(1);
813      B[rvar(x(kx))] = fc / fa;
814      VERT = ring_top, B;
815      f    = VERT(f);
816      PhiG = VERT(PhiG);
817      cstn[4] = PhiG;
818      f3   = jet(f,3);
819    }
820
821    //--------------------- permutation of x,y,z  -----------------------------
822    if(Coeffs(f3, x(1))[4,1]!=0) {
823      kx=1;
824      if(Coeffs(f3, x(2))[3,1]==0) { ky=2; kz=3; }
825      else { ky=3; kz=2; }
826    }
827    else {
828      if(Coeffs(f3, x(2))[4,1]!=0) {
829        kx=2;
830        if(Coeffs(f3, x(3))[3,1]==0) { ky=3; kz=1; }
831        else { ky=1; kz=3; }
832      }
833      else {
834        kx=3;
835        if(Coeffs(f3, x(1))[3,1]==0) { ky=1; kz=2; }
836        else { ky=2; kz=1; }
837      }
838    }
839    VERT = ring_top, x(kx), x(ky), x(kz);
840    f    = VERT(f);
841    PhiG = VERT(PhiG);
842    cstn[4] = PhiG;
843    f3   = jet(f,3);
844    return(Funktion59(f, cstn));
845}
846
847///////////////////////////////////////////////////////////////////////////////
848static
849proc Funktion59 (poly f, list cstn)
850{
851//---------------------------- initialisation ---------------------------------
852    poly   phi, fr, fk, alpha, beta, f_tmp;
853    ideal JetId;
854    int    p, Dim, Mult, Mu;
855    string tp;
856    list   v;
857    map    PhiG, Phi;
858    intvec w, RFlg;
859    def ring_top=basering;
860    debug_log(1, "      Step 59");
861
862    Mu   = cstn[2];
863    PhiG = cstn[4];
864    tp   = "Nix";
865    p    = 1;
866    phi  = jet(f,3);
867    fr   = f - phi;
868    RFlg = 1,2,3;
869    alpha = coeffs(fr, x(1))[1,1];
870    beta = (fr - alpha) / x(1);
871    debug_log(3, "f    = ", Show(f));
872    debug_log(3, "fr   = ", Show(fr));
873    debug_log(3, "alpha= ", Show(alpha));
874    debug_log(3, "beta = ", Show(beta));
875
876//---------------------------- begin of loop ----------------------------------
877    while(6*p<Mu) {
878      JetId = x(2)^(3*p+1);
879      JetId = phi + x(2)^(3*p+1);
880      //--------------------------- step 59(k) --------------------------------
881      w     = weight(JetId);
882      fk    = jet(fr, 3*w[1], w);
883      if(fk!=0) { return(printresult(60,f, "Q["+string(6*p+4)+"]", cstn, p)); }
884
885      JetId = phi + x(1)*x(2)^(2*p+1);
886      w     = weight(JetId);
887      fk    = jet(fr, 3*w[1], w);
888      if(fk!=0) { return(printresult(61,f, "Q["+string(6*p+5)+"]", cstn, p)); }
889
890      JetId = phi + x(2)^(3*p+2);
891      w     = weight(JetId);
892      fk    = jet(fr, 3*w[1], w);
893      if(fk!=0) { return(printresult(62,f, "Q["+string(6*p+6)+"]", cstn, p)); }
894
895      //--------------------------- step 63(k) --------------------------------
896      p++;
897      JetId = phi + x(2)^(3*p);
898      w     = weight(JetId);
899      fk    = jet(f, 3*w[1], w);
900      JetId = std(jacob(fk));
901      Dim   = dim(JetId);
902      Mult  = mult(JetId);
903      if(Dim==0) { return(printresult(64, f, "Q["+string(p)+",0]", cstn, p)); }
904      if(Dim==1) {
905        if(Mult == 1) {
906           return(printresult(65, f, "Q["+string(p)+","+string(Mu-(6*p+2))+"]",
907                  cstn, p));
908        }
909        if(Mult == 2) {
910          fk    = jet(fr, 3*w[1], w);
911          f_tmp = Coeffs(phi, x(1))[4,1] *x(1)^3+fk;
912          v    = Faktorisiere(f, f_tmp, 3 , p, RFlg);
913          f    = v[1];
914          Phi  = v[2];
915          PhiG = Phi(PhiG);
916          cstn[4] = PhiG;
917          fr = f - phi;
918        }
919      }
920    }
921    // Should never reach this line
922    return(printresult(59, f, "error!", cstn, -1));
923}
924
925///////////////////////////////////////////////////////////////////////////////
926static
927proc Funktion66 (poly f, list cstn)
928{
929//---------------------------- initialisation ---------------------------------
930    int kx = 1; // Koordinate x
931    int ky = 2; // Koordinate y
932    int kz = 3; // Koordinate z
933    poly f3 = jet(f, 3);
934    ideal JetId;
935
936    debug_log(1, "   Step 66");
937    debug_log(2, "F3=", Show(f3));
938    poly fx = diff(f3, x(kx));
939    JetId = jacob(fx);
940    JetId = std(JetId);
941    "nach x:",Show(fx), "  Id=", JetId, "  Dim=", dim(JetId);
942
943    poly fy = diff(f3, x(ky));
944    JetId = jacob(fx);
945    JetId = std(JetId);
946    "nach y:",Show(fy), "  Id=", JetId, "  Dim=", dim(JetId);
947
948    poly fz = diff(f3, x(kz));
949    JetId = jacob(fx);
950    JetId = std(JetId);
951    "nach z:",Show(fz), "  Id=", JetId, "  Dim=", dim(JetId);
952    return(printresult(1, 66, "error!", cstn, -1));
953}
954
955///////////////////////////////////////////////////////////////////////////////
956static
957proc Funktion82 (poly f, list cstn)
958{
959//---------------------------- initialisation ---------------------------------
960    poly   f3, b1, b2, b3;
961    int    i, kx, ky, kz, Fall;
962    ideal  Jfsyz, B;
963    intvec kv = 1,2,3;
964    matrix Mat;
965    map    PhiG, VERT;
966    list   v;
967    def ring_top=basering;
968    debug_log(1, "   Step 82");
969
970    f3 = jet(f,3);
971    kx = 1;     // Koordinate x
972    ky = 2;     // Koordinate y
973    kz = 3;     // Koordinate z
974    B  = maxideal(1);
975    Jfsyz = jacob(f3);
976    PhiG  = cstn[4];
977    Fall  = 2;
978
979//------------------ find coordinatechange that f3 ~ g(x,z) -------------------
980    if (diff(f3, x(1)) == 0) { kx, ky = swap(kx, ky); }
981    if (diff(f3, x(2)) == 0) {  }
982    if (diff(f3, x(3)) == 0) { kz, ky = swap(kz, ky); }
983    if ( (diff(f3, x(1)) != 0) && (diff(f3, x(2)) != 0) &&
984          (diff(f3, x(3)) != 0) ) {
985      Mat = matrix(syz(Jfsyz));
986      b1  = Mat[1,1];
987      b2  = Mat[2,1];
988      b3  = Mat[3,1];
989
990      if( b1 != 0) {
991        VERT = ring_top,b1*x(kx), b2*x(kx)+x(ky), b3*x(kx) + x(kz);
992        kx, ky = swap(kx, ky);
993      }
994      else {
995        if(b2!=0) { VERT = ring_top,x(kx)+b1*x(ky),b2*x(ky),b3*x(ky)+x(kz); }
996        else {
997          if(b3!=0) { VERT = ring_top,x(kx)+b1*x(kz),x(ky)+b2*x(kz),b3*x(kz); }
998          else { VERT = ring_top,B; }
999        }
1000      }
1001      f    = VERT(f);
1002      PhiG = VERT(PhiG);
1003      cstn[4] = PhiG;
1004    }
1005    VERT = ring_top,x(kx),x(ky),x(kz);
1006    f    = VERT(f);
1007    PhiG = VERT(PhiG);
1008    cstn[4] = PhiG;
1009    f3   = jet(f,3);
1010
1011    if( (f3-subst(f3, x(kx), 0)) == 0) { kx, ky = swap(kx, ky); }
1012    if( (f3-subst(f3, x(kz), 0)) == 0) { kz, ky = swap(kz, ky); }
1013
1014//------------ find coordinatechange for f3 ~ x3+xz2, if possible  ------------
1015    matrix C = coeffs(f3, x(kx));
1016    if(size(C) == 3) { C = coeffs(f3, x(kz)); kx,kz=swap(kx, kz); }
1017    if(C[1,1] == 0 && C[3,1] == 0) { Fall = 1; }
1018    if(C[1,1] != 0 && C[3,1] != 0 ) { Fall = 3; }
1019    if(C[1,1] == 0 && C[3,1] != 0 ) { Fall = 2; }
1020    if(C[1,1] != 0 && C[3,1] == 0 ) { Fall = 2; kx,kz=swap(kx, kz); }
1021
1022    if(Fall == 1) {
1023      VERT=ring_top,x(kx),x(ky),x(kz);
1024    }
1025    if(Fall == 2) {
1026       v = tschirnhaus(f3/x(kz), x(kx));
1027       b1, VERT = [1..2];
1028    }
1029    if(Fall == 3) {
1030      v = tschirnhaus(f3/x(kx), x(kx));
1031      b1, VERT = [1..2];
1032      debug_log(2, "B1=", Show(jet(VERT(f),3)));
1033      v = tschirnhaus(f3/x(kz), x(kz));
1034      b2, VERT = [1..2];
1035      debug_log(2, "B2=", Show(jet(VERT(f),3)));
1036    }
1037    f    = VERT(f);
1038    PhiG = VERT(PhiG);
1039    cstn[4] = PhiG;
1040    f3   = jet(f,3);
1041
1042//------------- if f3 ~ x3+xz2 then continue with classification  -------------
1043    C = coeffs(f3, x(1));
1044    if( C[1,1] == 0 && C[2,1] != 0 && C[3,1] == 0 && C[4,1] != 0 ) {
1045      return(Funktion83(f, cstn));
1046    }
1047    return(printresult(82, f, "error!", cstn, -1));
1048}
1049
1050///////////////////////////////////////////////////////////////////////////////
1051static
1052proc Isomorphie_s82_z (poly f, poly fk, int p)
1053{
1054//---------------------------- initialisation ---------------------------------
1055    poly   Relation, a, b;
1056    ideal  Jfsyz, B;
1057    matrix Mat;
1058    map    VERT;
1059    list   v;
1060    def ring_top=basering;
1061
1062    debug_log(1, "      Isomorphie 82/90 z");
1063    debug_log(2, "tt=", Show(fk));
1064    Jfsyz = fk, diff(fk, x(3));
1065    Mat   = matrix(syz(Jfsyz));
1066    Relation = -2 * Mat[2,1] / Mat[1,1];
1067    a = Coeff(Relation, x(3), x(3));
1068    b = Coeff(Relation, x(2), x(2)^p);
1069    B = maxideal(1);
1070    B[rvar(x(3))] = x(3)-b*x(2)^p;
1071    VERT = ring_top,B;
1072    v    = VERT(f), VERT;
1073    debug_log(2, VERT);
1074    debug_log(2, "      z res=", Show(VERT(fk)));
1075    return(v);
1076}
1077
1078///////////////////////////////////////////////////////////////////////////////
1079static
1080proc Isomorphie_s82_x (poly f, poly fk, int p)
1081{
1082//---------------------------- initialisation ---------------------------------
1083    matrix Mat;
1084    poly   Relation, a, b;
1085    ideal  Jfsyz, B;
1086    map    VERT;
1087    list   v;
1088    def ring_top=basering;
1089
1090    debug_log(1, "      Isomorphie 82/90 x");
1091    debug_log(2, "tt=", Show(fk));
1092    Jfsyz = fk, diff(fk, x(1));
1093    Mat   = matrix(syz(Jfsyz));
1094    Relation = -3 * Mat[2,1] / Mat[1,1];
1095    a = Coeff(Relation, x(1), x(1));
1096    b = Coeff(Relation, x(2), x(2)^p);
1097    B = maxideal(1);
1098    B[rvar(x(1))] = x(1)-b*x(2)^p;
1099    VERT = ring_top,B;
1100    v    = VERT(f), VERT;
1101    debug_log(2, VERT);
1102    debug_log(2, "      x res=", Show(VERT(fk)));
1103
1104    return(v);
1105}
1106
1107///////////////////////////////////////////////////////////////////////////////
1108static
1109proc Funktion83 (poly f, list cstn)
1110{
1111//---------------------------- initialisation ---------------------------------
1112    poly   fk, phi, a, b;
1113    ideal  JetId, Jf, B;
1114    int    k, Dim, Mult;
1115    intvec w;
1116    map    PhiG, Phi;
1117    list   v;
1118    matrix Mat;
1119    def ring_top=basering;
1120    debug_log(1, "      Step 83");
1121
1122    k    = 1;
1123    PhiG = cstn[4];
1124//---------------------------- begin of loop ----------------------------------
1125    while(k<10) {
1126      phi   = jet(f, 3);
1127      //--------------------------- step 83(k) --------------------------------
1128      JetId = x(1)^3 + x(3)^3 + x(2)^(3*k+1);
1129      fk    = jet(f- phi, 3*w[1], weight(JetId)) ;
1130      if(fk!=0) { return(printresult(84,f,"U["+string(12*k)+"]",cstn,4*k-3)); }
1131
1132      JetId = x(1)^3 + x(3)^3 + x(1)*x(2)^(2*k+1);
1133      fk    = jet(f, 3*w[1], weight(JetId)) ;
1134      //--------------------------- step 85(k) --------------------------------
1135      if ( fk != phi ) {
1136        Jf   = std(jacob(fk));
1137        Dim  = dim(Jf);
1138        if(Dim==0) {return(printresult(86,f,"U["+string(k)+",0]",cstn,4*k-2));}
1139        if(Dim==1) {return(printresult(87,f,"U["+string(k)+",p]",cstn,4*k-2));}
1140      }
1141
1142      //--------------------------- step 88(k) --------------------------------
1143      JetId = x(1)^3 + x(3)^3 + x(2)^(3*k+2);
1144      fk    = jet(f- phi, 3*w[1], weight(JetId)) ;
1145      if(fk!=0) {return(printresult(89,f,"U["+string(12*k+4)+"]",cstn,4*k-2));}
1146
1147      //--------------------------- step 90(k) --------------------------------
1148      k++;
1149      JetId = x(1)^3 + x(3)^3 + x(2)^(3*k);
1150      fk    = jet(f, 3*w[1], weight(JetId)) ;
1151      Jf    = std(jacob(fk));
1152      Dim   = dim(Jf);
1153      Mult  = mult(Jf);
1154      if ( Dim == 0 ) { return(printresult(83, f, "NoClass", cstn, -1)); }
1155      if ( Dim == 1 ) {
1156        if ( Mult == 4 ) {
1157          if( fk - phi != 0) { // b!=0  und/oder b'!=0
1158            if( Coeff(fk,x(1)*x(2), x(1)^2*x(2)^k) == 0 ) { // b=0 und b'!=0
1159              a    = (fk - Coeff(fk, x(1), x(1)^3)*x(1)^3) / x(1);
1160              v    = Isomorphie_s82_z(f, a, k);
1161            }
1162            else {
1163              if( Coeff(fk,x(1)*x(2)*x(3), x(1)*x(2)^k*x(3)) == 0 ){
1164                        // b!=0 und b'=0
1165                a    = subst(fk, x(3), 0);
1166                v    = Isomorphie_s82_x(f, a, k);
1167              }
1168              else {
1169                a = Coeff(fk,x(1)*x(2)*x(3), x(1)*x(2)^k*x(3));
1170                b = Coeff(fk,x(2)*x(3), x(2)^(2*k)*x(3));
1171                B = maxideal(1);
1172                B[rvar(x(1))] = x(1)-b/a*x(2)^k;
1173                Phi  = ring_top,B;
1174                f    = Phi(f);
1175                PhiG = Phi(PhiG);
1176                cstn[4] = PhiG;
1177                fk   = jet(f, 3*w[1], w) ;
1178                a    = (fk - Coeff(fk, x(1), x(1)^3)*x(1)^3) / x(1);
1179                v    = Isomorphie_s82_z(f, a, k);
1180              } // ende else b!=0 und b'=0
1181            } // ende else b=0 und b'!=0
1182            f, Phi  = v[1..2];
1183            PhiG    = Phi(PhiG);
1184            cstn[4] = PhiG;
1185          } //ende fk-phi!=0
1186        } // ende mult=4
1187        else { return(printresult(83, f, "NoClass", cstn, -1)); }
1188      } // ende dim=1
1189      else { return(printresult(83, f, "NoClass", cstn, -1)); }
1190    } // ENDE While
1191    return(printresult(83, f, "error!", cstn, -1));
1192}
1193
1194///////////////////////////////////////////////////////////////////////////////
1195static
1196proc Funktion97 (poly f, list cstn)
1197{
1198//---------------------------- initialisation ---------------------------------
1199    poly   f3, l1, l2, a, b, c, prod;
1200    ideal  Jfsyz, Jf, B;
1201    int    k, i, pt, kx, ky, kz, Dim, Mult, Mu;
1202    matrix Mat;
1203    map    PhiG, VERT;
1204    def ring_top=basering;
1205    debug_log(1, "   Step 97");
1206
1207    Mu   = cstn[2];
1208    PhiG = cstn[4];
1209    kx   = 1;   // Koordinate x
1210    ky   = 2;   // Koordinate y
1211    kz   = 3;   // Koordinate z
1212    B    = maxideal(1); // Abbildungs-ideal
1213    pt   = 2;
1214    f3   = jet(f, 3);
1215    k    = 1;
1216
1217//--------------------------- compute f3 ~ x2y --------------------------------
1218    // vertausche 2 Koordinaten sodass d2f/dx2 <>0 ist.
1219    for(i=1;i<4;i=i+1) {
1220      if(diff(diff(f3, x(i)), x(i)) != 0) { kx = i; i=4; }
1221    }
1222    if(kx == 2) { ky = 1; kz = 3; }
1223    if(kx == 3) { ky = 2; kz = 1; }
1224    //-------------------------- compute -l1*l2 -------------------------------
1225    f3    = jet(f, 3);
1226    Jfsyz = f3, diff(f3, x(kx));
1227    Mat   = matrix(syz(Jfsyz));
1228    if(deg(Mat[2,1])>1) {
1229      Jfsyz = f3, Mat[2,1];
1230      Mat   = matrix(syz(Jfsyz));
1231
1232      // berechen Abb. sodass f=x2*l2
1233      l1 = Mat[2,1];
1234      a  = Coeff(l1, x(kx), x(kx));
1235      l1 =  l1 / number(a);
1236      b  = Coeff(l1, x(ky), x(ky));
1237      c  = Coeff(l1, x(kz), x(kz));
1238      B[rvar(x(kx))] = x(kx) - b * x(ky) - c * x(kz);
1239      VERT = ring_top, B;
1240      f    = VERT(f);
1241      PhiG = VERT(PhiG);
1242      cstn[4] = PhiG;
1243
1244      f3 = jet(f, 3);
1245      l2 = f3 / x(kx)^2;
1246
1247      // sorge dafuer, dass b<>0 ist.
1248      b = Coeff(l2, x(ky), x(ky));
1249      if( b== 0) { ky, kz = swap(ky, kz); }
1250 
1251      // Koordinaten-Transf. s.d. f=x2y
1252      b  = Coeff(l2, x(ky), x(ky));
1253      l2 =  l2 / number(b);
1254      a  = Coeff(l2, x(kx), x(kx));
1255      c  = Coeff(l2, x(kz), x(kz));
1256      B  = maxideal(1);
1257      B[rvar(x(ky))] = -a * x(kx) + x(ky) - c * x(kz);
1258      VERT = ring_top, B;
1259      f    = VERT(f);
1260      PhiG = VERT(PhiG);
1261      cstn[4] = PhiG;
1262    }
1263
1264//------------------------------- step 98 ---------------------------------
1265    Jfsyz = x(kx)^2*x(ky) + x(ky)^4 + x(kz)^4;
1266    a     = jet(f, 8, weight(Jfsyz));
1267    Jf    = std(jacob(a));
1268    Dim   = dim(Jf);
1269    Mult  = mult(Jf);
1270    if( Dim == 0) { return(printresult(99, f, "V[1,0]", cstn, 3)); }
1271    if( Dim == 1) {
1272      if(Mult==1) {return(printresult(100,f,"V[1,"+string(Mu-15)+"]",cstn,3));}
1273      if(Mult==2){return(printresult(101,f,"V#[1,"+string(Mu-15)+"]",cstn,3));}
1274    }
1275    " Dim=",Dim," Mult=",Mult;
1276    return(printresult(102, f, "NoClass", cstn, -1));
1277}
1278
1279///////////////////////////////////////////////////////////////////////////////
1280proc tschirnhaus (poly f, poly x)
1281USAGE:    tschirnhaus();
1282{
1283//---------------------------- initialisation ---------------------------------
1284    poly   b;
1285    ideal  B;
1286    int    n, j, hc;
1287    matrix cf;
1288    intvec z;
1289    string s;
1290    list   v;
1291    map    Phi, EH;
1292    def ring_top=basering;
1293
1294    n    = nvars(basering);
1295    cf   = coeffs(f, x);
1296    hc   = nrows(cf) - 1; // hoechster exponent von x_i
1297    b    = cf[hc+1,1];    // koeffizient von x_i^hc
1298    B    = maxideal(1);
1299    z[n] = 0;
1300    EH   = ring_top, z;
1301    Phi  = ring_top, B;
1302    v[1] = f;
1303    if ( EH(b) != 0)    // pruefe ob der Koeff von x_i^hc
1304    { B[rvar(x)] = x -1*(cf[hc,1]/(hc*b));
1305      v[1] = Phi(f);
1306    }
1307    v[2] = Phi;
1308    return(v);
1309}
1310
1311///////////////////////////////////////////////////////////////////////////////
1312static
1313proc Isomorphie_s17 (poly f, poly fk, int k, int ct, list #)
1314{
1315//---------------------------- initialisation ---------------------------------
1316    ideal  Jfsyz, JetId, bb;
1317    poly   a, b, c, d, Relation, an, bn;
1318    int    B,C, alpha, beta, gamma, g;
1319    matrix Matx, Maty;
1320    map    PhiG, VERT;
1321    list   v;
1322    def ring_top=basering;
1323
1324    if(size(#)==1) { PhiG = #[1]; }
1325    else { PhiG = ring_top,maxideal(1); }
1326    bb = maxideal(1);
1327
1328    // Ziel: bestimme a,b,c,d sodass  fk = (ax+by^k)^3(cx+dy) gilt.
1329    debug_log(2, "Isomorphie_s17:");
1330    debug_log(2, "Faktor: f=",Show(f)," Jet=",Show(fk)," k=",k, "cnt=", ct);
1331
1332    if( k == 1) {
1333      Jfsyz = fk, diff(fk, x(1));
1334      Matx  = matrix(syz(Jfsyz));
1335      Jfsyz = fk, diff(fk, x(2));
1336      Maty  = matrix(syz(Jfsyz));
1337
1338      a = Coeff(fk, x(1), x(1)^4);
1339      b = Coeff(fk, x(2), x(2)^4);
1340      c = Coeff(fk, x(1)*x(2), x(1)^3*x(2));
1341      d = Coeff(fk, x(1)*x(2), x(1)*x(2)^3);
1342
1343      if( (a != 0) && (b != 0) ) { 
1344        B = -int(Coeff(Matx[1,1], x(2), x(2)));
1345        C = -int(Coeff(Maty[1,1], x(1), x(1)));
1346        alpha = int(Coeff(Matx[2,1], x(1), x(1)^2));
1347        beta  = int(Coeff(Matx[2,1], x(1)*x(2), x(1)*x(2)));
1348        gamma = int(Coeff(Matx[2,1], x(2), x(2)^2));
1349
1350        bb[rvar(x(1))] = x(1) - (2*gamma / (B - beta))*x(2);
1351        bb[rvar(x(2))] = x(2) - ((C - beta) / (2*gamma))*x(1);
1352        VERT     = ring_top,bb;
1353        Relation = VERT(f);
1354        fk       = jet(Relation, 4);
1355
1356        an = Coeff(fk, x(1), x(1)^4);
1357        bn = Coeff(fk, x(2), x(2)^4);
1358        if( (an != 0) & (bn != 0) ) { VERT=ring_top,x(1),(x(2) + a*x(1))/ b; }
1359        f    = VERT(f);
1360        fk   = jet(f, 4);
1361        PhiG = VERT(PhiG);
1362
1363        a = Coeff(fk, x(1), x(1)^4);
1364        b = Coeff(fk, x(2), x(2)^4);
1365        c = Coeff(fk, x(1)*x(2), x(1)^3*x(2));
1366        d = Coeff(fk, x(1)*x(2), x(1)*x(2)^3);
1367        Jfsyz = fk, diff(fk, x(1));
1368        Matx  = matrix(syz(Jfsyz));
1369        Jfsyz = fk, diff(fk, x(2));
1370        Maty  = matrix(syz(Jfsyz));
1371      }
1372
1373      if( (a == 0) || (b == 0) ) {
1374        if( a == 0) {
1375          if( c == 0) { // y3(ax+by)
1376            Relation = - Matx[2,1] / Matx[1,1];
1377            a = Coeff(Relation, x(1), x(1));
1378            b = Coeff(Relation, x(2), x(2));
1379            VERT=ring_top,a*x(2)^k - b*x(1), x(1);
1380          }
1381          else { // (ax+by)^3y
1382            Relation = - 3*Matx[2,1] / Matx[1,1];
1383            a = Coeff(Relation, x(1), x(1));
1384            b = Coeff(Relation, x(2), x(2));
1385            VERT=ring_top,a*x(1) - b*x(2), x(2);
1386          }
1387        }
1388        else {
1389          if( d == 0) { // x3(ax+by)
1390            Relation = - Maty[2,1] / Maty[1,1];
1391            a = Coeff(Relation, x(1), x(1));
1392            b = Coeff(Relation, x(2), x(2));
1393            VERT=ring_top,x(1), b*x(2)^k - a*x(1);
1394          }
1395          else { // x(ax+by)^3
1396            Relation = - 3*Maty[2,1] / Maty[1,1];
1397            a = Coeff(Relation, x(1), x(1));
1398            b = Coeff(Relation, x(2), x(2));
1399            VERT=ring_top,x(2), b*x(1) - a*x(2);
1400          }
1401        }
1402        f    = VERT(f);
1403        PhiG = VERT(PhiG);
1404      }
1405      else {  //      "Weder b noch a sind 0";
1406        if(ct > 5) { v[1]=f; v[2]=PhiG; return(v); }
1407        fk = jet(f, 4);
1408        return(Isomorphie_s17(f, fk, k, ct+1, PhiG));
1409      }
1410    }
1411    else {  // k >1
1412      a     = fk/x(2);
1413      Jfsyz = a, diff(a, x(1));
1414      Matx  = matrix(syz(Jfsyz));
1415      Relation = -3 * Matx[2,1] / Matx[1,1];
1416      a    = Coeff(Relation, x(1), x(1));
1417      b    = Coeff(Relation, x(2), x(2)^k);
1418      VERT = basering,x(1)-b*x(2)^k,x(2);
1419      f    = VERT(f);
1420      PhiG = VERT(PhiG);
1421      JetId = x(1)^3*x(2) + x(2)^(3*k+1);
1422      fk = jet(f, 3*k+1, weight(JetId));
1423    }
1424    v = f, PhiG;
1425    debug_log(2, "Isomorphie_s17: done");
1426    debug_log(2, "Faktor: f=",Show(f)," Jet=",Show(fk)," k=",k);
1427
1428    return(v);
1429}
1430
1431///////////////////////////////////////////////////////////////////////////////
1432static
1433proc printresult (int step, poly f, string typ, list cstn, int m)
1434{
1435//---------------------------- initialisation ---------------------------------
1436  int corank, Mu, K;
1437  list v;
1438
1439  corank, Mu, K = cstn[1..3];
1440  debug_log(0,"   Arnold step number "+string(step));
1441  if( @DeBug >= 0 ) {
1442    "The singularity";
1443    "   `"+Show(jet(f, K))+"'";
1444    if( typ != "error!" && typ != "NoClass" ) {
1445      "is R-equivalent to "+typ+".";
1446    }
1447    if ( typ == "NoClass" ) {
1448      "is not in Arnolds list.";
1449    }
1450//    if(K>=0)  { "  det = "+string(K); }
1451    if(Mu>=0) { "   Milnor number = "+string(Mu); }
1452    if(m>=0)  { "   modality      = "+string(m); }
1453  }
1454  v = f, typ, corank, cstn[4];
1455  return(v);
1456}
1457
1458///////////////////////////////////////////////////////////////////////////////
1459static
1460proc Funktion47 (poly f, list cstn)
1461{
1462    int corank = cstn[1];
1463    int Mu = cstn[2];
1464    int K  = cstn[3];
1465    string s = "The Singularity '";+Show(jet(f, K), corank, K);
1466    string tp="";
1467//    return(printresult(47, f, tp, cstn, -1));
1468
1469    s = s +"' has 4-jet equal to zero. (F47), mu="+string(Mu);
1470 
1471    s; // +"  ("+SG_Typ+")";
1472    return(Show(f), tp, corank);
1473}
1474
1475///////////////////////////////////////////////////////////////////////////////
1476static
1477proc Funktion91 (poly f, list cstn, int k)
1478{
1479    string tp  = "U*[k,0]";
1480    return(printresult(91, f, tp, cstn, -1));
1481}
1482
1483///////////////////////////////////////////////////////////////////////////////
1484static
1485proc Funktion92 (poly f, list cstn, int k)
1486{
1487    string tp  = "UP[k]";
1488    return(printresult(92, f, tp, cstn, -1));
1489}
1490
1491///////////////////////////////////////////////////////////////////////////////
1492static
1493proc Funktion93 (poly f, list cstn, int k)
1494{
1495    string tp  = "UQ[k]";
1496    return(printresult(93, f, tp, cstn, -1));
1497}
1498
1499///////////////////////////////////////////////////////////////////////////////
1500static
1501proc Funktion94 (poly f, list cstn, int k)
1502{
1503    string tp  = "UR[k]";
1504    return(printresult(94, f, tp, cstn, -1));
1505}
1506
1507///////////////////////////////////////////////////////////////////////////////
1508static
1509proc Funktion95 (poly f, list cstn, int k)
1510{
1511    string tp  = "US[k]";
1512    return(printresult(95, f, tp, cstn, -1));
1513}
1514
1515///////////////////////////////////////////////////////////////////////////////
1516static
1517proc Funktion96 (poly f, list cstn, int k)
1518{
1519    string tp  = "UT[k]";
1520    return(printresult(96, f, tp, cstn, -1));
1521}
1522
1523///////////////////////////////////////////////////////////////////////////////
1524proc morsesplit(poly f)
1525USAGE:    morsesplit(f);        f=poly
1526RETURN:   Normal form of f in M^3 after application of the splitting lemma
1527COMPUTE:  apply the splitting lemma (generalized Morse lemma) to f
1528EXAMPLE:  example morsesplit; shows an example
1529{
1530//---------------------------- initialisation ---------------------------------
1531  poly f_out;
1532  int  n, K, Mu, corank;
1533  list v;
1534
1535  if(defined(@ringdisplay) != 0 ) { kill @ringdisplay; }
1536  string @ringdisplay = "setring "+nameof(basering);
1537  export @ringdisplay;
1538
1539  def ring_ext=basering;
1540
1541  n = nvars(basering);
1542
1543  // if trace/debug mode not set, do it!
1544  init_debug();
1545  K, Mu, corank = basicinvariants(f);
1546  ring ring_top=char(basering),(x(1..n)),(c,ds);
1547
1548  map Conv=ring_ext,maxideal(1);
1549  setring ring_top;
1550  v = Morse(jet(Conv(f),K), K, corank, 0);
1551  poly f_out = v[1];
1552  setring ring_ext;
1553  map ConvUp = ring_top, maxideal(1);
1554  return(ConvUp(f_out));
1555}
1556example
1557{ "EXAMPLE"; echo=2;
1558   ring r=0,(x,y,z),ds;
1559   export r;
1560   init_debug(1);
1561   poly f=(x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3;
1562   poly g=morsesplit(f);
1563   g;
1564}
1565
1566///////////////////////////////////////////////////////////////////////////////
1567static
1568proc Coeffs (list #)
1569{
1570  matrix m=matrix(coeffs(#[1],#[2]), deg(#[1])+1, 1);
1571  return(m);
1572}
1573
1574///////////////////////////////////////////////////////////////////////////////
1575static
1576proc Morse(poly f, int K, int corank, int ShowPhi)
1577{
1578//---------------------------- initialisation ---------------------------------
1579    poly   fc, f2, a, P, Beta, fi;
1580    ideal  Jfx, B;
1581    int    n, i, j, k, Rang, Done;
1582    matrix Mat;
1583    map    Id, Psi, Phi, PhiG;
1584    intvec Abb, RFlg;
1585    list   v;
1586
1587    fi = f;
1588    n = nvars(basering);
1589    init_debug();
1590
1591    def ring_top=basering;
1592 
1593    debug_log(3, "Spalte folgendes Polynom mit Bestimmtheit: ", string(K));
1594    debug_log(3, Show(fi));
1595 
1596    for( j=1; j<=n ; j++) { Abb[j] = 0; }
1597 
1598    RFlg = GetRf(fi, n);
1599    debug_log(2, "Reihenfolge fuer Vertauschungen:", RFlg );
1600    PhiG=ring_top,maxideal(1);
1601 
1602//----------------- find quadratic term, if there is only one -----------------
1603    B = maxideal(1);
1604    if(corank == (n-1)) {
1605      Done = 0;
1606      f2   = jet(fi, 2);
1607      j    = 1;
1608      Jfx  = f2, diff(f2, x(j));
1609      while(j<=n && (diff(f2, x(j))==0)) {
1610        j   = j+1;
1611        Jfx = f2, diff(f2, x(j));
1612      }
1613      Mat  = matrix(syz(Jfx));
1614      Beta = 2*Mat[2,1]/Mat[1,1];
1615      for( j=1; j<=n ; j=j+1) {
1616        f2 = Coeff(Beta, x(RFlg[j]), x(RFlg[j]));
1617        if(f2!=0) {
1618          k = RFlg[j];
1619          break;
1620        }
1621      }
1622      for( j=1; j<=n ; j=j+1) {
1623        f2 = Coeff(Beta, x(j), x(j));
1624        if(j == k) { B[rvar(x(j))] = (2*f2*x(j)-Beta) / number(f2); }
1625      }
1626      Phi  =ring_top,B;
1627      fi   = Phi(fi);   
1628      PhiG = Phi(PhiG);
1629    }
1630    if( ShowPhi > 1) { PhiG; }
1631 
1632//------------------------ compute spliting lemma -----------------------------
1633    fc = fi;
1634    i  = 1;              // Index fuer Variablen wird bearbeitet
1635    while( i <= n) {
1636      Phi=ring_top,maxideal(1);
1637      debug_log(6, "Pruefe Variable x(" +string(RFlg[i]) + ")");
1638      debug_log(6, "--------------------");
1639      j  = i + 1;        // setze j fuer evtle Verschiebung
1640      f2 = jet(fc,2);
1641      debug_log(6, "Rechne 2-Jet =" , string(f2));
1642      if( (f2 - subst(f2, x(RFlg[i]), 0)) == 0 ) { Abb[RFlg[i]] = 1; }
1643      if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 ) {
1644        while( (j<=n) || (i==n) ) {
1645          debug_log(6, "Pruefe 2-Jet mit Wert : " + string(jet(fc,2)));
1646          a = Coeff(jet(fc,2), x(RFlg[i]), x(RFlg[i])^2);
1647          debug_log(6,"Koeffizient von x(" + string(RFlg[i]) + ")^2 ist:", a);
1648          if( (a != 0) || (i==n) ) {
1649            debug_log(6, "BREAK!!!!!!!!!!!!!!");
1650            break;
1651          }
1652          debug_log(6,"Verschiebe evtl Variable x(",string(RFlg[j]),") um x(",
1653                       string(RFlg[i]), ")");
1654          B = maxideal(1);
1655          for( k=1; k<=n ; k=k+1) {
1656            if(k==RFlg[j]) { B[rvar(x(k))] = x(k) + x(RFlg[i]); }
1657          }
1658          Phi = ring_top,B;
1659          fc  = Phi(fi);
1660          j   = j + 1;
1661        }               // Ende while( (j<=n) || (i==n) )
1662 
1663        debug_log(6, "Moegliche Verschiebung fertig!");
1664        PhiG = Phi(PhiG);
1665        if( ShowPhi > 1) { "NachVersch.:"; Phi; }
1666 
1667        if( (j<=n) || (i==n)) {
1668          P = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
1669          debug_log(6, "Koeffizient von x("+string(RFlg[i])+") ist: ",
1670                        string(P));
1671          if(P != 0) {
1672            debug_log(6, "1 Koeffizient von x("+string(RFlg[i])+") ist: ",
1673                         string(P));
1674            debug_log(6, "a=" + string(a));
1675            P = P / number (2 * a);
1676            debug_log(6, "2 Koeffizient von x("+string(RFlg[i])+") ist: ",
1677                         string(P));
1678            B = maxideal(1);
1679            for( k=1; k<=n ; k=k+1) {if(k==RFlg[i]) {B[rvar(x(k))]=x(k)-P;}}
1680            Phi =ring_top,B;
1681            debug_log(6, "Quadratische-Ergaenzung durch:", Phi);
1682            fi   = Phi(fc);
1683            PhiG = Phi(PhiG);
1684            fc   = jet(fi,K);
1685            P    = Coeff(fc, x(RFlg[i]), x(RFlg[i]));
1686            if( P != 0) {
1687              fi = fc;
1688              continue;
1689            }
1690          }     // Ende if(P != 0)
1691                // Fertig mit Quadratischer-Ergaenzung
1692        }               // Ende if( (j<=n) || (i==n))
1693      }                 // Ende if( (f2 - subst(f2, x(RFlg[i]), 0)) != 0 )
1694 
1695      fi = fc;
1696      i  = i + 1;
1697      debug_log(6, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
1698    }
1699    debug_log(6, "Ende  ---------------------------------------------------");
1700 
1701//--------------------------- collect results ---------------------------------
1702    if( ShowPhi > 0 ) {
1703      "Abbildung innerhalb des Morse-Lemmas:";
1704      PhiG;
1705      "Vergleich:";
1706      "PhiG(f)= " + Show(jet(PhiG(f), K));
1707      "fi     = " + Show(fi);
1708    }
1709 
1710    Rang = 0;
1711    B    = maxideal(1);
1712    for( i=1; i<=n ; i++) { if(Abb[i] != 1) { Rang ++; B[rvar(x(i))] = 0; } }
1713    Phi  = ring_top,B;
1714    PhiG = Phi(PhiG);
1715    fi   = Phi(fi);
1716    v    = fi, PhiG;
1717    debug_log(2, "rank determined with Morse rg=", Rang);
1718    debug_log(1, "Rest singularity f=",Show(fi));
1719    return(v);
1720}
1721
1722///////////////////////////////////////////////////////////////////////////////
1723static
1724proc Coeff(poly f, list #)
1725{
1726//---------------------------- initialisation ---------------------------------
1727  poly   a, term;
1728  int    n, i;
1729  matrix K;
1730
1731  n     = nvars(basering);
1732  i     = 1;
1733  term  = #[2];
1734  K     = coef(f, #[1]);
1735
1736  while( (i<=ncols(K)) && (K[1,i] != term) )
1737  { i++;
1738    if(i>ncols(K)) { break; }
1739  }
1740  if(i<=ncols(K)) { a = K[2,i]; }
1741  if(i>ncols(K)) { a = 0; }
1742
1743  return(a);
1744}
1745
1746///////////////////////////////////////////////////////////////////////////////
1747static
1748proc ReOrder(poly f)
1749{
1750//---------------------------- initialisation ---------------------------------
1751  poly  result;
1752  ideal B = maxideal(1);
1753  int   i, n, Ctn, Ctv;
1754  map   conv;
1755
1756  n = nvars(basering);
1757  Ctv = 1;              // Zahl der Vorhandenen Variablen
1758  Ctn = n;              // Zahl der Nicht-Vorhandenen Variablen
1759  def ring_top=basering;
1760
1761  for( i=1; i<=n; i=i+1)
1762  { result = subst(f,x(i), 0) - f;
1763    if( result != 0 ) { B[rvar(x(i))] = x(Ctv); Ctv++; }
1764    else { B[rvar(x(i))] = x(Ctn); Ctn--; }
1765  }
1766
1767  conv = ring_top,B;
1768  return(conv);
1769}
1770
1771///////////////////////////////////////////////////////////////////////////////
1772proc quickclass(poly f);
1773USAGE:    quickclass(f);         f=poly
1774RETURN:   Normal form of f in Arnold's list
1775REMARK:   try to determine the normal form of f by invariants, mainly by
1776          computing the Hilbert function of the Milnor albegra,
1777          no coordinate change is needed (see also proc 'milnorcode').
1778EXAMPLE:  example quickclass; shows an example
1779{
1780//---------------------------- initialisation ---------------------------------
1781  string Typ;
1782  int    cnt, K, Mu, corank;
1783  list   v;
1784  def ring_top=basering;
1785  // check basic condition on the basering.
1786  if(checkring()) { return(f); }
1787  if( f==0 ) {
1788    "Normal form : 0";
1789    return(f);
1790  }
1791  if( jet(f,0)!=0 ) {
1792    "Normal form : 1";
1793    return(f);
1794  }
1795  K, Mu, corank = basicinvariants(f);
1796  if(Mu<0) {
1797    debug_log(0, "The Milnor number of the function is infinite.");
1798    return(f);
1799  }
1800
1801  // Do the classification of f
1802  // typ: list of types matching the milnorcode
1803  // cnt: number of matches found
1804  v = HKclass(milnorcode(f));
1805  Typ, cnt = v[1..2];
1806  "Singularity R-equivalent to :",Typ;
1807  if(cnt==0) {
1808    "Hilbert polynomial not recognised. Milnor code = ", milnorcode(f);
1809    return();
1810  }
1811  if(cnt==1) {
1812    debug_log(1,"Getting normal form from database.");
1813    "normal form :",A_L(Typ);
1814    return(A_L(Typ));
1815  }
1816  // Hier nun der Fall cnt>1
1817  "Hilbert-Code of Jf^2";
1818  "We have ", cnt, "cases to test";
1819  Cubic(f);
1820  return(v);
1821}
1822example
1823{ "EXAMPLE:"; echo=2;
1824   ring r=0,(x,y,z),ds;
1825   poly f=(x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3;
1826   quickclass(f);
1827}
1828
1829///////////////////////////////////////////////////////////////////////////////
1830proc milnorcode (poly f, list #)
1831USAGE:    milnorcode(f[,e]); f=poly, e=int
1832RETURN:   intvec, coding the Hilbert function of the e-th Milnor algebra
1833          of f, i.e. of basering/(jacob(f)^e) (default e=1), according
1834          to proc Hcode
1835EXAMPLE:  example milnorcode; shows an example
1836{
1837  int  e=1;
1838  if(size(#)==1) { e=#[1]; }
1839  ideal jf=std(jacob(f)^e);
1840  intvec v=hilb(jf,2);
1841 
1842  return(Hcode(v));
1843}
1844example
1845{ "EXAMPLE:"; echo=2;
1846  ring r=0,(x,y,z),ds;
1847  poly f=x2y+y3+z2;
1848  milnorcode(f);
1849  milnorcode(f,2);  // a big second argument may result in memory overflow
1850}
1851
1852///////////////////////////////////////////////////////////////////////////////
1853proc Hcode (intvec v)
1854USAGE:    Hcode(v); v=intvec
1855RETURN:   intvec, coding v according to the number of successive
1856          repetitions of an entry
1857EXAMPLE:  example Hcode; shows an example.
1858{
1859  int    col, len, i, cur, cnt, maxcoef, nlen;
1860  intvec hil1, hil2;
1861
1862  col      = 1;
1863  len      = size(v);
1864  v[len+1] = 0;
1865
1866  init_debug();
1867  debug_log(1, "Hcode:", v );
1868
1869  for(i=1; i<=len; i++) { if( v[i] > maxcoef) { maxcoef = v[i]; } }
1870
1871  nlen       = 2*maxcoef - 1;
1872  hil1[nlen] = 0;
1873  hil2[nlen] = 0;
1874
1875  for(i=1; i<=nlen; i++)
1876  { if( i > maxcoef) { hil2[i] = 2*maxcoef-i; }
1877    else { hil2[i] = i; }
1878  }
1879
1880  for(i=1; i<=nlen; i++)
1881  { cnt=0;
1882    while( (col<=len) && (v[col] == hil2[i]) )
1883    { cnt++; col++; }
1884    hil1[i] = cnt;
1885  }
1886  return(hil1);
1887}
1888example
1889{ "EXAMPLE:"; echo=2;
1890  intvec v1 = 1,3,5,5,2;
1891  Hcode(v1);
1892  intvec v2 = 1,2,3,4,4,4,4,4,4,4,3,2,1;
1893  Hcode(v2);
1894}
1895
1896///////////////////////////////////////////////////////////////////////////////
1897static
1898proc Cubic (poly f)
1899{
1900//---------------------------- initialisation ---------------------------------
1901  poly  f3;
1902  ideal Jf, Jf1, Jf2;
1903  int   Dim, Mult;
1904
1905  f3 = jet(f, 3);
1906  if( jet(f,2) != 0) { return("2-jet non zero"); }
1907  if( f3 == 0 ) { return("null form"); }
1908
1909  Jf1  = jacob(f3);
1910  Jf   = std(Jf1);
1911  Dim  = dim(Jf);
1912  Mult = mult(Jf);
1913
1914  if(Dim == 0) { return("P[8]:smooth cubic"); } // x3 + y3 + z3 + axyz
1915  if(Dim == 1) {
1916    if(Mult == 2) {
1917      Jf2  = wedge(jacob(Jf1),3-Dim), Jf1;
1918      Jf2  = std(Jf2);
1919      Dim  = dim(Jf2);
1920      if (Dim == 0) { return("R:conic + line"); }       // x3 + xyz
1921      if (Dim == 1) { return("Q:cuspidal cubic"); }  // x3 + yz2
1922    }
1923    if(Mult == 3) {
1924      Jf2 = wedge(jacob(Jf1),3-Dim), Jf1;
1925      Jf2 = std(Jf2);
1926      Dim = dim(Jf2);
1927      if(Dim == 0) { return("T:three lines"); } // xyz
1928      if(Dim == 1) { return("S:conic + tangent"); }     // x2z + yz2
1929    }
1930    if(Mult == 4) { return("U:three concurrent lines"); }       // x3 + xz2
1931  }
1932  if(Dim == 2) {
1933    if(Mult == 1) { return("V:doubleline + line"); }    // x2y
1934    if(Mult == 2) { return("V': tripple line"); }       // x3
1935  }
1936  if(Dim == 3) { return("P[9]:nodal cubic"); }  // x3 + y3 + xyz
1937
1938  return("");
1939}
1940
1941///////////////////////////////////////////////////////////////////////////////
1942static
1943proc parity  (int e)
1944USAGE:    parity()
1945{
1946  int r = e/2;
1947  if( 2*r == e ) { return(0); }
1948  return(1);
1949}
1950
1951///////////////////////////////////////////////////////////////////////////////
1952static
1953proc HKclass (intvec sg)
1954{
1955//---------------------------- initialisation ---------------------------------
1956  int    cnt = 0;
1957  string SG_Typ = "";
1958  list   v;
1959 
1960  // if trace/debug mode not set, do it!
1961  init_debug();
1962  debug_log(1, "Milnor code : ", sg );
1963  if(size(sg) == 1) { v ="A["+string(sg[1])+"]", 1; return(v); }
1964  if(size(sg) == 3) { return(HKclass3(sg, SG_Typ, cnt)); }
1965  if(size(sg) == 5) { return(HKclass5(sg, SG_Typ, cnt)); }
1966  if(size(sg) == 7) { return(HKclass7(sg, SG_Typ, cnt)); }
1967  debug_log(1, "No solution found." );
1968  v = "", 0;
1969  return(v);
1970}
1971
1972///////////////////////////////////////////////////////////////////////////////
1973static
1974proc HKclass3 (intvec sg, string SG_Typ, int cnt)
1975{
1976  list v;
1977
1978  if(sg[1] == 1) { v = HKclass3_teil_1(sg, SG_Typ, cnt); }
1979  debug_log(6, "HKclass3: ", v[1], " cnt=", v[2]);
1980  return(v);
1981}
1982
1983///////////////////////////////////////////////////////////////////////////////
1984static
1985proc HKclass3_teil_1 (intvec sg, string SG_Typ, int cnt)
1986{
1987  int  k, r, s;
1988  list v;
1989
1990  debug_log(2, "entering HKclass3_teil_1", sg);
1991  if(sg[2]==1) { SG_Typ=SG_Typ+" D[k]=D["+string(sg[3]+3)+"]";cnt++;} // D[k]
1992  if(sg[2]>=1) {
1993    if( parity(sg[2])) { // sg[2] ist ungerade
1994      if(sg[2]<=sg[3]) {
1995        k = (sg[2]+1)/2;
1996        if(k>1) {
1997          cnt++;
1998          SG_Typ=SG_Typ+" J[k,r]=J["+string(k)+","+string(sg[3]+1-2*k)+"]";
1999        }// J[k,r]
2000      }
2001      if(sg[2]==sg[3]+2) {                              // E[6k+2]
2002        k = (sg[2]-1)/2;
2003        if(k>0) {cnt++; SG_Typ=SG_Typ+" E[6k+2]=E[" + string(6*k+2) + "]"; }
2004      }
2005    }
2006    else {              // sg[2] ist gerade
2007      if( sg[2] == sg[3]+1) {                           // E[6k]
2008        k = sg[2]/2; cnt++; SG_Typ=SG_Typ + " E[6k]=E[" + string(6*k) + "]"; }
2009      if( sg[2] == sg[3]) {                             // E[6k+1]
2010        k=sg[2]/2; cnt++; SG_Typ=SG_Typ+" E[6k+1]=E["+string(6*k+1)+"]"; }
2011    }
2012  }
2013
2014  debug_log(2, "finishing HKclass3_teil_1");
2015  debug_log(6, "HKclass3: ", SG_Typ, " cnt=", cnt);
2016  v = SG_Typ, cnt;
2017  return(v);
2018}
2019
2020///////////////////////////////////////////////////////////////////////////////
2021static
2022proc HKclass5 (intvec sg, string SG_Typ, int cnt)
2023{
2024  list v;
2025
2026  if(sg[1] == 1 && sg[2] == 1) { v = HKclass5_teil_1(sg, SG_Typ,cnt); }
2027  if(sg[1] == 1 && sg[2] == 0) { v = HKclass5_teil_2(sg, SG_Typ,cnt); }
2028  debug_log(6, "HKclass5: ", v[1], " cnt=", v[2]);
2029  return(v);
2030}
2031
2032///////////////////////////////////////////////////////////////////////////////
2033static
2034proc HKclass5_teil_1 (intvec sg, string SG_Typ, int cnt)
2035{
2036  int  k, r, s;
2037  list v;
2038
2039  debug_log(2, "entering HKclass5_teil_1", sg);
2040  if(parity(sg[3])) {  // Dritte Stelle soll ungerade sein
2041    k = (sg[3]+1)/2;
2042    if(sg[3] > sg[4]) {
2043      k--;
2044      if( (sg[4]==sg[5]) && (sg[3] == sg[4]+1) && k>0 ) { // W[12k+6]
2045        SG_Typ = SG_Typ + " W[12k+6]=W["+string(12*k+6)+"]"; cnt++;
2046      }
2047      if( (sg[3]==sg[5]) && (sg[3] == sg[4]+2) && k>0 ) { // W[12k+5]
2048        SG_Typ = SG_Typ + " W[12k+5]=W["+string(12*k+5)+"]"; cnt++;
2049      }
2050    }
2051    else {  // sg[3] <= sg[4]
2052      if( (sg[3]==sg[4]) && (sg[5] >= sg[3]) ) {
2053        r = sg[5] - sg[4];
2054        SG_Typ=SG_Typ +" X[k,r]=X["+string(k)+","+string(r)+"]"; cnt++;
2055      }
2056      if( (sg[3]==1) && (sg[4]==3) && (sg[5]>=sg[4])){    // Z[1,r]
2057        r = sg[5] - sg[4];
2058        SG_Typ = SG_Typ + " Z[1,r]=Z[1,"+string(r)+"]"; cnt++;
2059      }
2060
2061      if( sg[4] == sg[5]) {
2062        if(parity(sg[4])) {                                  // Z[k,r,0]
2063          r = (sg[4] - sg[3])/2;
2064          if( r>0 ) { cnt++;
2065            SG_Typ = SG_Typ + " Z[k,r,0]=Z["+string(k)+","+string(r)+",0]";
2066          }
2067        }
2068        else {                                                // Z[k,12k+6r]
2069          r = (sg[4] - 2*k)/2; cnt++;
2070          SG_Typ = SG_Typ+" Z[k,12k+6r]=Z["+string(k)+","+string(12*k+6*r)+"]";
2071        }
2072      }
2073
2074      if( parity(sg[4]) ) {  // 4. Stelle ist ungerade
2075        if(sg[4] == sg[5]+2) {                              // Z[k,12k+6r+1]
2076          r = (sg[4]-2*k-1)/2; cnt++;
2077          SG_Typ=SG_Typ+" Z[k,12k+6r+1]=Z["+string(k)+",";
2078          SG_Typ=SG_Typ+string(12*k+6*r+1)+"]";
2079       }
2080       if( (sg[5]>sg[4]) && (sg[4]>sg[3]) ) {           // Z[k,r,s]
2081          r = (sg[4] - sg[3])/2; cnt++;
2082          s = sg[5] - sg[4];
2083          SG_Typ = SG_Typ + " Z[k,r,s]=";
2084          SG_Typ = SG_Typ + "Z["+string(k)+","+string(r)+","+string(s)+"]";
2085        }
2086      }
2087      else {  // 4. Stelle ist gerade
2088        if( sg[4] == sg[5]+1) {                             // Z[k,12k+6r-1]
2089          r = (sg[4] - 2*k)/2; cnt++;
2090          SG_Typ=SG_Typ+" Z[k,12k+6r-1]=Z["+string(k)+",";
2091          SG_Typ=SG_Typ+string(12*k+6*r-1)+"]";
2092        }
2093      }
2094
2095      if(sg[4]>sg[3]) {                                     // Y[k,r,s]
2096        r = sg[4] - sg[3];
2097        s = sg[5] - sg[3] + r;
2098        if( s<0 ) { s = -s; }
2099        SG_Typ = SG_Typ + " Y[k,r,s]="; cnt++;
2100        SG_Typ = SG_Typ + "Y["+string(k)+","+string(r)+","+string(s)+"]";
2101      }
2102    }
2103  }
2104  else {  // Dritte Stelle soll gerade sein
2105    k = sg[3]/2;
2106    // sortiere verschiedene W's
2107    if(k>0) {
2108      if( (sg[4]==2*k-1) && (sg[4]==sg[5]) ) {  // W[12k]
2109        SG_Typ = SG_Typ + " W[12k]=W["+string(12*k)+"]"; cnt++;
2110      }
2111      if( (sg[4]==2*k-1) && (sg[3]==sg[5]) ) {  // W[12k+1]
2112        SG_Typ = SG_Typ + " W[12k+1]=W["+string(12*k+1)+"]"; cnt++;
2113      }
2114      if( (sg[4]==2*k) && (sg[5]>=sg[4]) ) {    // W[k,r]
2115        r = sg[5] - sg[4];
2116        SG_Typ=SG_Typ+" W[k,r]=W["+string(k)+","+string(r)+"]"; cnt++;
2117      }
2118      if( (sg[5]==2*k-1) && (sg[4]>sg[3]) ) {  // W#[k,2r-1]
2119        r = sg[4] - sg[3]; cnt++;
2120        SG_Typ = SG_Typ + " W#[k,2r-1]=W["+string(k)+","+string(2*r-1)+"]";
2121      }
2122      if( (sg[5]==2*k) && (sg[4]>sg[3]) ) {  // W#[k,2r]
2123        r = sg[4] - sg[3]; cnt++;
2124        SG_Typ = SG_Typ + " W#[k,2r]=W["+string(k)+","+string(2*r)+"]";
2125      }
2126    }   // ENDIF k>0
2127  }
2128  debug_log(2, "finishing HKclass5_teil_1");
2129  debug_log(6, "HKclass5_teil_1: ", SG_Typ, " cnt=", cnt);
2130  v = SG_Typ, cnt;
2131  return(v);
2132}
2133
2134///////////////////////////////////////////////////////////////////////////////
2135static
2136proc HKclass5_teil_2 (intvec sg, string SG_Typ, int cnt)
2137{
2138  int k, r, s;
2139  list v;
2140
2141  debug_log(2, "entering HKclass5_teil_2", sg);
2142  // finde T[p,q,r]
2143  k = sg[3] + 1;
2144  r = sg[4] + k;
2145  s = sg[5] + r - 1;
2146  if(k>2 && r>2 && s>2) {                               // T[k,r,s]
2147    cnt++;
2148    SG_Typ = SG_Typ + " T[k,r,s]=T["+string(k)+","+string(r)+","+string(s)+"]";
2149  }
2150
2151  // finde weitere Moeglicjkeiten.
2152  if(sg[3]==2) {  // Q[...]
2153    if(parity(sg[4])) { // 4. Stelle ist ungerade.
2154      if(sg[4]==sg[5]) {                                // Q[6k+4]
2155        k=(sg[4]+1)/2; cnt++; SG_Typ=SG_Typ+" Q[6k+4]=Q["+string(6*k+4)+"]";
2156      }
2157      if(sg[4]+1==sg[5]) {                      // Q[6k+5]
2158        k=sg[5]/2; cnt++; SG_Typ=SG_Typ+" Q[6k+5]=Q["+string(6*k+5)+"]";
2159      }
2160    }
2161    else { // 4. Stelle ist gerade.
2162      if(sg[4]==sg[5]+1) {                      // Q[6k+6]
2163        k=sg[4]/2; cnt++; SG_Typ=SG_Typ+" Q[6k+6]=Q["+string(6*k+6)+"]";
2164      }
2165      if(sg[4]<sg[5]) {                 // Q[k,r]
2166        k = (sg[4]+2)/2;
2167        if(k>=2) {
2168          r=sg[5]+1-2*k; cnt++;
2169          SG_Typ=SG_Typ+" Q[k,r]=Q["+string(k)+","+string(r)+"]";
2170        }
2171      }
2172    }
2173  }
2174  else {           // S[...]
2175    if(parity(sg[3])) {  // 3. Stelle ist ungerade.
2176      k = (sg[3]-1)/2;
2177      if(sg[3]==sg[4]+3 && sg[3]==sg[5]+2) {    // S[12k-1]
2178        cnt++; SG_Typ = SG_Typ + " S[12k-1]=S["+string(12*k-1)+"]";
2179      }
2180      if(sg[3]==sg[4]+3 && sg[3]==sg[5]+1) {    // s[12k]
2181        cnt++; SG_Typ = SG_Typ + " S[12k]=S["+string(12*k)+"]";
2182      }
2183      if(sg[3]==sg[4]+2 && sg[5]>=sg[4]+1) {    // S[k,r]
2184        r = sg[5] - 2*k; cnt++;
2185        SG_Typ = SG_Typ + " S[k,r]=S["+string(k)+","+string(r)+"]";
2186      }
2187      if(sg[3]==sg[5]+2 && sg[4]>=sg[5]) {              // S#[k,2r-1]
2188        r = sg[4] - 2*k + 1; cnt++;
2189        SG_Typ = SG_Typ + " S#[k,2r-1]=S#["+string(k)+","+string(2*r-1)+"]";
2190      }
2191      if(sg[3]==sg[5]+1 && sg[4]>=sg[5]) {              // S#[k,2r]
2192        r = sg[4] - 2*k + 1; cnt++;
2193        SG_Typ = SG_Typ + " S#[k,2r]=S#["+string(k)+","+string(2*r)+"]";
2194      }
2195    }
2196    else { // 3. Stelle ist gerade.
2197      if(sg[3]==sg[5]+1 && sg[5]==sg[4]+3) {    // S[12k+4]
2198        k = (sg[3]-2)/2; cnt++;
2199        SG_Typ = SG_Typ + " S[12k+4]=S["+string(12*k+4)+"]";
2200      }
2201      if(sg[3]==sg[5]+2 && sg[5]==sg[4]+1) {    // S[12k+5]
2202        k = (sg[3]-2)/2; cnt++;
2203        SG_Typ = SG_Typ + " S[12k+5]=S["+string(12*k+5)+"]";
2204      }
2205    }
2206  }
2207  debug_log(2, "finishing HKclass5_teil_2");
2208  debug_log(6, "HKclass5_teil_2: ", SG_Typ, " cnt=", cnt);
2209  v = SG_Typ, cnt;
2210  return(v);
2211}
2212
2213///////////////////////////////////////////////////////////////////////////////
2214static
2215proc HKclass7 (intvec sg, string SG_Typ, int cnt)
2216{
2217  list v;
2218
2219  if(sg[1]==1 && sg[2]==0 && sg[3]==1) { v=HKclass7_teil_1(sg, SG_Typ, cnt); }
2220  debug_log(6, "HKclass7: ", v[1], " cnt=", v[2]);
2221  return(v);
2222}
2223
2224///////////////////////////////////////////////////////////////////////////////
2225static
2226proc HKclass7_teil_1 (intvec sg, string SG_Typ, int cnt)
2227{
2228  int k, r, s;
2229  list v;
2230
2231  debug_log(2, "entering HKclass7_teil_1", sg);
2232  if(sg[4] == 2) {                                      // V[...]
2233    if(sg[5] == 0 && sg[6] == 1 && sg[7]>0) {   // V[1,r]
2234      r = sg[7] - 1; cnt++; SG_Typ = SG_Typ + " V[1,r]=V[1,"+string(r)+"]";
2235    }
2236    if(sg[5] == 1 && sg[7] == 1) {                      // V#[1,2r-1]
2237      r=sg[6]+1; cnt++; SG_Typ=SG_Typ+" V#[1,2r-1]=V#[1,"+string(2*r-1)+"]";
2238    }
2239    if(sg[5] == 1 && sg[7] == 2) {                      // V#[1,2r]
2240      r=sg[6]+1; cnt++; SG_Typ=SG_Typ+" V#[1,2r]=V#[1,"+string(2*r)+"]";
2241    }
2242  }
2243  //            Moegliche U[...]'s
2244  k = sg[4];
2245  if(sg[5]==2*k-1 && sg[6]==0 && sg[7]==sg[5]) {        // U[12k]
2246    cnt++;SG_Typ = SG_Typ + " U[12k]=U["+string(12*k)+"]";
2247  }
2248  if(sg[5]==2*k && sg[6]==0 && sg[7]==sg[5]) {  // U[12k+4]
2249    cnt++;SG_Typ = SG_Typ + " U[12k+4]=U["+string(12*k+4)+"]";
2250  }
2251  if(sg[5]==2*k-1 && sg[6]>0 && sg[7]==sg[5]) { // U[k,2r-1]
2252    r=sg[6]-1; cnt++;
2253    SG_Typ=SG_Typ+" U[k,2r-1]=U["+string(k)+","+string(2*r-1)+"]";
2254  }
2255  if(sg[5]==2*k-1 && sg[6]>0 && sg[7]==2*k) {   // U[k,2r]
2256    r = sg[6]; cnt++;
2257    SG_Typ = SG_Typ + " U[k,2r]=U["+string(k)+","+string(2*r)+"]";
2258  }
2259  debug_log(2, "finishing HKclass7_teil_1");
2260  debug_log(6, "HKclass7_teil_1: ", SG_Typ, " cnt=", cnt);
2261  v = SG_Typ, cnt;
2262  return(v);
2263}
2264
2265///////////////////////////////////////////////////////////////////////////////
2266proc singularity(string typ, list #)
2267USAGE:    singularity(t, l); t=string (name of singularity),
2268          l=list of integers (index/indices of singularity)
2269COMPUTE:  get the Singularity named by type t from the database.
2270          list l is as follows:
2271          l= k [,r [,s [,a [,b [,c [,d]]]]]] k,r,s=int   a,b,c,d=poly
2272          The name of the dbm-databasefile is: NFlist.[dir,pag]
2273          The file is found in the current directory. If it does not
2274          exists, please run the script MakeDBM first.
2275RETURN:   Normal form and corank of the singularity named by type t and its
2276          index (indices) l
2277EXAMPLE:  example singularity; shows an example
2278{
2279  poly a1, a2, a3, a4, f;
2280  int k, r, s;
2281  int len = size(#);
2282  list v, ret;
2283
2284  classify_init();
2285  ret = 0, 0;
2286  k = #[1];
2287  if(len>=2) { r = #[2]; }
2288  else { r = 0; }
2289  if(len>=3) { s = #[3]; }
2290  else { s = 0; }
2291  if( k<0 || r<0 || s<0) {
2292    "Initial condition failed: k>=0; r>=0; s>=0";
2293    "k="+string(k)+" r="+string(r)+"   s="+string(s);
2294    return(ret);
2295  }
2296  int crk;
2297
2298  init_debug();
2299  def ring_top=basering;
2300
2301  if(len>=4) { a1 = #[4]; }
2302  else { a1=1; }
2303  if(len>=5) { a2 = #[5]; }
2304  else { a2=1; }
2305  if(len>=6) { a3 = #[6]; }
2306  else { a3=1; }
2307  if(len>=7) { a4 = #[7]; }
2308  else { a4=1; }
2309
2310  debug_log(4, "Values: len=", string(len), " k=", string(k), " r=",
2311        string(r));
2312  if(defined(RingNF) != 0 ) { kill RingNF; }
2313  ring RingNF=char(basering),(x,y,z),(c,ds);
2314  poly f;
2315  map Conv=ring_top,maxideal(1);
2316  v = Singularitaet(typ, k, r, s, Conv(a1), Conv(a2), Conv(a4), Conv(a4));
2317  f, crk = v[1..2];
2318  debug_log(2, "Info=", f );
2319  setring ring_top;
2320  if(defined(Phi) != 0 ) { kill Phi; }
2321  map Phi=RingNF,maxideal(1);
2322
2323  ret = Phi(f), crk;
2324  return(ret);
2325}
2326example
2327{ "EXAMPLE"; echo=2;
2328  ring r=0,(x,y,z),(c,ds);
2329  init_debug(0);
2330  singularity("E[6k]",6);
2331  singularity("T[k,r,s]", 3, 7, 5);
2332  poly f=y;
2333  singularity("J[k,r]", 4, 0, 0, f);
2334}
2335
2336///////////////////////////////////////////////////////////////////////////////
2337static
2338proc Singularitaet (string typ,int k,int r,int s,poly a,poly b,poly c,poly d)
2339{
2340  list   v; 
2341  string DBMPATH=system("getenv","DBMPATH");
2342  string DatabasePath, Database, S, Text, Tp;
2343  poly   f, f1;
2344  int    crk, Mu, ret;
2345  intvec MlnCd;
2346
2347  if( DBMPATH != "" ) { DatabasePath = DBMPATH+"/NFlist"; }
2348  else { DatabasePath = "NFlist"; }
2349  Database="DBM: ",DatabasePath;
2350
2351  link dbmLink=Database;
2352  debug_log(2, "Opening Singalarity-database: ", newline, Database);
2353  Tp = read(dbmLink, typ);
2354  debug_log(2,"DBMread(", typ, ")=", Tp, ".");
2355  if( Tp != "(null)" && Tp !="" ) {
2356    string Key = "I_", typ;
2357    S = "f = ", Tp, ";";
2358    debug_log(2,"S=", S, " Tp=", Tp, "Key=", Key);
2359    execute S;
2360    execute read(dbmLink, Key)+";";
2361    debug_log(1, "Polynom f=", f,  "  crk=", crk, "  Mu=", Mu,
2362                " MlnCd=", MlnCd);
2363    v = f, crk, Mu, MlnCd;
2364  }
2365  else {
2366    v = 0, 0, 0, 0;
2367  }
2368  close(dbmLink);
2369  return(v);
2370}
2371
2372///////////////////////////////////////////////////////////////////////////////
2373proc RandomPolyK (int M, string Typ)
2374USAGE:    RandomPolyK(M, Typ)
2375{
2376//---------------------------- initialisation ---------------------------------
2377  int    n, b, i, k, r, s, crk;
2378  ideal  B;
2379  map    Phi;
2380  string txt, Tp;
2381  list   v;
2382
2383  def ring_ext=basering;
2384  n=4;
2385  if(M<5) { M = 5; }
2386
2387  k = random(1, M);
2388  r = random(-5, 2*M);
2389  s = random(-5, 2*M);
2390  if(r<0) { r = 0; }
2391  if(s<0) { s = 0; }
2392
2393  ring RgAnf=char(basering),(x,y,z,t),(c,ds);
2394  poly f;
2395
2396  v = singularity(Typ, k, r, s);
2397  f, crk = v[1..2];
2398//  f = f +t2;
2399  if(crk==1) { f = f + y2 + z2; }
2400  if(crk==2) { f = f + z2; }
2401  txt="RandomPoly-Series: gewaehlt fall `"+Typ+"' mit";
2402  txt=txt+" f="+string(f);
2403  txt;
2404  setring ring_ext;
2405  B = maxideal(1);
2406
2407  r=1;
2408  for(i=n; i>0; i--,r++) {
2409//  for(i=1; i<=n; i=i+1)
2410    B[rvar(x(r))] = x(i);
2411    if(i>2 && random(1,10)<3) { B[rvar(x(r))] = B[rvar(x(r))] + x(i-1); }
2412//    if(i==1 && random(1,10)<4) { B[rvar(x(r))] = B[rvar(x(r))]- x(n); }
2413    if(i>0) {
2414      for(b=3; b<5; b=b+1) {
2415        // B[rvar(x(r))] = B[rvar(x(r))] + random(0,9) * x(i)^(b+2);
2416        if(random(1,20)<3) {
2417          B[rvar(x(r))] = B[rvar(x(r))] - random(-2,2)*x(b)^2;
2418        }
2419      }
2420    }
2421  }
2422  Phi=RgAnf, B;
2423  Phi;
2424  poly fr=Phi(f);
2425  fr = fr+(x(1)+x(2))^2;
2426//  return(Phi(f));
2427  return(fr);
2428}
2429
2430///////////////////////////////////////////////////////////////////////////////
2431proc debug_log (int level, list #)
2432USAGE:    debug_log(level,li); level=int, li=comma separated "message" list
2433COMPUTE:  print "messages" if level>=@DeBug.
2434          useful for user-defined trace messages.
2435EXAMPLE:  example debug_log; shows an example
2436SEE ALSO: init_debug();
2437{
2438   int len = size(#);
2439//   int printresult = printlevel - level +1;
2440//   if(level>1) {
2441//     dbprint(printresult, "Debug:("+ string(level)+ "): ", #[2..len]);
2442//   }
2443//   else { dbprint(printresult, #[1..len]); }
2444   if( defined(@DeBug) == 0 ) { init_debug(); }
2445   if(@DeBug>=level) {
2446      if(level>1) { "Debug:("+ string(level)+ "): ", #[1..len]; }
2447      else { #[1..len]; }
2448   }
2449}
2450example
2451{ "EXAMPLE:"; echo=2;
2452  example init_debug;
2453}
2454
2455///////////////////////////////////////////////////////////////////////////////
2456proc init_debug(list #)
2457USAGE:    init_debug([level]);  level=int
2458COMPUTE:  Set the global variable @DeBug to level. The variable @DeBug is
2459          used by the function debug_log(level, list of strings) to know
2460          when to print the list of strings. init_debug() reports only
2461          changes of @DeBug.
2462NOTE:     The procedure init_debug(n); is usefull as trace-mode. n may
2463          range from 0 to 10, higher values of n give more information.
2464EXAMPLE:  example init_debug; shows an example
2465{
2466  int newDebug=0;
2467  if( defined(@DeBug) != 0 ) { newDebug = @DeBug; }
2468
2469  if( size(#) > 0 ) {
2470    newDebug=#[1];
2471  }
2472  else {
2473    string s=system("getenv", "SG_DEBUG");
2474    if( s != "" && defined(@DeBug)==0) {
2475      s="newDebug="+s;
2476      execute s;
2477    }
2478  }
2479  if( defined(@DeBug) == 0) {
2480    int @DeBug = newDebug;
2481    export @DeBug;
2482    if(@DeBug>0) { "Debugging level is set to ", @DeBug; }
2483  }
2484  else {
2485    if( (size(#) == 0) && (newDebug < @DeBug) ) { return(); }
2486    if( @DeBug != newDebug) {
2487      int oldDebug = @DeBug;
2488      @DeBug = newDebug;
2489      if(@DeBug>0) { "Debugging level change from ", oldDebug, " to ",@DeBug; }
2490      else {
2491        if( @DeBug==0 && oldDebug>0 ) { "Debugging switched off."; }
2492      }
2493    }
2494  }
2495  printlevel = @DeBug;
2496}
2497example
2498{ "EXAMPLE:"; echo=2;
2499  init_debug();
2500  debug_log(1,"no trace information printed");
2501  init_debug(1);
2502  debug_log(1,"some trace information");
2503  init_debug(2);
2504  debug_log(2,"nice for debugging scripts");
2505  init_debug(0);
2506}
2507
2508///////////////////////////////////////////////////////////////////////////////
2509proc basicinvariants(poly f)
2510USAGE:    basicinvariants(f);   f = poly
2511COMPUTE:  Compute basic invariants of f: an upper bound d for the
2512          determinacy, the milnor number mu and the corank c of f
2513RETURN:   intvec: d, mu, c
2514EXAMPLE:  example basicinvariants; shows an example
2515{
2516  intvec v;
2517  ideal Jfs = std(jacob(f));
2518  v[1] = system("HC")+1;
2519  v[2] = vdim(Jfs);
2520  v[3] = corank(f);
2521  if( v[2]<v[1] ) { v[1] = v[2]+1; }
2522  return(v);
2523}
2524example
2525{ "EXAMPLE:"; echo=2;
2526   ring r=0,(x,y,z),ds;
2527   basicinvariants((x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3);
2528}
2529
2530///////////////////////////////////////////////////////////////////////////////
2531proc corank(poly f)
2532USAGE:    corank(f);   f=poly
2533RETURN:   the corank of the Hessian matrix of f, of type int
2534REMARK:   corank(f) is the number of variables occuring in the residual
2535          singulartity after applying 'morsesplit' to f
2536EXAMPLE:  example corank; shows an example
2537{
2538  matrix M = jacob(jacob(jet(f,2)));
2539  int cr = nvars(basering) - size(module(transpose(bareiss(M))));
2540  return(cr);
2541}
2542example
2543{ "EXAMPLE:"; echo=2;
2544  ring r=0,(x,y,z),ds;
2545  poly f=(x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3;
2546  corank(f);
2547}
2548///////////////////////////////////////////////////////////////////////////////
2549static
2550proc Faktorisiere(poly f, poly fk, int pt, int k, intvec RFlg)
2551{
2552//---------------------------- initialisation ---------------------------------
2553  poly   a, b, Relation;
2554  ideal  B, Jfsyz;
2555  map    PhiG, VERT;
2556  matrix Mat;
2557  list   v;
2558  def    ring_top=basering;
2559
2560  // Ziel: bestimme a,b sodass  fk = (ax+by^k)^pt gilt.
2561  B    = maxideal(1);
2562  PhiG = ring_top,B;
2563  debug_log(2, "Faktor: f=",Show(f)," Jet=",Show(fk)," k=",k," exp=",pt);
2564
2565//----------------------- compute role of x and y -----------------------------
2566  Jfsyz = fk, diff(fk, x(1));
2567  Mat   = matrix(syz(Jfsyz));
2568  if( (fk-subst(fk,x(1),0)) != 0  &&  (fk-subst(fk,x(2),0)) != 0 ) {
2569    // Wenn k>0 ist die Wahl fuer x & y bereits getroffen
2570    // sonst bestimmen x und y
2571    Jfsyz    = fk, diff(fk, x(1));
2572    Mat      = matrix(syz(Jfsyz));
2573    Relation = -pt * Mat[2,1] / Mat[1,1];
2574    a = Coeff(Relation, x(1), x(1));
2575    b = Coeff(Relation, x(2), x(2)^k);
2576    B = maxideal(1);
2577    if( (RFlg[1]==1 && k==1) || k>1) { B[rvar(x(1))] = x(1)-b*x(2)^k; }
2578    else { B[rvar(x(2))] = x(2)-b*x(1)^k; }
2579    VERT = basering,B;
2580    f    = VERT(f);
2581    PhiG = VERT(PhiG);
2582  }
2583
2584//------------------- permutation of x and y, if needed -----------------------
2585  if( k==1 ) {
2586    debug_log(2, "Fak-7:",Show(f)," jet=",Show(fk));
2587    if(Coeff(jet(f, pt), x(1), x(1)^pt) == 0) {
2588      VERT = basering,x(2),x(1);
2589      f    = VERT(f);
2590      PhiG = VERT(PhiG);
2591    }
2592  }
2593  debug_log(2, "Fak-8:",Show(f)," jet=",Show(fk));
2594  debug_log(6, "Faktorisiere liefert: f=", Show(f));
2595  v[1] = f;
2596  v[2] = PhiG;
2597  return(v);
2598}
2599
2600///////////////////////////////////////////////////////////////////////////////
2601static
2602proc Teile(poly f, poly fk)
2603{
2604  ideal  Jfsyz = f, fk;
2605  poly   Relation;
2606  matrix Mat = matrix(syz(Jfsyz));
2607  Relation   = -1 * Mat[2,1]/Mat[1,1];
2608  return(Relation);
2609}
2610
2611///////////////////////////////////////////////////////////////////////////////
2612static
2613proc GetRf (poly fi, int n)
2614USAGE:    GetRf();
2615{
2616//---------------------------- initialisation ---------------------------------
2617  int    j, k, l1, l1w;
2618  matrix Koef;
2619  intvec RFlg;
2620
2621  RFlg[n] = 0;
2622  intvec Haeufigkeit = RFlg;
2623
2624  for( j=1; j<=n ; j=j+1) {
2625    Koef = coef(fi, x(j));
2626    Haeufigkeit[j] = ncols(Koef);
2627    if(Coeff(fi, x(j),0) == 0) { Haeufigkeit[j] = Haeufigkeit[j] + 1;}
2628  }
2629  for( j=n; j>0 ; j=j-1) {
2630    l1  = 0;
2631    l1w = 0;
2632    for(k=1;k<=n;k=k+1) { if(Haeufigkeit[k]>l1w) { l1=k; l1w=Haeufigkeit[k];}}
2633    RFlg[j]        = l1;
2634    Haeufigkeit[l1] = 0;
2635  }
2636  debug_log(2, "Reihenfolge fuer Vertauschungen:", RFlg);
2637  return(RFlg);
2638}
2639
2640///////////////////////////////////////////////////////////////////////////////
2641static
2642proc Show(poly g)
2643{
2644  string s;
2645  def ring_save=basering;
2646
2647  execute @ringdisplay;
2648  map showpoly=ring_save,maxideal(1);
2649  s = string(showpoly(g));
2650  setring ring_save;
2651  return (s);
2652}
2653
2654///////////////////////////////////////////////////////////////////////////////
2655static
2656proc checkring
2657{
2658  int CH = char(basering);
2659  if(CH >= 2 && CH<=13) {
2660    "Ring has characteristic ",CH;
2661    "Characteristic other than 0 or 0<char<13 is not yet implemented";
2662    return(1);
2663  }
2664  return(0);  // characteristic of ring is OK, return (0)
2665}
2666
2667///////////////////////////////////////////////////////////////////////////////
2668static
2669proc DecodeNormalFormString (string S_in)
2670USAGE:    DecodeNormalFormString
2671{
2672//---------------------------- initialisation ---------------------------------
2673  int    C_eq, a, b, i, t, k, r, s;
2674  string s1, s2, s3, s4, s_in, Typ;
2675  list v = "Error", 0, 0, 0;
2676
2677  C_eq = find(S_in, "=")+1;
2678  s_in = S_in[C_eq,30];
2679  debug_log(2, "Decode:");
2680
2681  debug_log(2, "S_in=", S_in,"  s_in=",s_in );
2682  a = find(s_in, "[")+1;
2683  b = find(s_in, "]")-1;
2684  t = 1;
2685  k = 0;
2686  r = 0;
2687  s = 0;
2688
2689  if(a<0 || b<0) { return(v); }
2690  Typ = s_in[1..a-1];
2691  s1  = s_in[a..b];
2692  debug_log(6, "Suche Type:", Typ);
2693  //---------------------- decode between brackets ----------------------------
2694  if( find(s1, ",") == 0) {
2695    debug_log(8, "  Number of columns: 0");
2696    s2 = "k = "+s1+";";
2697    execute s2;
2698    if( (Typ=="A[") || (Typ=="D[") ) { s3 = "k"; }
2699    if( Typ == "E[") { t = 6; }
2700    if( Typ == "W[") { t = 12; }
2701    if( Typ == "Q[") { t = 6; }
2702    if( Typ == "Z[") { t = 6; }
2703    if( Typ == "U[") { t = 12; }
2704    if( t > 1 ) {
2705      i = k;
2706      k = k/t;
2707      b = i - t*k;
2708      if( (s1 == "Q[") && (b==0) ) { k=k-1; b=6; }
2709      if(Typ == "Z[") {
2710        if(b==0) { k=k-1; b=6; }
2711        if(b==1) { k=k-1; b=7; }
2712      }
2713      if( b == 0 ) { s3 = string(t)+"k"; }
2714      else { s3 = string(t)+"k+"+string(b); }
2715    }
2716    if( Typ == "S[") {
2717      i = k+1;
2718      k = i/12;
2719      b = i - 12*k;
2720      if( b == 1 ) { s3 = "k"; }
2721      else {
2722        if(b==0) { s3 = "12k"+string(b-1); }
2723        else { s3 = "12k+"+string(b-1); }
2724      }
2725    }
2726    s2 = Typ + s3 +"]";
2727  }  // es kommt mindestens ein komma vor...
2728  //----------------------- more than 1 paramater -----------------------------
2729  else {
2730    b  = find(s1, ",");
2731    s2 = "k = ",s1[1..b-1],";";
2732    execute s2;
2733    s1 = s1[b+1..size(s1)];
2734    if(find(s1, ",") == 0) {
2735      debug_log(8, "  Number of columns 1");
2736      s2 = "r = "+s1+";";
2737      execute s2;
2738      s4 = "r";
2739      s3 = "k";
2740      if(r==0) { s4 = string(0); }
2741      if(k==0 && Typ=="Z[") { s3 = string(1); }
2742      if(Typ[2] == "#") {
2743        i = r+1;
2744        r = i/2;
2745        b = i - 2*r;
2746        if( b == 1 ) { s4 = "2r"; }
2747        else { s4 = "2r-1"; }
2748      }
2749      s2 = Typ + s3 + "," + s4 +"]";
2750    }  // es kommt mindestens zwei komma vor...
2751    //----------------------- get third parameter -----------------------------
2752    else {
2753      debug_log(8, "  Number of columns >=2");
2754      debug_log(2, "Y[k,r,s] / Z[k,r,s] / T[k,r,s]");
2755      b  = find(s1, ",");
2756      s2 = "r = ",s1[1..b-1],";";
2757      execute s2;
2758      s2 = "s = ",s1[b+1..size(s1)],";";
2759      execute s2;
2760      if(Typ=="Y[") { s2 = "Y[k,r,s]"; }
2761      if(Typ=="Z[") { s2 = "Z[k,r,s]"; }
2762      if(Typ=="T[") { s2 = "T[k,r,s]"; }
2763    }
2764  }
2765  debug_log(2, "Looking for Normalform of ",s2,"with (k,r,s) = (",
2766        k,",",r,",", s, ")" );
2767  v = s2, k, r, s;
2768  return(v);
2769}
2770
2771///////////////////////////////////////////////////////////////////////////////
2772proc A_L
2773USAGE:    A_L(f);         f=poly
2774          A_L("name");    type=string
2775COMPUTE:  the normal form in Arnold's list of the singularity given either
2776          by a polynomial f or by its name.
2777RETURN:   A_L(f): compute via 'milnorcode' the class of f and
2778          return the normal form of f found in the database.
2779          A_L("name"): Get the normal form from the database for
2780          the singularity given by its name.
2781EXAMPLE:  example A_L; shows an example
2782{
2783  // if trace/debug mode not set, do it!
2784  init_debug();
2785
2786  if( typeof(#[1]) == "string" ) {
2787    if(checkring()) { return(#[1]); }
2788    return(normalform(#[1]));
2789  }
2790  if( typeof(#[1]) == "poly" ) {
2791    if(checkring()) { return(#[1]); }
2792    return(quickclass(#[1]));
2793  }
2794 
2795}
2796example
2797{ "EXAMPLE:"; echo=2;
2798  ring r=0,(a,b,c),ds; 
2799  poly f=A_L("E[13]");
2800  f;
2801  A_L(f);
2802}
2803
2804///////////////////////////////////////////////////////////////////////////////
2805proc normalform(string s_in)
2806USAGE:    normalform(s);  s=string
2807RETURN:   Arnold's normal form of singularity with name s
2808EXAMPLE:  example normalform; shows an example.
2809{
2810  string Typ;
2811  int    k, r, s, crk;
2812  poly   f;
2813  list   v;
2814
2815  if(checkring()) { return(s_in); }
2816  if(nvars(basering)<=1) {
2817    "We need at least 2 variables in basering, you have",nvars(basering),".";
2818    return();
2819  }
2820  // if trace/debug mode not set, do it!
2821  init_debug();
2822
2823  v = DecodeNormalFormString(s_in);
2824  Typ, k, r, s = v[1..4];
2825  if(Typ=="Error") { return(0); }
2826  v = singularity(Typ, k, r, s);
2827  f, crk = v[1..2];
2828  return(f);
2829}
2830example
2831{ "EXAMPLE:"; echo=2;
2832  ring r=0,(a,b,c),ds; 
2833  normalform("E[13]");
2834}
2835
2836///////////////////////////////////////////////////////////////////////////////
2837proc swap
2838USAGE:    swap(a,b);
2839RETURN:   b,a if b,a is the input (any type)
2840{
2841  return(#[2],#[1]);
2842}
2843example
2844{ "EXAMPLE:"; echo=2;
2845  swap("variable1","variable2");
2846}
2847
2848///////////////////////////////////////////////////////////////////////////////
2849proc Setring(int c, string name)
2850USAGE:   
2851{
2852  string s="ring "+name+"=0,(x(1.."+ string(c) +")),(c,ds);";
2853  return(s);
2854}
2855
2856///////////////////////////////////////////////////////////////////////////////
2857proc internalfunctions
2858USAGE:   internalfunctions();
2859RETURN:  nothing, display names of internal procedures of classify.lib
2860EXAMPLE: no example
2861{ "   Internal functions for the classification using Arnold's method,";
2862 "   the function numbers correspond to numbers in Arnold's classifier:";
2863 "Klassifiziere(poly f);             determine the type of the singularity f
2864  Funktion1bis (poly f, list cstn)
2865  Funktion3 (poly f, list cstn)
2866  Funktion6 (poly f, list cstn)
2867  Funktion13 (poly f, list cstn)
2868  Funktion17 (poly f, list cstn)
2869  Funktion25 (poly f, list cstn)
2870  Funktion40 (poly f, list cstn, int k)
2871  Funktion47 (poly f, list cstn)
2872  Funktion50 (poly f, list cstn)
2873  Funktion58 (poly fin, list cstn)
2874  Funktion59 (poly f, list cstn)
2875  Funktion66 (poly f, list cstn)
2876  Funktion82 (poly f, list cstn)
2877  Funktion83 (poly f, list cstn)
2878  Funktion91 (poly f, list cstn, int k)
2879  Funktion92 (poly f, list cstn, int k)
2880  Funktion93 (poly f, list cstn, int k)
2881  Funktion94 (poly f, list cstn, int k)
2882  Funktion95 (poly f, list cstn, int k)
2883  Funktion96 (poly f, list cstn, int k)
2884  Funktion97 (poly f, list cstn)
2885  Isomorphie_s82_x (poly f, poly fk, int k)
2886  Isomorphie_s82_z (poly f, poly fk, int k)
2887  Isomorphie_s17 (poly f, poly fk, int k, int ct)
2888  printresult (string f, string typ, int Mu, int m, int corank, int K)
2889  ";
2890  "   Internal functions for the classifcation by invariants:
2891  Cubic (poly f)
2892  parity (int e)               return the parity of e
2893  HKclass (intvec i)
2894  HKclass3( intvec i, string SG_Typ, int cnt)
2895  HKclass3_teil_1 (intvec i, string SG_Typ, int cnt)
2896  HKclass5 (intvec i, string SG_Typ, int cnt)
2897  HKclass5_teil_1 (intvec i, string SG_Typ, int cnt)
2898  HKclass5_teil_2 (intvec i, string SG_Typ, int cnt)
2899  HKclass7 (intvec i, string SG_Typ, int cnt)
2900  HKclass7_teil_1 (intvec i, string SG_Typ, int cnt)
2901  ";
2902  "   Internal functions for the Morse-splitting lemma:
2903  Morse(poly fi, int K, int corank)          Splittinglemma itself
2904  Coeffs (list #)
2905  Coeff
2906  ";
2907  "   Internal functions providing tools:
2908  ReOrder(poly f)
2909  Singularitaet (string typ,int k,int r,int s,poly a,poly b,poly c,poly d)
2910  RandomPolyK
2911  Faktorisiere(poly f, poly g, int p, int k)     compute g = (ax+by^k)^p
2912  Teile(poly f, poly g);                  Teilt f durch g.
2913  GetRf(poly f, int n);
2914  Show(poly f);
2915  checkring();
2916  DecodeNormalFormString(string s);
2917  Setring(int n, string ringname);
2918  ";
2919}
2920///////////////////////////////////////////////////////////////////////////////
2921// E n d   O f   F i l e
Note: See TracBrowser for help on using the repository browser.