1 | // $Id: standard.lib,v 1.8 1998-05-05 11:55:38 krueger Exp $ |
---|
2 | /////////////////////////////////////////////////////////////////////////////// |
---|
3 | |
---|
4 | version="$Id: standard.lib,v 1.8 1998-05-05 11:55:38 krueger Exp $"; |
---|
5 | info=" |
---|
6 | LIBRARY: 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 | |
---|
14 | proc stdfglm (ideal i, list #) |
---|
15 | "USAGE: stdfglm(i[,s]); i ideal, s string (any allowed ordstr of a ring) |
---|
16 | RETURN: 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. |
---|
20 | EXAMPLE: 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 | } |
---|
47 | example |
---|
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 | |
---|
58 | proc stdhilbert(ideal i,list #) |
---|
59 | "USAGE: stdhilbert(i); i ideal |
---|
60 | stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function) |
---|
61 | RETURN: stdhilbert(i): a standard basis of i (computing v internally) |
---|
62 | stdhilbert(i,v): standard basis of i, using the given Hilbert function |
---|
63 | EXAMPLE: 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 | } |
---|
115 | example |
---|
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 | |
---|