1 | // $Id: standard.lib,v 1.7 1998-04-03 22:47:14 krueger Exp $ |
---|
2 | /////////////////////////////////////////////////////////////////////////////// |
---|
3 | |
---|
4 | version="$Id: standard.lib,v 1.7 1998-04-03 22:47:14 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 | string os; |
---|
23 | def dr= basering; |
---|
24 | if( (size(#)==0) or (typeof(#[1]) != "string") ) |
---|
25 | { |
---|
26 | os = "dp(" + string( nvars(dr) ) + ")"; |
---|
27 | if ( (find( ordstr(dr), os ) != 0) and (find( ordstr(dr), "a") == 0) ) |
---|
28 | { |
---|
29 | os= "Dp"; |
---|
30 | } |
---|
31 | else |
---|
32 | { |
---|
33 | os= "dp"; |
---|
34 | } |
---|
35 | } |
---|
36 | else { os = #[1]; } |
---|
37 | execute "ring sr=("+charstr(dr)+"),("+varstr(dr)+"),"+os+";"; |
---|
38 | ideal i= fetch(dr,i); |
---|
39 | intvec opt= option(get); |
---|
40 | option(redSB); |
---|
41 | i=std(i); |
---|
42 | option(set,opt); |
---|
43 | setring dr; |
---|
44 | return (fglm(sr,i)); |
---|
45 | } |
---|
46 | example |
---|
47 | { "EXAMPLE:"; echo = 2; |
---|
48 | ring r = 0,(x,y,z),lp; |
---|
49 | ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y; |
---|
50 | ideal i1= stdfglm(i); //uses fglm from "dp" to "lp" |
---|
51 | i1; |
---|
52 | ideal i2= stdfglm(i,"Dp"); //uses fglm from "Dp" to "lp" |
---|
53 | i2; |
---|
54 | } |
---|
55 | /////////////////////////////////////////////////////////////////////////////// |
---|
56 | |
---|
57 | proc stdhilbert(ideal i,list #) |
---|
58 | USAGE: stdhilbert(i); i ideal |
---|
59 | stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function) |
---|
60 | RETURN: stdhilbert(i): a standard basis of i (computing v internally) |
---|
61 | stdhilbert(i,v): standard basis of i, using the given Hilbert function |
---|
62 | EXAMPLE: example stdhilbert; shows an example |
---|
63 | { |
---|
64 | def R=basering; |
---|
65 | |
---|
66 | if((homog(i)==1)||(ordstr(basering)[1]=="d")) |
---|
67 | { |
---|
68 | if ((size(#)!=0)&&(homog(i)==1)) |
---|
69 | { |
---|
70 | return(std(i,#[1])); |
---|
71 | } |
---|
72 | return(std(i)); |
---|
73 | } |
---|
74 | |
---|
75 | execute "ring S = ("+charstr(R)+"),("+varstr(R)+",@t),dp;"; |
---|
76 | ideal i=homog(imap(R,i),@t); |
---|
77 | intvec v=hilb(std(i),1); |
---|
78 | execute "ring T = ("+charstr(R)+"),("+varstr(R)+",@t),("+ordstr(R)+");"; |
---|
79 | ideal i=fetch(S,i); |
---|
80 | ideal a=std(i,v); |
---|
81 | setring R; |
---|
82 | map phi=T,maxideal(1),1; |
---|
83 | ideal a=phi(a); |
---|
84 | |
---|
85 | int k,j; |
---|
86 | poly m; |
---|
87 | int c=size(i); |
---|
88 | |
---|
89 | for(j=1;j<c;j++) |
---|
90 | { |
---|
91 | if(deg(a[j])==0) |
---|
92 | { |
---|
93 | a=ideal(1); |
---|
94 | attrib(a,"isSB",1); |
---|
95 | return(a); |
---|
96 | } |
---|
97 | if(deg(a[j])>0) |
---|
98 | { |
---|
99 | m=lead(a[j]); |
---|
100 | for(k=j+1;k<=c;k++) |
---|
101 | { |
---|
102 | if(size(lead(a[k])/m)>0) |
---|
103 | { |
---|
104 | a[k]=0; |
---|
105 | } |
---|
106 | } |
---|
107 | } |
---|
108 | } |
---|
109 | a=simplify(a,2); |
---|
110 | attrib(a,"isSB",1); |
---|
111 | return(a); |
---|
112 | } |
---|
113 | example |
---|
114 | { "EXAMPLE:"; echo = 2; |
---|
115 | ring r = 0,(x,y,z),lp; |
---|
116 | ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y; |
---|
117 | ideal i1= stdhilbert(i); i1; |
---|
118 | // is in this case equivalent to: |
---|
119 | intvec v=1,0,0,-3,0,1,0,3,-1,-1; |
---|
120 | ideal i2=stdhilbert(i,v); |
---|
121 | } |
---|
122 | /////////////////////////////////////////////////////////////////////////////// |
---|
123 | |
---|