1 | // File: primitiv_l.tst |
---|
2 | // Intensive tests for primitiv lib |
---|
3 | LIB "tst.lib"; |
---|
4 | tst_init(); |
---|
5 | LIB "primitiv.lib"; |
---|
6 | // ------------ test of primitive and primitive_extra: ------------------- |
---|
7 | printlevel=3; |
---|
8 | ring r=0,x,dp; |
---|
9 | primitive(ideal(x2+1)); |
---|
10 | kill r; |
---|
11 | ring r=0,(x,y),dp; |
---|
12 | ideal i=x2-2,y2-3; |
---|
13 | ideal j=primitive(i); |
---|
14 | factorize(j[1]); |
---|
15 | ring r1=(0,a),x,lp; |
---|
16 | map phi=r,x,a; |
---|
17 | string s=string(phi(j)[1]); |
---|
18 | execute("minpoly="+s+";"); |
---|
19 | ideal v=phi(j)[1],phi(j)[2]^2-2,phi(j)[3]^2-3; |
---|
20 | v; |
---|
21 | if (size(v)>0) |
---|
22 | { "ERROR!!! Result of primitive(i) is not a primitive element!"; } |
---|
23 | // else minpoly(a)=0, g_1(a) is squareroot of 2, g_2(a) is squareroot of 3 |
---|
24 | // as it should be |
---|
25 | setring r; |
---|
26 | primitive_extra(i); |
---|
27 | i=x2-3,y2-x; |
---|
28 | primitive(i); |
---|
29 | primitive_extra(i); |
---|
30 | kill r; |
---|
31 | ring r=0,(x(0..3)),lp; |
---|
32 | int zeit=timer; |
---|
33 | ideal i=x(0)^2-2,x(1)^2-3,x(2)^3-x(0)^2+x(1),x(3)^2-x(2); |
---|
34 | primitive(i); |
---|
35 | tst_ignore(timer-zeit,"time"); |
---|
36 | kill r; |
---|
37 | ring r=0,(x,y),dp; |
---|
38 | poly f1=39x7+37x6+11x5+48x4+30x3+30x2+14x+49; |
---|
39 | poly f2=43x5y2+8x2y5+40x6+48y6+22x4y+7x2y3+7x2y2+16x3+49x2+x+12y+40; |
---|
40 | zeit=timer; |
---|
41 | ideal o=primitive(ideal(f1,f2)); |
---|
42 | tst_ignore(timer-zeit,"time"); |
---|
43 | tst_ignore(kmemory(),"memory"); |
---|
44 | "size of the result :",size(string(o)),"characters"; |
---|
45 | zeit=timer; |
---|
46 | o=primitive_extra(ideal(f1,f2)); |
---|
47 | tst_ignore(timer-zeit,"time"); |
---|
48 | tst_ignore(kmemory(),"memory"); |
---|
49 | "size of the result :",size(string(o)),"characters"; |
---|
50 | kill r; |
---|
51 | ring r=3,(x,y,z),dp; |
---|
52 | ideal i=x2+1,y3-y-1,z2+yz-1; |
---|
53 | primitive(i); |
---|
54 | primitive_extra(i); |
---|
55 | primitive_extra(ideal(i[1],i[2])); |
---|
56 | kill r; |
---|
57 | // ------------ test of splitring: ------------------- |
---|
58 | ring r=2,a,Dp; |
---|
59 | splitring(a3+a+1,""); |
---|
60 | r; |
---|
61 | kill r; |
---|
62 | ring r=7,(a,b,c,d,e,n,o,p),Ds; |
---|
63 | splitring(a2+2,"never"); |
---|
64 | kill r; |
---|
65 | ring r=0,(x,y),ds; |
---|
66 | splitring(x2-5,"R1"); |
---|
67 | R1; |
---|
68 | list l=splitring(x2-7,"R2",a); |
---|
69 | l[1]^2; |
---|
70 | R2; |
---|
71 | splitring(y2+1,"",a); |
---|
72 | R2; |
---|
73 | kill r,R1,R2; |
---|
74 | ring r=(2003,j),(a,b,c,d),dp; |
---|
75 | minpoly=j2-2; |
---|
76 | list l=splitring(b3+b2+b-2,"R1",list(a,b,c,d,j)); |
---|
77 | l; |
---|
78 | number(l[5])^2; |
---|
79 | factorize(b3+b2+b-2); |
---|
80 | list L=splitring(c2-2j,"",list(a2+ja,j,l[5])); |
---|
81 | L; |
---|
82 | L[3]^2; |
---|
83 | kill R1,r; |
---|
84 | // ------------ test of randomLast: ------------------ |
---|
85 | example randomLast; |
---|
86 | $ |
---|