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

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