source: git/Singular/LIB/standard.lib @ d2b2a7

spielwiese
Last change on this file since d2b2a7 was d2b2a7, checked in by Kai Krüger <krueger@…>, 25 years ago
Modified Files: libparse.l utils.cc LIB/classify.lib LIB/deform.lib LIB/elim.lib LIB/factor.lib LIB/fastsolv.lib LIB/finvar.lib LIB/general.lib LIB/hnoether.lib LIB/homolog.lib LIB/inout.lib LIB/invar.lib LIB/makedbm.lib LIB/matrix.lib LIB/normal.lib LIB/poly.lib LIB/presolve.lib LIB/primdec.lib LIB/primitiv.lib LIB/random.lib LIB/ring.lib LIB/sing.lib LIB/standard.lib LIB/tex.lib LIB/tst.lib Changed help section o procedures to have an quoted help-string between proc-definition and proc-body. git-svn-id: file:///usr/local/Singular/svn/trunk@1601 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.3 KB
Line 
1// $Id: standard.lib,v 1.8 1998-05-05 11:55:38 krueger Exp $
2///////////////////////////////////////////////////////////////////////////////
3
4version="$Id: standard.lib,v 1.8 1998-05-05 11:55:38 krueger Exp $";
5info="
6LIBRARY: standard.lib   PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP
7
8 stdfglm(ideal[,ord])   standard basis of the ideal via fglm [and ordering ord]
9 stdhilbert(ideal)      standard basis of the ideal using the Hilbert function
10";
11
12///////////////////////////////////////////////////////////////////////////////
13
14proc stdfglm (ideal i, list #)
15"USAGE:   stdfglm(i[,s]); i ideal, s string (any allowed ordstr of a ring)
16RETURN:  stdfglm(i): standard basis of i in the basering, calculated via fglm
17                     from ordering \"dp\" to the ordering of the basering.
18         stdfglm(i,s): standard basis of i in the basering, calculated via
19                     fglm from ordering s to the ordering of the basering.
20EXAMPLE: example stdfglm; shows an example
21"
22{
23   string os;
24   def dr= basering;
25   if( (size(#)==0) or (typeof(#[1]) != "string") )
26   {
27     os = "dp(" + string( nvars(dr) ) + ")";
28     if ( (find( ordstr(dr), os ) != 0) and (find( ordstr(dr), "a") == 0) )
29     {
30       os= "Dp";
31     }
32     else
33     {
34       os= "dp";
35     }
36   }
37   else { os = #[1]; }
38   execute "ring sr=("+charstr(dr)+"),("+varstr(dr)+"),"+os+";";
39   ideal i= fetch(dr,i);
40   intvec opt= option(get);
41   option(redSB);
42   i=std(i);
43   option(set,opt);
44   setring dr;
45   return (fglm(sr,i));
46}
47example
48{ "EXAMPLE:"; echo = 2;
49   ring r  = 0,(x,y,z),lp;
50   ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y;
51   ideal i1= stdfglm(i);         //uses fglm from "dp" to "lp"
52   i1;
53   ideal i2= stdfglm(i,"Dp");    //uses fglm from "Dp" to "lp"
54   i2;
55}
56///////////////////////////////////////////////////////////////////////////////
57
58proc stdhilbert(ideal i,list #)
59"USAGE:   stdhilbert(i);  i ideal
60         stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function)
61RETURN:  stdhilbert(i): a standard basis of i (computing v internally)
62         stdhilbert(i,v): standard basis of i, using the given Hilbert function
63EXAMPLE: example stdhilbert; shows an example
64"
65{
66   def R=basering;
67
68   if((homog(i)==1)||(ordstr(basering)[1]=="d"))
69   {
70      if ((size(#)!=0)&&(homog(i)==1))
71      {
72         return(std(i,#[1]));
73      }
74      return(std(i));
75   }
76
77   execute "ring S = ("+charstr(R)+"),("+varstr(R)+",@t),dp;";
78   ideal i=homog(imap(R,i),@t);
79   intvec v=hilb(std(i),1);
80   execute "ring T = ("+charstr(R)+"),("+varstr(R)+",@t),("+ordstr(R)+");";
81   ideal i=fetch(S,i);
82   ideal a=std(i,v);
83   setring R;
84   map phi=T,maxideal(1),1;
85   ideal a=phi(a);
86
87   int k,j;
88   poly m;
89   int c=size(i);
90
91   for(j=1;j<c;j++)
92   {
93     if(deg(a[j])==0)
94     {
95       a=ideal(1);
96       attrib(a,"isSB",1);
97       return(a);
98     }
99     if(deg(a[j])>0)
100     {
101       m=lead(a[j]);
102       for(k=j+1;k<=c;k++)
103       {
104          if(size(lead(a[k])/m)>0)
105          {
106            a[k]=0;
107          }
108       }
109     }
110   }
111   a=simplify(a,2);
112   attrib(a,"isSB",1);
113   return(a);
114}
115example
116{ "EXAMPLE:"; echo = 2;
117   ring  r = 0,(x,y,z),lp;
118   ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y;
119   ideal i1= stdhilbert(i); i1;
120   // is in this case equivalent to:
121   intvec v=1,0,0,-3,0,1,0,3,-1,-1;
122   ideal i2=stdhilbert(i,v);
123}
124///////////////////////////////////////////////////////////////////////////////
125
Note: See TracBrowser for help on using the repository browser.