source: git/Tst/BuchDL/sol.lib @ 853a8a

spielwiese
Last change on this file since 853a8a was 9558c5f, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes/lossen: very long examples from DL-Book git-svn-id: file:///usr/local/Singular/svn/trunk@8762 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.0 KB
Line 
1version = "1.0";
2info = "solution to Exercise 2.4";
3//
4proc ideal_intersect (ideal I, ideal J)
5"USAGE:   ideal_intersect(I,J);    I,J ideals
6RETURN:  ideal
7NOTE:    Output is generating set for the intersection of I and J.
8EXAMPLE: example ideal_intersect; shows an example
9"
10{
11  int r = size(I);
12  int s = size(J);
13  if ((r==0) or (s==0)) { return(ideal(0)); }
14  module M = gen(1)+gen(2);
15  for ( int i=1;i<=r;i++ ) { M = M, I[i]*gen(1); }
16  for ( i=1;i<=s;i++ ) { M = M, J[i]*gen(2); }
17  module S = syz(M);
18  ideal result;
19  for ( i=ncols(S);i>0;i-- ) { result[i] = S[i][1]; }
20  return(simplify(result,2));      // remove zeros in result
21}
22example
23{ "EXAMPLE:"; echo = 2;
24  ring R = 0, (x,y), dp;
25  ideal I = x2, y;
26  ideal J = x, y2;
27  ideal_intersect(I,J);
28}
29//
30proc ideal_quotient (ideal I, ideal J)
31"USAGE:   ideal_quotient(I,J);    I,J ideals
32RETURN:  ideal
33NOTE:    Output is generating set for the quotient I:J.
34EXAMPLE: example ideal_quotient; shows an example
35"
36{
37  int r = size(I);
38  int s = size(J);
39  if ((r==0)) { return(ideal(0)); }
40  if ((s==0)) { return(I); }
41  vector v;
42  for ( int i=1;i<=s;i++ ) { v = v+J[i]*gen(i); }
43  module M = v;
44  for ( int j=1;j<=s;j++ )
45  {
46    for ( i=1;i<=r;i++ ) { M = M, I[i]*gen(j); }
47  }
48  module S = syz(M);
49  ideal result;
50  for ( i=ncols(S);i>0;i-- ) { result[i] = S[i][1]; }
51  return(simplify(result,2));
52  return(result);
53}
54example
55{ "EXAMPLE:"; echo = 2;
56  ring R = 0, (x,y), dp;
57  ideal I = x2, y;
58  ideal J = x, y2;
59  ideal_quotient(I,J);
60}
61//
62proc saturate (ideal I, ideal J)
63"USAGE:   saturate(I,J);    I,J ideals
64RETURN:  ideal
65NOTE:    Output is generating set for the saturation of I with
66         respect to J.
67EXAMPLE: example saturate; shows an example
68"
69{
70  ideal I_old = groebner(I);
71  ideal I_new;
72  while (1)
73  {
74    I_new = groebner(ideal_quotient(I_old,J));
75    if (size(reduce(I_new,I_old))==0) { return(I_new); }
76    I_old = I_new;
77  }
78}
79example
80{ "EXAMPLE:"; echo = 2;
81  ring R = 0, (x,y), dp;
82  ideal I = x5*(x-1), y3;
83  ideal J = x, y2;
84  saturate(I,J);
85}
Note: See TracBrowser for help on using the repository browser.