source: git/Tst/Short/rootisolation.tst @ 73248d

fieker-DuValspielwiese
Last change on this file since 73248d was 9fbca5, checked in by bendooru <bendooru@…>, 6 years ago
add rootisolation.tst
  • Property mode set to 100644
File size: 3.8 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4LIB "rootisolation.lib";
5
6// start with examples
7example bounds;
8example length;
9example boxSet;
10example ivmatInit;
11example ivmatSet;
12example unitMatrix;
13example ivmatGaussian;
14example evalPolyAtBox;
15example evalJacobianAtBox;
16example rootIsolationNoPreprocessing;
17example rootIsolation;
18
19// some interval/box only stuff
20ring R = 0,(x,y,z),dp;
21interval J = -2,1/5; J;
22// not enough intervals for box
23box B = list(J,J); B;
24// right number
25B = list(J,J,J); B;
26// too many intervals for box
27B = list(J,J,J,J); B;
28kill J,B,R;
29
30// trivial example
31ring R = 0,x,dp;
32ideal I = x;
33box B = list(bounds(-1,1));
34list roots = rootIsolation(I,B); roots;
35kill roots, B, R;
36
37// maximal ideal with single root
38ring R = 0,(x,y,z),dp;
39ideal I = x-3,y-2,z+2/3;
40box B = list(bounds(-5,5), bounds(-5,5), bounds(-5,5));
41list roots = rootIsolation(I,B); roots;
42kill roots, B, R;
43
44// roots of I lie on initial boundary
45ring R = 0,(x,y),dp;
46ideal I = x2-4,y2-4;
47box B = list(bounds(-2,2), bounds(-2,2));
48list roots = rootIsolation(I,B); roots;
49kill roots, B, R;
50
51// roots of I lie on initial boundary for several
52// iterations
53ring R = 0,(x,y),dp;
54ideal I = (x2-1)*(x2-4)*(x2-9),(y2-1)*(y2-4)*(y2-9);
55box B = list(bounds(-1,1), bounds(-1,1));
56list roots = rootIsolation(I,B); roots;
57kill roots, B, R;
58
59// starting box is a point
60ring R = 0,(x,y),dp;
61ideal I = x2-1,y2-9;
62box B = list(bounds(-1,-1), bounds(3,3));
63list roots = rootIsolation(I,B); roots;
64kill roots, B, R;
65
66// no real roots
67ring R = 0,(x,y),dp;
68ideal I = x2+1,y;
69box B = list(bounds(-100,100),bounds(-100,100));
70list roots = rootIsolation(I,B); roots;
71kill roots, B, R;
72
73// fixed bug: fglm lookup clashes with blackbox type
74ring R = 0,(x,y),dp;
75ideal I = x2-1,y-3;
76interval fastGB = -10,10;
77box B = list(fastGB, fastGB);
78list roots = rootIsolation(I,B); roots;
79kill roots, fastGB, B, R;
80
81// eps > 0, some boxes land in result[1]
82ring R = 0,(x,y),dp;
83ideal I = 2x2-xy+2y2-2,2x2-3xy+3y2-2;
84box B = list(bounds(-3/2,3/2), bounds(-3/2,3/2));
85list roots = rootIsolation(I,B,1/10); roots;
86kill roots, B, R;
87
88// too many generators but reduced Groebner basis with 2 generators exists
89ring R = 0,(x,y),dp;
90ideal I =
91  x3-4x2y+5y2+4x,
92  20y4-60x2y-5xy2-25y3+11x2-84xy+100y2+60x+100y+59,
93  4xy3+16x2y+xy2+5y3+x2+4xy-20y2-12x-16y+1,
94  4x2y2-xy2-5y3-x2-4xy-1;
95box B = list(bounds(-4,4), bounds(-4,4));
96list roots = rootIsolation(I, B); roots;
97kill roots, B, R;
98
99// 6 generators (this is a Groebner basis), no reduced GB has 3 generators
100ring R = 0,(x,y,z),dp;
101ideal I = yz-x,xz-y,y2-z2,xy-z,x2-z2,z3-z;
102box B = list(bounds(-5,5),bounds(-5,5),bounds(-5,5));
103list roots = rootIsolation(I, B); roots;
104kill roots, B, R;
105
106// no radical but zero-dimensional, |V(I)| = 2
107ring R = 0,(x,y,z),dp;
108ideal I = y2-xy-2zx,y3+z2+1,x2yz-yz;
109box B = list(bounds(-5,5), bounds(-5,5), bounds(-5,5));
110list roots = rootIsolation(I, B); roots;
111kill roots, B, R;
112
113// not zero-dimensional
114ring R = 0,(x,y,z),dp;
115ideal I = x2-x,y2-1,x;
116box B = list(bounds(-1,1),bounds(-1,1),bounds(-1,1));
117list roots = rootIsolation(I, B); roots;
118kill roots, B, R;
119
120// automatically determine starting box
121ring R = 0,(x,y),dp;
122ideal I = 2x2-xy+2y2-2,2x2-3xy+3y2-2;
123list roots = rootIsolation(I); roots;
124kill roots, R;
125
126// apply to primary decomposition
127ring R = 0,(x,y,z),dp;
128ideal I = yz-x,xz-y,y2-z2,xy-z,x2-z2,z3-z;
129list roots = rootIsolationPrimdec(I); roots;
130kill roots, R;
131
132// slightly longer example
133ring R = 0,(a,b,c,d,t),dp;
134ideal I =
135  a4+a2c2+3c4-1,
136  4a3b+2abc2+2a2cd+12c3d,
137  6a2b2+b2c2+4abcd+a2d2+18c2d2-1,
138  4ab3+2b2cd+2abd2+12cd3,
139  b4+b2d2+3d4-t;
140interval i = -100,100;
141interval j = 0,2;
142box B = list(i,i,i,i,j);
143list roots1 = rootIsolation(I,B); roots1;
144// compare to case where we use triangular decomposition
145list roots2 = rootIsolation(std(I),B); roots2;
146kill roots1, roots2, i, j, B, R;
147
148tst_status(1);$;
149// vim: ft=singular
Note: See TracBrowser for help on using the repository browser.