# source:git/Singular/LIB/weierstr.lib@373856

spielwiese
Last change on this file since 373856 was 373856, checked in by Hans Schönemann <hannes@…>, 17 years ago
• Property mode set to `100644`
File size: 6.8 KB
Line
2///////////////////////////////////////////////////////////////////////////////
3version="\$Id: weierstr.lib,v 1.1 2006-05-19 10:27:07 Singular Exp \$";
4category="Teaching";
5info="
6LIBRARY:  weierstr.lib   Procedures for the Weierstrass Theorems
7AUTHOR:                  G.-M. Greuel, greuel@mathematik.uni-kl.de
8
9 weierstrDiv(g,f,d);   perform Weierstrass division of g by f up to gegree d
10 weierstrPrep(f,d);    perform Weierstrass preparation of f up to gegree d
11 lastvarGeneral(f);    make f general of finite order w.r.t. last variable
12 generalOrder(f);      compute integer b s.t. f is x_n-general of order b
13           (parameters in square brackets [] are optional)
14";
15
16LIB "mondromy.lib";
17LIB "poly.lib";
18///////////////////////////////////////////////////////////////////////////////
19
20proc generalOrder (poly f)
21"USAGE:   generalOrder(f); f=poly
22RETURN:  integer b if f is general of order b w.r.t. the last variable, say T,
23         resp. -1 if not
24         (i.e. f(0,...,0,T) is of order b, resp. f(0,...,0,T)==0)
25NOTE:    the procedure works for any monomial ordering
26EXAMPLE: example generalOrder; shows an example
27"
28{ int ii;
29  int n = nvars(basering);
30  for (ii=1; ii<n; ii++)
31  {
32    f = subst(f,var(ii),0);
33  }
34  return(mindeg(f));
35}
36example
37{ "EXAMPLE:"; echo = 2;
38   ring R = 0,(x,y),ds;
39   poly f = x2-4xy+4y2-2xy2+4y3+y4;
40   generalOrder(f);
41
42///////////////////////////////////////////////////////////////////////////////
43
44proc weierstrDiv ( poly g, poly f, int d )
45"USAGE:   weierstrDiv(g,f,d); g,f=poly, d=integer
46ASSUME:  f must be general of finite order, say b, in the last ring variable,
47         say T; if not use the procedure lastvarGeneral first
48PURPOSE: perform the Weierstrass division of g by f up to order d
49RETURN:  a list, say l, of two polynomials and an interer, such that
50                   g = l[1]*f + l[2],  deg_T(l[2]) < b
51         up to (including) total degree d
52         l[3] is the number of iterations used
53         if f is not T-general, return (0,g)
54NOTE:    the procedure works for any monomial ordering
55THEORY:  the proof of Grauert-Remmert (Analytische Stellenalgebren) is used
56         for the algorithm
57EXAMPLE: example weierstrDiv; shows an example
58"
59{
60//------------- initialisation and check T - general -------------------------
61  int a,b,ii,D;
62  poly r,h;
63  list result;
64  int y = printlevel - voice + 2;
65  int n = nvars(basering);
66  intvec v;
67  v[n]=1;
68  b = generalOrder(f);
69  if (y>0)
70  {
71     "//",f;"// is "+string(var(n))+"-general of order", b;
72     pause("press <return> to continue");
73  }
74  if ( b==-1 )
75  {
76     "// second poly is not general w.r.t. last variable";
77     "// use the procedure lastvarGeneral first";
78     result=h,g;
79     return(result);
80  }
81//------------------------- start computation --------------------------------
82  D = d+b;
83  poly fhat = jet(f,b-1,v);
84  poly ftilde = (f-fhat)/var(n)^b;
85  poly u = invunit(ftilde,D);
86  if (y>0)
87  {
88     "// fhat (up to order", d,"):";
89     "//", fhat;
90     "// ftilde:";
91     "//", ftilde;
92     "// ftilde-inverse:";
93     "//", u;
94     pause("press <return> to continue");
95  }
96  poly khat, ktilde;
97  poly k=g;
98  khat = jet(k,b-1,v);
99  ktilde = (k-r)/var(n)^b;
100  r = khat;
101  h = ktilde;
102  ii=0;
103  while (size(k) > 0)
104  {
105  if (y>0)
106    {
107     "// loop",ii+1;
108     "// khat:";
109     "//", khat;
110     "// ktilde:";
111     "//", ktilde;
112     "// remainder:";
113     "//", r;
114     "// multiplier:";
115     "//", h;
116     pause("press <return> to continue");
117    }
118    k = jet(-fhat*u*ktilde,D);
119    khat = jet(k,b-1,v);
120    ktilde = (k-khat)/var(n)^b;
121    r = r + khat;
122    h = h + ktilde;
123    ii=ii+1;
124  }
125  result = jet(u*h,d),jet(r,d),ii;
126  return(result);
127}
128example
129{ "EXAMPLE:"; echo = 2;
130   ring R = 0,(x,y),ds;
131   poly f = y - xy2 + x2;
132   poly g = y;
133   list l = weierstrDiv(g,f,10); l;"";
134   l[1]*f + l[2];               //g = l[1]*f+l[2] up to degree 10
135
136///////////////////////////////////////////////////////////////////////////////
137
138proc weierstrPrep (poly f, int d)
139"USAGE:   weierstrPrep(f,d); f=poly, d=integer
140ASSUME:  f must be general of finite order, say b, in the last ring variable,
141         say T; if not apply the procedure lastvarGeneral first
142PURPOSE: perform the Weierstrass preparation of f up to order d
143RETURN:  a list, say l, of two polynomials and one integer,
144         l[1] a unit, l[2] a Weierstrass polynomial, l[3] an integer
145         such that l[1]*f = l[2], where l[2] is a Weierstrass polynomial,
146         (i.e. l[2] = T^b + lower terms in T) up to (including) total degree d
147         l[3] is the number of iterations used
148         if f is not T-general, return (0,0)
149NOTE:    the procedure works for any monomial ordering
150THEORY:  the proof of Grauert-Remmert (Analytische Stellenalgebren) is used
151         for the algorithm
152EXAMPLE: example weierstrPrep; shows an example
153"
154{
155  int n = nvars(basering);
156  int b = generalOrder(f);
157  if ( b==-1 )
158  {
159     "// second poly is not general w.r.t. last variable";
160     "// use the procedure lastvarGeneral first";
161     poly h,g;
162     list result=h,g;
163     return(result);
164  }
165  list L = weierstrDiv(var(n)^b,f,d);
166  list result = L[1], var(n)^b - L[2],L[3];
167  return(result);
168}
169example
170{ "EXAMPLE:"; echo = 2;
171   ring R = 0,(x,y),ds;
172   poly f = xy+y2+y4;
173   list l = weierstrPrep(f,5); l; "";
174   f*l[1]-l[2];                      // = 0 up to degree 5
175}
176///////////////////////////////////////////////////////////////////////////////
177
178proc lastvarGeneral (poly f)
179"USAGE:   lastvarGeneral(f,d); f=poly
180RETURN:  poly, say g, obtained from f by a generic change of variables, s.t.
181         g is general of finite order b w.r.t. the last ring variable, say T
182         (i.e. g(0,...,0,T)= c*T^b + higher terms, c!=0)
183NOTE:    the procedure works for any monomial ordering
184EXAMPLE: example lastvarGeneral; shows an example
185"
186{
187  int n = nvars(basering);
188  int b = generalOrder(f);
189  if ( b >=0 )  { return(f); }
190  else
191  {
192    def B = basering;
193    int ii;
194    map phi;
195    ideal m=maxideal(1);
196    int d = mindeg1(f);
197    poly g = jet(f,d);
198    for (ii=1; ii<=n-1; ii++)
199    {
200       if (size(g)>size(subst(g,var(ii),0)) )
201       {
202          m[ii]= var(ii)+ random(1-(voice-2)*10,1+(voice-2)*10)*var(n);
203          phi = B,m;
204          g = phi(f);
205          break;
206       }
207    }
208    if ( voice <=5 )
209    {
210       return(lastvarGeneral(g));
211    }
212    if ( voice ==6 )
213    {
214       for (ii=1; ii<=n-1; ii++)
215      {
216         m[ii]= var(ii)+ var(n)*random(1,1000);
217      }
218      phi = basering,m;
219      g = phi(f);
220      return(lastvarGeneral(g));
221    }
222    else
223    {
224      for (ii=1; ii<=n-1; ii++)
225      {
226         m[ii]= var(ii)+ var(n)^random(2,voice*d);
227      }
228      phi = basering,m;
229      g = phi(f);
230      return(lastvarGeneral(g));
231    }
232  }
233}
234example
235{ "EXAMPLE:"; echo = 2;
236   ring R = 2,(x,y,z),ls;
237   poly f = xyz;
238   lastvarGeneral(f);
239}
240///////////////////////////////////////////////////////////////////////////////
241
Note: See TracBrowser for help on using the repository browser.