source: git/Singular/LIB/lejeune.lib @ 565d9b

spielwiese
Last change on this file since 565d9b was 565d9b, checked in by Nadine Cremer <cremer@…>, 18 years ago
*cremer: it seems to be possible to compute the F's, now testing :-))) git-svn-id: file:///usr/local/Singular/svn/trunk@8400 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.7 KB
Line 
1
2//-*- mode:C++;-*-
3// $Id: lejeune.lib,v 1.10 2005-06-24 12:01:09 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_setstep(f,H);      iterates the steps given by H, saved in f_set             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)         // puts together the single steps from
31{                                    // f_setstep
32  def r=basering;
33  int b=size(H);
34  int i;
35  def R=ringchange(b-1);
36  setring R;
37  list l;
38  for(i=2;i<=b;i++)
39   {
40     setring r;
41     def tmp=f_setstep(f,intvec(H[1..i]));
42     setring R;
43     ideal I=imap(tmp,resultf_set);
44     l[i-1]=I;
45   }
46  l;
47  return(R);
48}
49
50
51  proc f_setstep (poly f,intvec H)
52{
53  int p;                              // loop variable
54  int m_0=ord(f);
55  int b=size(H);
56  int c=sum(H,1..b-1);
57  if(H[1]!=m_0)                       // input admissible?!
58    {
59     "H[1]=ord(f) notwendig!!";
60      return(0);
61    }
62  for(p=1;p<b;p++)
63    {
64      if(H[p]<H[p+1])
65      {
66        "Unzulaessige Eingabe, H[1]<=...<=H[b] notwendig!";
67         return(0);
68      }
69    }
70  def R=formaldiff(f,b-1,c,H[b]);      // actual step
71  setring R;
72  def resultf_set=resultdiff;
73  export(resultf_set);
74  return(R);   
75}
76
77
78
79
80
81proc formaldiff (poly f,int i,int a,int k)
82{
83  int s,t,v;                          // loop variables
84  int u;                   
85  def R=plugin_coeffs(f,i);           // plugs the power series in...
86  setring R;                          // changes the ring
87  def Coe=result;   
88  matrix coe=Coe;                     // gives the t-coeff. after plugging in
89  poly fkv;                           // need this stuff for the following
90  ideal m;                            // loops...
91  ideal m1,m2,J,resultdiff;
92  for(v=1;v<=k;v++)                   // consider the different t-coeff.
93   {
94     fkv=coe[a+v,1];
95     m=fkv;                           
96     J=fkv;                           // will save the result in this step
97     for(s=1;s<k;s++)
98       {
99         m1=maxidealstep(i,startvar); // computes the corresponding ideal
100         m1=m1^s;
101         u=size(m1);
102         for(t=1;t<=u;t++)
103          {
104            m2=contract(m1[t],m);     // actual differentiation
105            J=J,m2;
106          }
107       }
108     resultdiff=resultdiff,J;
109   }
110  resultdiff=simplify(resultdiff,2);
111  export(resultdiff);                // exports the result
112  return(R);                         // return the ring
113 
114}
115
116
117
118proc plugin_coeffs (poly f,int i)
119{
120  def r=basering;
121  def R=ringchange(i);              // changes the ring
122  setring R;                        // makes it new basering;
123  ideal I=tpolys(i,startvar);
124  poly g=imap(r,f);                 // maps f to new basering
125  export(g);                        // export it
126  map h=r,I;                        // define map according to our purpose
127  ideal J=h(f);                     // gives f with power series plugged in
128  export(h);                   
129  matrix result=coeffs(J[1],t);     // gives the t-coefficients
130  export result;                    // export it i.o. to use it later on
131  return(R);                        // return ring (ring change!)
132}
133
134
135
136proc ringchange (int i)
137{
138  int startvar;
139  startvar=nvars(basering);
140  export(startvar);       
141  def R=changevar(""+varstr(basering)+",t,"+variables(startvar,i)+"");// change
142  return(R);                 // return the ring, needed in future proc
143}
144
145
146
147proc variables (int k,int i)
148{
149  list l;
150  int s,u;                              // loop variables
151  string str;               
152  for (u=1;u<=k;u++)
153   {
154     for (s=1;s<=i;s++)
155     {
156       str=""+a_z(u)+"("+string(s)+")"; // creates new variables   
157       l[(u-1)*i+s]=str;                // saves them in a list
158     }
159   }
160  string str1=string(l);                // makes the list into a string,
161  return(str1);                         // (needed for ring change)
162}
163
164
165proc a_z (int n)                        // returns nth letter of the alphabet
166{
167  if(1>n>26)                     // input admissible?
168   {
169     "n must range between 1 and 26!";
170      return(0);
171   }
172  string s="ring r=0,("+A_Z("a",n)+"),ds;";
173  execute(s);
174  return (string(var(n)));
175}
176
177
178
179proc tpolys (int i,int k)             // constructs polynomials a(1)*t+...
180{                                     // has to be called from pluin_coeffs
181  int s,t;                            // loop variables
182  int v;           
183  poly sum;
184  ideal I;
185  for(t=1;t<=k;t++)
186   { 
187     v=(t-1)*i;
188     for(s=1;s<=i;s++)
189      {
190        sum=sum+var(1+k+v+s)*var(k+1)^s;    // clumsy: working with "var(1)",
191      }                                     // depends on form of basering
192     I[t]=sum;
193     sum=0;
194   }   
195  return(I);
196}
197
198
199
200
201proc maxidealstep (int i,int N)       // returns ideal needed for
202{                                     // differentiation in ith step
203  ideal I=var(N+1+i);
204  int j;
205  for(j=2;j<=N;j++)
206   {
207     I=I,var(N+1+j*i);
208   }
209return(I);
210}
Note: See TracBrowser for help on using the repository browser.