1 | LIB "tst.lib"; tst_init(); |
---|
2 | proc algebraicDep(ideal J, poly g) |
---|
3 | { |
---|
4 | def R=basering; // give a name to the basering |
---|
5 | int n=size(J); |
---|
6 | int k=nvars(R); |
---|
7 | int i; |
---|
8 | intvec v; |
---|
9 | |
---|
10 | // construction of the new ring: |
---|
11 | |
---|
12 | // construct a weight vector |
---|
13 | v[n+k]=0; // gives a zero vector of length n+k |
---|
14 | for(i=1;i<=k;i++) |
---|
15 | { |
---|
16 | v[i]=1; |
---|
17 | } |
---|
18 | string orde="(a("+string(v)+"),dp);"; |
---|
19 | string ri="ring Rhelp=("+charstr(R)+"), |
---|
20 | ("+varstr(R)+",Y(1.."+string(n)+")),"+orde; |
---|
21 | // ring definition as a string |
---|
22 | execute(ri); // execution of the string |
---|
23 | |
---|
24 | // construction of the new ideal I=(J[1]-Y(1),...,J[n]-Y(n)) |
---|
25 | ideal I=imap(R,J); |
---|
26 | for(i=1;i<=n;i++) |
---|
27 | { |
---|
28 | I[i]=I[i]-var(k+i); |
---|
29 | } |
---|
30 | poly g=imap(R,g); |
---|
31 | if(g==0) |
---|
32 | { |
---|
33 | // construction of the ideal of relations by elimination |
---|
34 | poly el=var(1); |
---|
35 | for(i=2;i<=k;i++) |
---|
36 | { |
---|
37 | el=el*var(i); |
---|
38 | } |
---|
39 | ideal KK=eliminate(I,el); |
---|
40 | keepring(Rhelp); |
---|
41 | return(KK); |
---|
42 | } |
---|
43 | // reduction of g with respect to I |
---|
44 | ideal KK=reduce(g,std(I)); |
---|
45 | keepring(Rhelp); |
---|
46 | return(KK); |
---|
47 | } |
---|
48 | |
---|
49 | // applications of the procedure |
---|
50 | ring r=0,(x,y,z),dp; |
---|
51 | ideal i=xz,yz; |
---|
52 | algebraicDep(i,0); |
---|
53 | // Note: after call of algebraicDep(), the basering is Rhelp. |
---|
54 | setring r; kill Rhelp; |
---|
55 | ideal j=xy+z2,z2+y2,x2y2-2xy3+y4; |
---|
56 | algebraicDep(j,0); |
---|
57 | setring r; kill Rhelp; |
---|
58 | poly g=y2z2-xz; |
---|
59 | algebraicDep(i,g); |
---|
60 | // this shows that g is contained in i. |
---|
61 | setring r; kill Rhelp; |
---|
62 | algebraicDep(j,g); |
---|
63 | // this shows that g is contained in j. |
---|
64 | tst_status(1);$ |
---|