source: git/Singular/LIB/lejeune.lib @ 4c4b1e

spielwiese
Last change on this file since 4c4b1e was 4c4b1e, checked in by Nadine Cremer <cremer@…>, 18 years ago
*cremer:plugging in works git-svn-id: file:///usr/local/Singular/svn/trunk@8382 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1
2//-*- mode:C++;-*-
3// $Id: lejeune.lib,v 1.3 2005-06-20 10:18:00 cremer Exp $
4
5info="
6LIBRARY: lejeune1.4.lib  Arc space computations
7AUTHOR:  Nadine Cremer,    nadine.cremer@gmx.de
8[SEE ALSO: <comma-separated words of cross references>]
9[KEYWORDS: <semicolon-separated phrases of index keys>]
10PROCEDURES:
11    variables(k,i);      creates k*i new var. t,a(1),..,a(i),..,x(1),..,x(i)
12    a_z(k);            returns kth letter of the alphabet
13    tpolys(k,i);        creates polyn. a(1)*t+..+a(n)*t^n
14  ";
15
16
17LIB "ring.lib";
18LIB "general.lib";
19
20
21proc plugin_coeffs (int i,poly f)
22{
23  def r=basering;
24  int k=nvars(r);
25  string str=variables(k,i);
26 
27  def R=changevar(""+varstr(r)+",t,"+variables(k,i)+"");
28  setring R;
29  ideal I=tpolys(i,k);
30  poly g=imap(r,f);
31  map h=r,I;
32  ideal J=h(f);
33  matrix output=coeffs(J[1],t);
34  keepring R;
35  return(output);
36}
37
38
39
40
41
42
43
44
45proc variables (int k,int i)
46{
47  list l;
48  int s,u;                              // loop variables
49  string str;               
50  for (u=1;u<=k;u++)
51   {
52     for (s=1;s<=i;s++)
53     {
54       str=""+a_z(u)+"("+string(s)+")";     
55       l[(u-1)*i+s]=str;
56     }
57   }
58  //l=insert(l,"t");
59  string str1=string(l);
60  return(str1);
61}
62
63
64proc a_z (int n)                      // returns nth letter of the alphabet
65{
66  if((n<1)||(n>26))                     // input admissible?
67   {
68     "n must range between 1 and 26!";
69      return(0);
70   }
71  string s="ring r=0,("+A_Z("a",n)+"),ds;";
72  execute(s);
73  return (string(var(n)));
74}
75
76
77
78proc tpolys (int i,int k)             // constructs polynomials a(1)*t+...
79{                                     // has to be called from tpolys
80  int s,t;                             // loop variables
81  int v;           
82  poly sum;
83  ideal I;
84  for(t=1;t<=k;t++)
85   { 
86     v=(t-1)*i;
87     for(s=1;s<=i;s++)
88      {
89        sum=sum+var(1+k+v+s)*var(k+1)^s;    // clumsy: working with "var(1)"
90      }
91     I[t]=sum;
92     sum=0;
93   }   
94  return(I);
95}
Note: See TracBrowser for help on using the repository browser.