source: git/Singular/LIB/standard.lib @ 283282f

spielwiese
Last change on this file since 283282f was 283282f, checked in by Hans Schönemann <hannes@…>, 26 years ago
* wichmann: bug-fix: stdfglm failed in rings with parameters. git-svn-id: file:///usr/local/Singular/svn/trunk@1200 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.2 KB
Line 
1// $Id: standard.lib,v 1.6 1998-03-06 15:32:23 Singular Exp $
2///////////////////////////////////////////////////////////////////////////////
3
4LIBRARY: standard.lib   PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP
5
6 stdfglm(ideal[,ord])   standard basis of the ideal via fglm [and ordering ord]
7 stdhilbert(ideal)      standard basis of the ideal using the Hilbert function
8///////////////////////////////////////////////////////////////////////////////
9
10proc stdfglm (ideal i, list #)
11USAGE:   stdfglm(i[,s]); i ideal, s string (any allowed ordstr of a ring)
12RETURN:  stdfglm(i): standard basis of i in the basering, calculated via fglm
13                     from ordering "dp" to the ordering of the basering.
14         stdfglm(i,s): standard basis of i in the basering, calculated via
15                     fglm from ordering s to the ordering of the basering.
16EXAMPLE: example stdfglm; shows an example
17{
18   string os;
19   def dr= basering;
20   if( (size(#)==0) or (typeof(#[1]) != "string") )
21   {
22     os = "dp(" + string( nvars(dr) ) + ")";
23     if ( (find( ordstr(dr), os ) != 0) and (find( ordstr(dr), "a") == 0) )
24     {
25       os= "Dp";
26     }
27     else
28     {
29       os= "dp";
30     }
31   }
32   else { os = #[1]; }
33   execute "ring sr=("+charstr(dr)+"),("+varstr(dr)+"),"+os+";";
34   ideal i= fetch(dr,i);
35   intvec opt= option(get);
36   option(redSB);
37   i=std(i);
38   option(set,opt);
39   setring dr;
40   return (fglm(sr,i));
41}
42example
43{ "EXAMPLE:"; echo = 2;
44   ring r  = 0,(x,y,z),lp;
45   ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y;
46   ideal i1= stdfglm(i);         //uses fglm from "dp" to "lp"
47   i1;
48   ideal i2= stdfglm(i,"Dp");    //uses fglm from "Dp" to "lp"
49   i2;
50}
51///////////////////////////////////////////////////////////////////////////////
52
53proc stdhilbert(ideal i,list #)
54USAGE:   stdhilbert(i);  i ideal
55         stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function)
56RETURN:  stdhilbert(i): a standard basis of i (computing v internally)
57         stdhilbert(i,v): standard basis of i, using the given Hilbert function
58EXAMPLE: example stdhilbert; shows an example
59{
60   def R=basering;
61
62   if((homog(i)==1)||(ordstr(basering)[1]=="d"))
63   {
64      if ((size(#)!=0)&&(homog(i)==1))
65      {
66         return(std(i,#[1]));
67      }
68      return(std(i));
69   }
70
71   execute "ring S = ("+charstr(R)+"),("+varstr(R)+",@t),dp;";
72   ideal i=homog(imap(R,i),@t);
73   intvec v=hilb(std(i),1);
74   execute "ring T = ("+charstr(R)+"),("+varstr(R)+",@t),("+ordstr(R)+");";
75   ideal i=fetch(S,i);
76   ideal a=std(i,v);
77   setring R;
78   map phi=T,maxideal(1),1;
79   ideal a=phi(a);
80
81   int k,j;
82   poly m;
83   int c=size(i);
84
85   for(j=1;j<c;j++)
86   {
87     if(deg(a[j])==0)
88     {
89       a=ideal(1);
90       attrib(a,"isSB",1);
91       return(a);
92     }
93     if(deg(a[j])>0)
94     {
95       m=lead(a[j]);
96       for(k=j+1;k<=c;k++)
97       {
98          if(size(lead(a[k])/m)>0)
99          {
100            a[k]=0;
101          }
102       }
103     }
104   }
105   a=simplify(a,2);
106   attrib(a,"isSB",1);
107   return(a);
108}
109example
110{ "EXAMPLE:"; echo = 2;
111   ring  r = 0,(x,y,z),lp;
112   ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y;
113   ideal i1= stdhilbert(i); i1;
114   // is in this case equivalent to:
115   intvec v=1,0,0,-3,0,1,0,3,-1,-1;
116   ideal i2=stdhilbert(i,v);
117}
118///////////////////////////////////////////////////////////////////////////////
119
Note: See TracBrowser for help on using the repository browser.