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

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