source: git/Singular/LIB/lejeune.lib @ ee17bf

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