source: git/Singular/LIB/lejeune.lib @ 24bbc0

spielwiese
Last change on this file since 24bbc0 was 24bbc0, checked in by Nadine Cremer <cremer@…>, 19 years ago
*cremer: it's running, now save the results from each step-second try ;-). git-svn-id: file:///usr/local/Singular/svn/trunk@8395 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.5 KB
Line 
1
2//-*- mode:C++;-*-
3// $Id: lejeune.lib,v 1.8 2005-06-24 08:45:04 cremer Exp $
4
5
6info="
7LIBRARY: lejeune.lib  Arc space computations
8AUTHOR:  Nadine Cremer,    nadine.cremer@gmx.de
9[SEE ALSO: <comma-separated words of cross references>]
10[KEYWORDS: <semicolon-separated phrases of index keys>]
11PROCEDURES:
12    variables(k,i);      creates k*i new var. t,a(1),..,a(i),..,x(1),..,x(i)
13    a_z(k);              returns kth letter of the alphabet
14    tpolys(k,i);         creates polyn. a(1)*t+..+a(n)*t^n
15    ringchange(i);       changes the ring to the one needed in ith step     
16    plugin_coeffs(i,f)   plugs tpolys into f, up to power i
17    maxidealstep(i,N);   returns ideal needed for contraction in ith step
18                         N is number of variables of input f
19    formaldiff(f,k);     computes the formal derivatives D_I with |I|<k
20    f_set(f,H);          returns the set F corresponding to H as described by
21                         M. Lejeune
22  ";
23
24
25LIB "ring.lib";                       // need procedures from these libs
26LIB "general.lib";
27
28
29
30proc f_set (poly f,intvec H)
31{
32  int p;                              // loop variable
33  int m_0=ord(f);
34  int b=size(H);
35  int c=sum(H,1..b-1);
36  if(H[1]!=m_0)                       // input admissible?!
37    {
38     "H[1]=ord(f) notwendig!!";
39      return(0);
40    }
41  for(p=1;p<b;p++)
42    {
43      if(H[p]<H[p+1])
44      {
45        "Unzulaessige Eingabe, H[1]<=...<=H[b] notwendig!";
46         return(0);
47      }
48    }
49  def r=basering;                     // need that in iteratio                 
50  for(p=b-1;p>1;p--)                   // iterating steps
51    {   
52      def tmp=f_set(f,intvec(H[1..p]));       
53      //setring tmp;
54      //def tmp1=resultf_set;
55      //setring r;     
56    }
57  def R=formaldiff(f,b-1,c,H[b]);      // actual step
58  setring R;
59  def T=resultdiff;
60  ideal resultf_set=T;
61  export(resultf_set);
62  resultf_set;
63  return(R);
64}
65
66
67
68
69
70proc formaldiff (poly f,int i,int a,int k)
71{
72  int s,t,v;                          // loop variables
73  int u;                   
74  def R=plugin_coeffs(f,i);           // plugs the power series in...
75  setring R;                          // changes the ring
76  def Coe=result;   
77  matrix coe=Coe;                     // gives the t-coeff. after plugging in
78  poly fkv;                           // need this stuff for the following
79  ideal m;                            // loops...
80  ideal m1,m2,J,resultdiff;
81  for(v=1;v<=k;v++)                   // consider the different t-coeff.
82   {
83     fkv=coe[a+v,1];
84     m=fkv;                           
85     J=fkv;                           // will save the result in this step
86     for(s=1;s<k;s++)
87       {
88         m1=maxidealstep(i,startvar); // computes the corresponding ideal
89         m1=m1^s;
90         u=size(m1);
91         for(t=1;t<=u;t++)
92          {
93            m2=contract(m1[t],m);     // actual differentiation
94            J=J,m2;
95          }
96       }
97     resultdiff=resultdiff,J;
98   }
99  resultdiff=simplify(resultdiff,2);
100  export(resultdiff);                // exports the result
101  return(R);                         // return the ring
102 
103}
104
105
106
107proc plugin_coeffs (poly f,int i)
108{
109  def r=basering;
110  def R=ringchange(i);              // changes the ring
111  setring R;                        // makes it new basering;
112  ideal I=tpolys(i,startvar);
113  poly g=imap(r,f);                 // maps f to new basering
114  export(g);                        // export it
115  map h=r,I;                        // define map according to our purpose
116  ideal J=h(f);                     // gives f with power series plugged in
117  export(h);                   
118  matrix result=coeffs(J[1],t);     // gives the t-coefficients
119  export result;                    // export it i.o. to use it later on
120  return(R);                        // return ring (ring change!)
121}
122
123
124
125proc ringchange (int i)
126{
127  int startvar;
128  startvar=nvars(basering);
129  export(startvar);       
130  def R=changevar(""+varstr(basering)+",t,"+variables(startvar,i)+"");// change
131  return(R);                 // return the ring, needed in future proc
132}
133
134
135
136proc variables (int k,int i)
137{
138  list l;
139  int s,u;                              // loop variables
140  string str;               
141  for (u=1;u<=k;u++)
142   {
143     for (s=1;s<=i;s++)
144     {
145       str=""+a_z(u)+"("+string(s)+")"; // creates new variables   
146       l[(u-1)*i+s]=str;                // saves them in a list
147     }
148   }
149  string str1=string(l);                // makes the list into a string,
150  return(str1);                         // (needed for ring change)
151}
152
153
154proc a_z (int n)                        // returns nth letter of the alphabet
155{
156  if(1>n>26)                     // input admissible?
157   {
158     "n must range between 1 and 26!";
159      return(0);
160   }
161  string s="ring r=0,("+A_Z("a",n)+"),ds;";
162  execute(s);
163  return (string(var(n)));
164}
165
166
167
168proc tpolys (int i,int k)             // constructs polynomials a(1)*t+...
169{                                     // has to be called from pluin_coeffs
170  int s,t;                            // loop variables
171  int v;           
172  poly sum;
173  ideal I;
174  for(t=1;t<=k;t++)
175   { 
176     v=(t-1)*i;
177     for(s=1;s<=i;s++)
178      {
179        sum=sum+var(1+k+v+s)*var(k+1)^s;    // clumsy: working with "var(1)",
180      }                                     // depends on form of basering
181     I[t]=sum;
182     sum=0;
183   }   
184  return(I);
185}
186
187
188
189
190proc maxidealstep (int i,int N)       // returns ideal needed for
191{                                     // differentiation in ith step
192  ideal I=var(N+1+i);
193  int j;
194  for(j=2;j<=N;j++)
195   {
196     I=I,var(N+1+j*i);
197   }
198return(I);
199}
Note: See TracBrowser for help on using the repository browser.