source: git/Singular/LIB/classify.lib @ 4ac997

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