source: git/Singular/LIB/equising.lib @ d208704

spielwiese
Last change on this file since d208704 was 5d9ec3, checked in by Christoph Lossen <lossen@…>, 23 years ago
* lossen: info-string changed (so that procedures included in Manual) git-svn-id: file:///usr/local/Singular/svn/trunk@5145 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 28.1 KB
Line 
1version="$Id: equising.lib,v 1.6 2001-01-31 15:36:02 lossen Exp $";
2category="Singularities";
3info="
4LIBRARY:  equising.lib  Equisingularity Stratum of a Family of Plane Curves
5AUTHOR:   Andrea Mindnich, mindnich@mathematik.uni-kl.de
6
7PROCEDURES:
8 esStratum(F[,m]);   computes the equisingularity stratum of a deformation
9 isEquising(F[,m]);  tests, whether a given deformation is equisingular
10";
11
12LIB "poly.lib";
13LIB "elim.lib";
14LIB "hnoether.lib";
15///////////////////////////////////////////////////////////////////////////////
16// COMPUTES  a weight vector. x and y get weight 1 and all other
17//           variables get weight 0.
18static proc xyVector()
19{
20  intvec iv ;
21  iv[nvars(basering)]=0 ;
22  iv[rvar(x)] =1;
23  iv[rvar(y)] =1;
24  return (iv);
25}
26///////////////////////////////////////////////////////////////////////////////
27// exchanges the variables x and y in the polynomial p_f
28static proc swapXY(poly f)
29{
30  def r_base = basering;
31  ideal MI = maxideal(1);
32  MI[rvar(x)]=y;
33  MI[rvar(y)]=x;
34  map phi = r_base, MI;
35  f=phi(f);
36  return (f);
37}
38///////////////////////////////////////////////////////////////////////////////
39// ASSUME:   p_mon is a monomial
40//            and p_g is the product of the variables in p_mon.
41// COMPUTES the coefficient of p_mon in p_h.
42static proc coefficient(poly p_h, poly p_mon, poly p_g)
43{
44  matrix coefMatrix = coef(p_h,p_g);
45  int nc = ncols(coefMatrix);
46  int ii=1;
47  poly p_c=0;
48  while(ii<=nc)
49  {
50    if (coefMatrix[1,ii] == p_mon)
51    {
52      p_c = coefMatrix[2,ii];
53      break;
54    }
55    ii++;
56  }
57  return (p_c);
58}
59///////////////////////////////////////////////////////////////////////////////
60// in p_F the variable p_vari is substituted by the polynomial p_g.
61static proc eSubst(poly p_F, poly p_vari, poly p_g)
62{
63  def r_base = basering;
64  ideal MI;
65  map phi;
66  int ii = rvar(p_vari);
67  if (ii != 0)
68  {
69    MI = maxideal(1);
70    MI[ii] = p_g;
71    phi = r_base, MI;
72    p_F = phi(p_F);
73  }
74  return (p_F);
75}
76///////////////////////////////////////////////////////////////////////////////
77// All ring variables of p_F which occur in (the set of generators of) the
78// ideal  Id, are substituted by 0
79static proc SimplifyF(poly p_F, ideal Id)
80{
81  int i=1;
82  int si = size(Id);
83  for (i=1; i <= si; i++)
84  {
85    if (rvar(Id[i]))
86    {
87      p_F = subst(p_F, Id[i], 0);
88    }
89  }
90  return(p_F);
91}
92
93
94///////////////////////////////////////////////////////////////////////////////
95
96
97// Checks, if the basering is admissible.
98static proc checkBasering ()
99{
100  int error = 0;
101  if(find(charstr(basering),"real"))
102  {
103    ERROR ("cannot compute esStratum with 'real' as coefficient field");
104  }
105  if (nvars(basering) <= 2)
106  {
107   ERROR ("there are to less ringvariables to compute esStratum")
108  }
109  error = checkQIdeal(ideal(basering));
110  return(error);
111}
112///////////////////////////////////////////////////////////////////////////////
113static  proc getInput (list #)
114{
115  def r_base = basering;
116
117  int maxStep = -1;
118
119  if (size(#) >= 1)
120  {
121    if (typeof(#[1]) == "int")
122    {
123      maxStep = #[1];
124    }
125
126    else
127    {
128      ERROR("expected esStratum('poly', 'int') ");
129    }
130  }
131
132  return(maxStep);
133}
134//////////////////////////////////////////////////////////////////////////////
135// RETURNS: 0, if the ideal cond only depends on the deformation parameters
136//          1, otherwise.
137static proc checkQIdeal (ideal cond)
138{
139  def r_base = basering;
140
141  int i_print = printlevel-voice + 4;
142  int i_nvars = nvars(basering);
143
144  ideal id_help = subst(cond,var(i_nvars),0,var(i_nvars-1),0) - cond;
145
146  // cond depends only on the first i_nvars-2 variables <=>
147  //  id_help == <0>
148  if ( simplify(id_help, 2) != 0)
149  {
150    dbprint(i_print,
151    "ideal(basering) must only depend on the deformation parameters");
152    return(1);
153  }
154
155  return(0);
156}
157
158
159///////////////////////////////////////////////////////////////////////////////
160// COMPUTES string(minpoly) and substitutes the parameter by newParName
161static proc makeMinPolyString (string newParName)
162{
163  int i;
164  string parName = parstr(basering);
165  int parNameSize = size(parName);
166
167  string oldMinPolyStr = string (minpoly);
168  int minPolySize = size(oldMinPolyStr);
169
170  string newMinPolyStr = "";
171
172  for (i=1;i <= minPolySize; i++)
173  {
174    if (oldMinPolyStr[i,parNameSize] == parName)
175    {
176      newMinPolyStr = newMinPolyStr + newParName;
177      i = i + parNameSize-1;
178    }
179    else
180    {
181      newMinPolyStr = newMinPolyStr + oldMinPolyStr[i];
182    }
183  }
184
185  return(newMinPolyStr);
186}
187
188
189///////////////////////////////////////////////////////////////////////////////
190// Defines a new ring without deformation-parameters.
191static proc createHNERing()
192{
193  string str;
194  string minpolyStr = string(minpoly);
195
196  str = " ring HNERing = (" + charstr(basering) + "), (x,y), ls;";
197  execute (str);
198
199  str = "minpoly ="+ minpolyStr+";";
200  execute(str);
201
202  keepring(HNERing);
203}
204///////////////////////////////////////////////////////////////////////////////
205// RETURNS: 1, if p_f = 0 or char(basering) divides the order of p_f
206//             or p_f is not squarefree.
207//          0, otherwise
208static proc checkPoly (poly p_f)
209{
210  int i_print = printlevel - voice + 3;
211  int i_ord;
212
213  if (p_f == 0)
214  {
215    dbprint(i_print,"The Input is a 'deformation'  of the zero polynomial");
216    return(1);
217  }
218
219  i_ord = mindeg1(p_f);
220
221  if (number(i_ord) == 0)
222  {
223    dbprint(i_print,
224            "The characteristic of the coefficient field
225             divides the order of the equation");
226    return(1);
227  }
228
229  if (squarefree(p_f) != p_f)
230  {
231    dbprint(i_print, "The curve is reducible");
232    return(1);
233  }
234
235  return(0);
236}
237///////////////////////////////////////////////////////////////////////////////
238// COMPUTES  the multiplicity sequence of p_f
239static proc calcMultSequence (poly p_f)
240{
241  int i_print = printlevel-voice + 3;
242  intvec multSeq=0;
243  list hneList;
244  int xNotTransversal;
245  int fIrreducible = 1;
246
247  // if basering =  (p,a) or (p,a(1..s)),
248  //            p prime, a algebraic, a(1..s) transcendent use reddevelop
249  // otherwise use develop
250  if (char(basering) != 0
251      && npars(basering) !=0
252      && charstr(basering) == string(char(basering)) + "," + parstr(basering))
253  {
254    hneList = reddevelop(p_f, -1);
255    if ( size(hneList)>=2)
256    {
257      fIrreducible = 0;
258      dbprint(i_print, "The curve is reducible");
259      return(multSeq, xNotTransversal, fIrreducible);
260    }
261
262    hneList = hneList[1];
263
264    xNotTransversal= hneList[3];
265  }
266  else
267  {
268    hneList = develop(p_f, -1);
269
270    xNotTransversal= hneList[3];
271    fIrreducible = hneList[5];
272  }
273
274  if ( ! fIrreducible)
275  {
276    dbprint(i_print, "The curve is reducible");
277    return(multSeq, xNotTransversal, fIrreducible);
278  }
279
280  multSeq = multsequence (hneList);
281  return(multSeq, xNotTransversal, fIrreducible);
282}
283///////////////////////////////////////////////////////////////////////////////
284// ASSUME:  The basering is no qring and has at least 3 variables
285// DEFINES: A new basering, "myRing",
286//          with new names for the parameters and variables.
287//          The new names for the parameters are a(1..k),
288//          and t(1..s),x,y for the variables
289//          The ring ordering is ordStr.
290// NOTE:    This proc uses 'execute'.
291static proc createMyRing(poly p_F, string ordStr )
292{
293  def r_old = basering;
294
295  int chara = char(basering);
296  string charaStr;
297  int i;
298  string minPolyStr = "";
299  string helpStr;
300  int nDefParams = nvars(r_old)-2;
301
302
303  ideal qIdeal = ideal(basering);
304
305  if (npars(basering) == 0)
306  {
307    helpStr = "ring myRing ="
308              + string(chara)+ ", (t(1..nDefParams), x, y),"+ ordStr +";";
309    execute(helpStr);
310  }
311
312  else
313  {
314    charaStr = charstr(basering);
315    if (charaStr == string(chara) + "," + parstr(basering))
316    {
317      if (minpoly !=0)
318      {
319        minPolyStr = makeMinPolyString("a");
320
321        helpStr = "ring myRing =
322                 (" + string(chara) + ",a),
323                 (t(1..nDefParams), x, y)," + ordStr + ";";
324        execute(helpStr);
325
326        helpStr = "minpoly =" + minPolyStr + ";";
327        execute (helpStr);
328      }
329      else
330      {
331        helpStr = "ring myRing =
332                  (" + string(chara) + ",a(1..npars(basering)) ),
333                  (t(1..nDefParams), x, y)," + ordStr + ";";
334        execute(helpStr);
335      }
336    }
337    else
338    {
339      i = find (charaStr,",");
340
341      helpStr = " ring myRing =
342              (" + charaStr[1,i] + "a),
343              (t(1..nDefParams), x, y)," + ordStr + ";";
344
345      execute (helpStr);
346    }
347  }
348
349  ideal qIdeal = fetch(r_old, qIdeal);
350
351  if(qIdeal != 0)
352  {
353    def r_base = basering;
354    kill myRing;
355    qring myRing = std(qIdeal);
356  }
357
358  poly p_F = fetch(r_old, p_F);
359  ideal ES;
360
361  keepring(myRing);
362}
363
364///////////////////////////////////////////////////////////////////////////////
365/////////// procedures to compute the equisingularity stratum /////////////////
366///////////////////////////////////////////////////////////////////////////////
367// DEFINES a new basering, myRing,  which has one variable
368//         more than the old ring.
369//         The name for the new variable is "H(nhelpV)".
370//         p_F and ES are "imaped" into the new ring.
371static proc extendRing (poly p_F,  ideal ES, int nHelpV, ideal HCond)
372{
373  def r_old = basering;
374
375  string helpStr;
376  string minPolyStr = "";
377
378  ideal qIdeal = ideal(basering);
379
380  if (minpoly != 0)
381  {
382    if (charstr(basering) == string(char(basering)) + "," + parstr(basering))
383    {
384      minPolyStr = string(minpoly);
385    }
386  }
387
388  string str =
389 "ring myRing = (" + charstr(r_old) + "),
390                (H(" + string(nHelpV)+ ")," + string(maxideal(1)) + "),
391                (dp(" + string(nHelpV) + "),dp);";
392  execute (str);
393
394  if (minPolyStr != "")
395  {
396    helpStr = "minpoly =" + minPolyStr + ";";
397    execute(helpStr);
398  }
399
400  ideal qIdeal = imap(r_old, qIdeal);
401  if(qIdeal != 0)
402  {
403    def r_base = basering;
404
405    kill myRing;
406
407    attrib(qIdeal,"isSB",1);
408    qring myRing = qIdeal;
409  }
410
411
412  poly p_F = imap(r_old, p_F);
413  ideal ES = imap(r_old, ES);
414  ideal HCond = imap(r_old, HCond);
415
416  keepring(myRing);
417}
418///////////////////////////////////////////////////////////////////////////////
419// COMPUTES an ideal equimultCond, such that F_(n-1) mod equimultCond =0,
420//          where F_(n-1) is the (nNew-1)-jet of p_F with respect to x,y.
421static proc calcEquimultCond(poly p_F, int nNew)
422{
423  ideal equimultCond = 0;
424  poly p_FnMinus1;
425  matrix coefMatrix;
426  int nc;
427  int ii = 1;
428
429  p_FnMinus1 = jet(p_F, nNew-1, xyVector());
430
431  coefMatrix = coef(p_FnMinus1, xy);
432
433  nc = ncols(coefMatrix);
434
435  for (ii=1; ii<=nc; ii++)
436  {
437    equimultCond[ii] = NF(coefMatrix[2,ii],std(0));
438  }
439
440  p_F = p_F - p_FnMinus1;
441  p_F = SimplifyF(p_F, equimultCond);
442
443  return(equimultCond, p_F);
444}
445///////////////////////////////////////////////////////////////////////////////
446// COMPUTES smallest integer >= nNew/nOld -1
447static proc calcNZeroSteps (int nOld,int nNew)
448{
449 int nZeroSteps;
450
451 if (nOld mod nNew == 0)
452 {
453   nZeroSteps = nOld div nNew -1;
454 }
455
456 else
457 {
458  nZeroSteps  = nOld div nNew;
459 }
460
461 return(nZeroSteps);
462}
463///////////////////////////////////////////////////////////////////////////////
464// ASSUME: ord_(X,Y)(F)=nNew
465// COMPUTES an ideal I such that (p_F mod I)_nNew  = p_c*y^nNew.
466static proc purePowerOfY (poly p_F, int nNew)
467{
468  ideal id_help = 0;
469  poly  p_Fn;
470  matrix coefMatrix;
471  int nc;
472  poly p_c;
473  int ii=1;
474
475  p_Fn = jet(p_F, nNew, xyVector());
476
477  coefMatrix = coef(p_Fn, xy);
478  nc = ncols(coefMatrix);
479
480  p_c = coefMatrix[2,nc];
481
482  for (ii=1; ii <= nc-1; ii++)
483  {
484    id_help[ii] = NF(coefMatrix[2,ii],std(0));
485  }
486
487  p_F = p_F - p_Fn + p_c*y^nNew;
488
489  p_F = SimplifyF(p_F, id_help);
490
491  return(id_help, p_F, p_c);
492}
493///////////////////////////////////////////////////////////////////////////////
494// ASSUME: ord_(X,Y)(F)=nNew
495// COMPUTES an ideal I such that p_Fn mod I = p_c*(y-p_a*x)^nNew,
496//          where p_Fn is the homogeneous part of p_F of order nNew.
497static proc purePowerOfLin (poly p_F, ideal HCond, int nNew, int nHelpV)
498{
499  ideal id_help = 0;
500  poly p_Fn;
501  matrix coefMatrix;
502  poly p_c;
503  poly p_ca;
504  poly p_help;
505  poly p_a;
506  int ii;
507  int jj;
508  int bico;
509
510  p_Fn = jet(p_F, nNew, xyVector());
511
512  coefMatrix = coeffs(subst(p_Fn,x,1),y);
513
514  p_c = coefMatrix[nNew+1,1];
515  p_ca = coefMatrix[nNew,1]/(-nNew);
516
517  if (npars(basering)==1 && charstr(basering) != string(char(basering)) + "," + parstr(basering))
518  {
519    p_a = H(nHelpV);
520    HCond = HCond + ideal(p_ca - p_a*p_c);
521  }
522  else
523  {
524    p_help = p_ca/p_c;
525    if (p_help * p_c == p_ca)
526    {
527      p_a = p_help;
528    }
529    else
530    {
531      p_a = H(nHelpV);
532      HCond = HCond + ideal(p_ca - p_a*p_c);
533    }
534  }
535
536  bico = (nNew*(nNew-1))/2;
537
538  for (ii = 2; ii <= nNew ; ii++)
539  {
540
541    if (coefMatrix[nNew+1-ii,1] == 0)
542    {
543      if (number(bico) != 0)
544      // Then a^i=0 since c is a unit
545      {
546        id_help = id_help + ideal(NF(p_a^(ii),std(0)));
547        for (jj = ii+1; jj <= nNew; jj++)
548        // the remaining coefficients (of y^(nnew-k)*x^k with k>i)
549        // are also zero.
550        {
551          id_help = id_help
552                    + ideal(NF(coefMatrix[nNew+1-jj,1],std(0)));
553        }
554        break;
555      }
556    }
557
558    else
559    {
560      id_help = id_help +
561            ideal(NF(coefMatrix[nNew+1-ii,1] - bico*p_c*(-p_a)^ii,std(0)));
562    }
563
564    bico = (bico*(nNew-ii))/(ii+1);
565  }
566
567  p_F = SimplifyF(p_F, id_help);
568
569  return(id_help, HCond, p_F, p_c, p_a);
570}
571///////////////////////////////////////////////////////////////////////////////
572// eliminates the variables H(1),..,H(nHelpV) from the ideal ES + HCond
573static proc helpVarElim(ideal ES, ideal HCond, int nHelpV)
574{
575  ES = ES + HCond;
576  ES = std(ES);
577  ES = nselect(ES,1,nHelpV);
578
579  return(ES);
580}
581///////////////////////////////////////////////////////////////////////////////
582// ASSUME:   ord(F)=nNew and p_c(y-p_a*x)^n is the nNew-jet of F with respect
583//           to X,Y
584// COMPUTES  F(x,yx+a*x)/x^n
585static proc formalBlowUp(poly p_F, poly p_c, poly p_a, int nNew)
586{
587
588  p_F = p_F - jet(p_F, nNew, xyVector());
589
590  if (p_a != 0)
591  {
592    p_F = eSubst(p_F, y , yx + p_a*x);
593  }
594  else
595  {
596    p_F = subst(p_F, y, xy);
597  }
598
599  p_F = p_F/(x^nNew);
600
601  p_F = p_F + p_c * y^nNew;
602
603  return (p_F);
604}
605///////////////////////////////////////////////////////////////////////////////
606// ASSUME:  p_F in K[t(1)..t(s),x,y]
607// COMPUTES the minimal ideal ES, such that the deformation p_F mod ES is
608//          equisingular.
609//          The computation is done up to iteration step 'maxstep'.
610// RETURNS: list l, such that
611//          l[1]=1 if some error has occured,
612//          l[1]=0 otherwise and then l[2] = es_cond.
613static proc calcEsCond(poly p_F, intvec multSeq, int maxStep)
614{
615  def r_old = basering;
616
617  ideal ES = 0;
618
619  int ii;
620  int step = 1;
621  int nNew = multSeq[step];
622  int nOld = nNew;
623  int nZeroSteps;
624  int nHelpV = 1;
625  ideal HCond = 0;
626  int maxDeg = 0;
627  int z = printlevel - voice + 3;
628  string str;
629
630  extendRing(p_F, ES, nHelpV, HCond);
631
632  poly p_c;
633  poly p_a;
634  ideal I;
635
636  for (ii = 1; ii <= size(multSeq); ii++)
637  {
638    maxDeg = maxDeg + multSeq[ii];
639  }
640
641  while (step <= maxStep)
642  {
643
644    nOld = nNew;
645    nNew = multSeq[step];
646
647    p_F = jet(p_F, maxDeg, xyVector());
648    maxDeg = maxDeg - nNew;
649
650    if (nNew<nOld)
651    //start a new line in the HNE of F
652    //               _            _
653    // for the next | nold/nnew -1 | iteration steps the coefficient 'a'
654    // in the leading form Fn = c(y-ax)^n should  be zero.
655    {
656      p_F = swapXY(p_F);
657      nZeroSteps = calcNZeroSteps (nOld, nNew);
658    }
659
660    I, p_F = calcEquimultCond (p_F, nNew);
661    ES = ES + I;
662
663    if (z>1)
664    {
665      "// conditions for equimultiplicity in step:", step;
666      I;
667      if (nHelpV >1)
668      {
669        str = string(nHelpV);
670        "// conditions for help variables H(1),..,H("+str+"):";
671        HCond;
672      }
673      pause("press <return> to continue");
674    }
675
676    if (nZeroSteps > 0)
677    {
678      nZeroSteps--;
679
680      // compute conditions, s.th. Fn = c*y^nnew ?
681      I, p_F, p_c = purePowerOfY (p_F, nNew);
682      ES = ES + I;
683
684      if (z>1)
685      {
686        "// conditions for pure power in step:", step;
687        I;
688        if (nHelpV > 1)
689        {
690          str = string(nHelpV);
691          "// conditions for help variables H(1),..,H("+str+"):";
692          HCond;
693        }
694        pause("press <return> to continue");
695      }
696      p_a =0;
697    }
698
699    else
700    {
701      I, HCond, p_F, p_c, p_a = purePowerOfLin (p_F, HCond, nNew, nHelpV);
702
703      ES = ES + I;
704
705      if (z>1)
706      {
707        "// conditions for pure power in step:", step;
708        I;
709        str = string(nHelpV);
710        "// conditions for help variables H(1),..,H("+str+"):";
711        HCond;
712        pause("press <return> to continue");
713      }
714    }
715
716    p_F = formalBlowUp (p_F, p_c, p_a, nNew);
717
718    if (p_a == H(nHelpV))
719    {
720      nHelpV++;
721
722      def r_base = basering;
723      kill myRing;
724
725      extendRing(p_F, ES, nHelpV, HCond);
726
727      kill r_base;
728
729      poly p_a;
730      poly p_c;
731      ideal I;
732    }
733    step++;
734  }
735  if (nHelpV > 1)
736  {
737    ES = helpVarElim(ES, HCond, nHelpV);
738  }
739
740  if (nameof(basering)=="myRing")
741  {
742    setring r_old;
743    ES = imap(myRing, ES);
744  }
745
746  return(ES);
747}
748
749///////////////////////////////////////////////////////////////////////////////
750//                           main procedure
751///////////////////////////////////////////////////////////////////////////////
752
753proc esStratum (poly p_F, list #)
754"USAGE:   esStratum(F[,m]); F a polynomial, m an integer
755ASSUME:  F defines a deformation of an irreducible bivariate polynomial f
756         and that char(basering) does not divide mult(f).
757         If nv is the number of variables of the basering, then the first nv-2
758         ringvariables are the deformation parameters.
759         If the basering is a qring, ideal(basering) must only depend
760         on the deformation parameters.
761RETURN:  A list l of an ideal and an integer, where
762         l[1] is the ideal in the deformation parameters, defining the
763         equisingularity stratum of F,
764         l[2] = 1 if some error has occured, l[2] = 0 otherwise.
765         If m is given, the computation stops after m steps of the iteration.
766NOTE:    printlevel > 0 displays comments and pauses after intermediate
767         computations (default: printlevel=0)
768         This proc uses 'execute' or calls a procedure using 'execute'.
769EXAMPLE: example esStratum; shows an example
770"
771{
772  def r_user = basering;
773
774  int ii = 1;
775  int i_nvars = nvars(basering);
776  int error = 0;
777  int xNotTransversal;
778  int fIrreducible;
779  int maxStep;
780  int userMaxStep;
781  ideal cond;
782  intvec multSeq;
783  ideal ES = 0;
784
785  error = checkBasering();
786  if (error)
787  {
788    return(list(ES,error));
789  }
790
791  userMaxStep = getInput(#);
792
793  // define a new basering "myRing" with new names for parameters
794  // and variables.
795  // The new names are 'a(1)', ..., 'a(npars)' for the parameters
796  // and 't(1)', ..., 't(nvars-2)', 'x', 'y' for the variables.
797  createMyRing(p_F, "dp");
798
799  // define a ring without deformation parameters, to compute the HNE
800  // of F mod <t_1,..,t_s>
801  createHNERing();
802
803  poly p_f = imap(myRing,p_F);
804
805  error = checkPoly(p_f);
806  if (error)
807  {
808    setring r_user;
809    return(list( ideal(0),error));
810  }
811
812  // compute the multiplicitysequence of p_f.
813  multSeq, xNotTransversal, fIrreducible = calcMultSequence(p_f);
814
815  if ( ! fIrreducible)
816  {
817    setring r_user;
818    return(list(ideal(0),1));
819  }
820
821  setring myRing;
822
823  if (xNotTransversal)
824  {
825    p_F = swapXY(p_F);
826  }
827
828  if (userMaxStep != -1 && userMaxStep <  size(multSeq)-1)
829  {
830    maxStep = userMaxStep;
831  }
832  else
833  {
834    maxStep = size(multSeq)-1;
835  }
836
837  ES = calcEsCond(p_F, multSeq, maxStep);
838
839  setring r_user;
840  ES = fetch(myRing, ES);
841
842  return(list(ES, error));
843}
844
845example
846{
847   "EXAMPLE:"; echo=2;
848   ring r = 11,(a,b,c,d,e,f,g,x,y),ds;
849   poly F =
850   xa+yb+x2+2xy+y2c+y^2+y3d+y4e+y5f+y6g+x^7;
851   esStratum(F);
852   esStratum(F,2);
853   ideal I  = f-fa,e+b;
854   qring q = std(I);
855   poly F = imap(r,F);
856   esStratum(F);
857}
858
859///////////////////////////////////////////////////////////////////////////////
860//                  procedures for equisingularity test
861///////////////////////////////////////////////////////////////////////////////
862
863// DEFINES a new basering, myRing,  which has one variable
864//         more than the old ring.
865//         The name for the new variable is "H(nhelpV)".
866static proc T_extendRing(poly p_F, int nHelpV, ideal HCond)
867{
868  def r_old = basering;
869
870  ideal qIdeal = ideal(basering);
871
872  string helpStr;
873  string minPolyStr = "";
874
875  if(minpoly != 0)
876  {
877    if (charstr(basering) == string(char(basering)) + "," + parstr(basering))
878    {
879      minPolyStr = string(minpoly);
880    }
881  }
882
883  string str = "ring myRing =
884               (" + charstr(r_old) + "),
885               (H(" + string( nHelpV)+ ")," + string(maxideal(1)) + "),
886               (dp(" + string( nHelpV) + "), ds);";
887  execute (str);
888
889  if (minPolyStr != "")
890  {
891    helpStr = "minpoly =" + minPolyStr + ";";
892    execute(helpStr);
893  }
894
895  ideal qIdeal = imap(r_old, qIdeal);
896  if(qIdeal != 0)
897  {
898    def r_base = basering;
899    kill myRing;
900    qring myRing = std(qIdeal);
901  }
902
903  poly p_F =imap(r_old, p_F);
904  ideal HCond = imap(r_old, HCond);
905
906  keepring(myRing);
907}
908///////////////////////////////////////////////////////////////////////////////
909// tests, if ord p_F = nNew.
910static proc equimultTest (poly p_F, int nHelpV, int nNew, ideal HCond)
911{
912  poly p_FnMinus1;
913  ideal id_help;
914  matrix coefMatrix;
915  int i;
916  int nc;
917
918  p_FnMinus1 = jet(p_F, nNew-1, xyVector());
919
920  coefMatrix = coef(p_FnMinus1, xy);
921  nc = ncols(coefMatrix);
922
923  for (i=1; i<=nc; i++)
924  {
925    id_help[i] = coefMatrix[2,i];
926  }
927
928  id_help = T_helpVarElim(id_help, HCond, nHelpV);
929
930  if (reduce(id_help, std(0)) !=0 )
931  {
932    return(0, p_F);
933  }
934
935  p_F = p_F - p_FnMinus1;
936
937  return(1, p_F);
938}
939///////////////////////////////////////////////////////////////////////////////
940// ASSUME: ord(p_F)=nNew
941// tests, if p_F =  p_c*y^nNew for some p_c.
942static proc pPOfYTest (poly p_F, int nHelpV, int nNew, ideal HCond)
943{
944  poly  p_Fn;
945  poly p_c;
946  ideal id_help;
947  int nc;
948  int i=1;
949  matrix coefMatrix;
950
951  p_Fn = jet(p_F, nNew, xyVector());
952
953  coefMatrix = coef(p_Fn, xy);
954  nc = ncols(coefMatrix);
955
956  p_c = coefMatrix[2,1];
957
958  for (i = 2; i <= nc; i++)
959  {
960    id_help[i] = coefMatrix[2,i];
961  }
962
963  id_help = T_helpVarElim(id_help, HCond, nHelpV);
964
965  if (reduce(id_help, std(0)) !=0 )
966  {
967    return(0, p_c);
968  }
969
970  return(1, p_c);
971}
972///////////////////////////////////////////////////////////////////////////////
973// ASSUME: ord(p_F)=nNew
974// tests, if p_F =  p_c*(y - p_a*x)^nNew for some p_a, p_c.
975static proc pPOfLinTest(poly p_F, int nNew, int nHelpV, ideal HCond)
976{
977  poly p_Fn;
978  poly p_c;
979  poly p_ca;
980  poly p_help;
981  poly p_a;
982  ideal id_help;
983
984  p_Fn = jet(p_F, nNew, xyVector());
985
986  p_c  = coefficient(p_Fn,y^nNew,y);
987  p_ca = coefficient(p_Fn,y^(nNew-1)*x,xy)/-nNew;
988
989  if (npars(basering)==1
990  && charstr(basering) != string(char(basering)) + "," + parstr(basering))
991  {
992    p_a = H(nHelpV);
993    HCond = HCond + ideal(p_ca - p_a*p_c);
994  }
995  else
996  {
997    p_help = p_ca/p_c;
998    if (p_help * p_c == p_ca)
999    {
1000      p_a = p_help;
1001    }
1002    else
1003    {
1004      p_a = H(nHelpV);
1005      HCond = HCond + ideal(p_ca - p_a*p_c);
1006    }
1007  }
1008
1009  id_help = ideal(p_Fn - p_c *(y - p_a *x)^nNew);
1010  id_help = T_helpVarElim(id_help, HCond, nHelpV);
1011
1012  if (reduce(id_help, std(0)) != 0 )
1013  {
1014    return(0, p_F, p_c, p_a, HCond);
1015  }
1016
1017  return(1, p_F, p_c, p_a, HCond);
1018}
1019//////////////////////////////////////////////////////////////////////////////
1020// eliminates the variables H(1),..,H(nHelpV) from the ideal ES + HCond
1021static proc T_helpVarElim(ideal ES, ideal HCond, int nHelpV)
1022{
1023
1024  def r_old = basering;
1025
1026  ideal qIdeal = ideal(basering);
1027
1028  string helpStr;
1029  string minPolyStr = "";
1030
1031  if(minpoly != 0)
1032  {
1033    if (charstr(basering) == string(char(basering)) + "," + parstr(basering))
1034    {
1035      minPolyStr = string(minpoly);
1036    }
1037  }
1038
1039  string str = "ring myRing =
1040               (" + charstr(r_old) + "),(" + string(maxideal(1)) + "),
1041               (dp(" + string( nHelpV) + "), dp);";
1042  execute (str);
1043
1044  if (minPolyStr != "")
1045  {
1046    helpStr = "minpoly =" + minPolyStr + ";";
1047    execute(helpStr);
1048  }
1049
1050  ideal qIdeal = imap(r_old, qIdeal);
1051  if(qIdeal != 0)
1052  {
1053    def r_base = basering;
1054    kill myRing;
1055    qring myRing = std(qIdeal);
1056  }
1057
1058  ideal ES = imap(r_old, ES);
1059  ideal HCond = imap(r_old, HCond);
1060
1061  ES = ES + HCond;
1062  ES = std(ES);
1063  ES = nselect(ES,1,nHelpV);
1064
1065  setring r_old;
1066  ES = imap (myRing,ES);
1067
1068  return(ES);
1069}
1070///////////////////////////////////////////////////////////////////////////////
1071// ASSUME:  F in K[t(1)..t(s),x,y],
1072//          the ringordering is ds
1073// RETURNS: list l, such that
1074//          l[1]=1 if some error has occured,
1075//          l[1]=0 otherwise and then
1076//          l[2] = 1, if the deformation is equisingular and
1077//          l[2] = 0 otherwise.
1078static proc equisingTest (poly p_F, intvec multSeq, int maxStep)
1079{
1080  def r_old = basering;
1081
1082  ideal id_Es = 0;
1083
1084  int isES = 1;
1085  int step = 1;
1086  int nNew = multSeq[step];
1087  int nOld = nNew;
1088  int zeroSteps;
1089  ideal  HCond = 0;
1090  int  nHelpV = 1;
1091
1092  T_extendRing (p_F, nHelpV, HCond);
1093
1094  poly p_c;
1095  poly p_a;
1096
1097  while (step <= maxStep)
1098  {
1099    nOld = nNew;
1100    nNew = multSeq[step];
1101
1102    if (nNew < nOld)
1103    //start a new line in the HNE of F
1104    //               _            _
1105    // for the next | nold/nnew -1 | iteration steps the coefficient 'a'
1106    // in the leading form Fn = c(y-ax) should  be zero
1107    {
1108      p_F = swapXY(p_F);
1109      zeroSteps = calcNZeroSteps (nOld, nNew);
1110    }
1111
1112    isES, p_F = equimultTest (p_F, nHelpV, nNew, HCond);
1113
1114    if (! isES)
1115    {
1116      return(0);
1117    }
1118
1119    if (zeroSteps > 0)
1120    {
1121      zeroSteps--;
1122
1123      isES, p_c = pPOfYTest (p_F,  nHelpV, nNew, HCond);
1124      p_a = 0;
1125    }
1126    else
1127    {
1128      isES, p_F, p_c, p_a, HCond = pPOfLinTest (p_F, nNew, nHelpV, HCond);
1129    }
1130
1131    if (! isES)
1132    {
1133      return(0);
1134    }
1135
1136    p_F = formalBlowUp (p_F, p_c, p_a, nNew);
1137
1138    if (p_a == H(nHelpV))
1139    {
1140      nHelpV++;
1141
1142      def r_base = basering;
1143      kill myRing;
1144
1145      T_extendRing(p_F, nHelpV, HCond);
1146
1147      kill r_base;
1148
1149      poly p_a;
1150      poly p_c;
1151    }
1152
1153    step++;
1154  }
1155
1156  return(1);
1157}
1158///////////////////////////////////////////////////////////////////////////////
1159
1160proc isEquising (poly p_F, list #)
1161"USAGE:   isEquising(F[,m]); F a polynomial, m an integer
1162ASSUME:  F defines a deformation of an irreducible bivariate polynomial f
1163         and that char(basering) does not divide mult(f).
1164         If nv is the number of variables of the basering, then the first nv-2
1165         ringvariables are the deformation parameters.
1166         If the basering is a qring, ideal(basering) must only depend
1167         on the deformation parameters.
1168RETURN:  A list l of two integers, where
1169         l[1] = 1 if F is an equisingular deformation,l[1] = 0 otherwise.
1170         l[2] = 1 if some error has occured, l[2] = 0 otherwise.
1171         If m is given, the computation stops after m steps of the iteration.
1172NOTE:    This proc uses 'execute' or calls a procedure using 'execute'.
1173EXAMPLE: example isEquising; shows an example
1174"
1175{
1176  def r_user = basering;
1177
1178  int ii = 1;
1179  int i_nvars = nvars(basering);
1180  int error = 0;
1181  int maxStep;
1182  int userMaxStep;
1183  int xNotTransversal = 0;
1184  int fIrreducible = 1;
1185  intvec multSeq;
1186  ideal isES = 1;
1187
1188  error = checkBasering();
1189  if (error)
1190  {
1191    return(0,1);
1192  }
1193
1194  userMaxStep = getInput(#);
1195
1196  // define a new basering "myRing" with new names for parameters
1197  // and variables.
1198  // The new names are 'a(1)', ..., 'a(npars)' for the parameters
1199  // and 't(1)', ..., 't(nvars-2)', 'x', 'y' for the variables.
1200  createMyRing(p_F, "ds");
1201
1202  createHNERing();
1203
1204  poly p_f = imap(myRing,p_F);
1205
1206  error = checkPoly(p_f);
1207  if (error)
1208  {
1209    return(0,1);
1210  }
1211
1212  // compute the multiplicity sequence of p_f.
1213  multSeq, xNotTransversal, fIrreducible = calcMultSequence(p_f);
1214
1215   if ( ! fIrreducible)
1216   {
1217     return(list(0,1));
1218   }
1219
1220  setring myRing;
1221
1222  if (xNotTransversal)
1223  {
1224    p_F = swapXY(p_F);
1225  }
1226
1227  if (userMaxStep != -1 && userMaxStep <  size(multSeq)-1)
1228  {
1229    maxStep = userMaxStep;
1230  }
1231  else
1232  {
1233    maxStep = size(multSeq)-1;
1234  }
1235
1236  int isES = equisingTest(p_F, multSeq, maxStep);
1237
1238  return(list(isES, error));
1239}
1240
1241example
1242{
1243   "EXAMPLE:"; echo=2;
1244   ring r = 11,(T,x,y),ds;
1245   poly F = (x+y)^2+y^3*T+x^7;
1246   isEquising(F);
1247   isEquising(F,1);
1248   isEquising(F,2);
1249   ideal I  = ideal(T);
1250   qring q = std(I);
1251   poly F = imap(r,F);
1252   isEquising(F,2);
1253}
1254///////////////////////////////////////////////////////////////////////////////
1255/*
1256  Weiter Beispiele aus Dipl. von A. Mindnich einfuegen
1257*/
Note: See TracBrowser for help on using the repository browser.