source: git/Singular/LIB/weierstr.lib @ 33b509

spielwiese
Last change on this file since 33b509 was 66d68c, checked in by Hans Schoenemann <hannes@…>, 14 years ago
format git-svn-id: file:///usr/local/Singular/svn/trunk@13499 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 6.7 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="$Id$";
3category="Teaching";
4info="
5LIBRARY:  weierstr.lib   Procedures for the Weierstrass Theorems
6AUTHOR:                  G.-M. Greuel, greuel@mathematik.uni-kl.de
7
8PROCEDURES:
9 weierstrDiv(g,f,d);   perform Weierstrass division of g by f up to degree d
10 weierstrPrep(f,d);    perform Weierstrass preparation of f up to degree 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
14           (parameters in square brackets [] are optional)
15";
16
17LIB "mondromy.lib";
18LIB "poly.lib";
19///////////////////////////////////////////////////////////////////////////////
20
21proc generalOrder (poly f)
22"USAGE:   generalOrder(f); f=poly
23RETURN:  integer b if f is general of order b w.r.t. the last variable, say T,
24         resp. -1 if not
25         (i.e. f(0,...,0,T) is of order b, resp. f(0,...,0,T)==0)
26NOTE:    the procedure works for any monomial ordering
27EXAMPLE: example generalOrder; shows an example
28"
29{ int ii;
30  int n = nvars(basering);
31  for (ii=1; ii<n; ii++)
32  {
33    f = subst(f,var(ii),0);
34  }
35  return(mindeg(f));
36}
37example
38{ "EXAMPLE:"; echo = 2;
39   ring R = 0,(x,y),ds;
40   poly f = x2-4xy+4y2-2xy2+4y3+y4;
41   generalOrder(f);
42}
43///////////////////////////////////////////////////////////////////////////////
44
45proc weierstrDiv ( poly g, poly f, int d )
46"USAGE:   weierstrDiv(g,f,d); g,f=poly, d=integer
47ASSUME:  f must be general of finite order, say b, in the last ring variable,
48         say T; if not use the procedure lastvarGeneral first
49PURPOSE: perform the Weierstrass division of g by f up to order d
50RETURN:  - a list, say l, of two polynomials and an integer, such that@*
51            g = l[1]*f + l[2],  deg_T(l[2]) < b, 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 polynomial 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 polynomial 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.