1 | // $Id$ |
---|
2 | |
---|
3 | // |
---|
4 | // resultantp_s.tst - short tests for resultant calculations mod p. |
---|
5 | // |
---|
6 | // All univariate non-trivial examples come from gcdUnivP.fex or |
---|
7 | // gcdUnivPAlpha.fex. Most of the examples have a non-trivial gcd, so we |
---|
8 | // compute always an disturbed example, too. Some extra checks are added |
---|
9 | // for calculation of resultants of polys of same degree. |
---|
10 | // |
---|
11 | // The examples involving a transcendental variable are the same as the |
---|
12 | // examples with algebraic variables. |
---|
13 | // |
---|
14 | // To Do: |
---|
15 | // |
---|
16 | // o multivariate resultant calculations |
---|
17 | // |
---|
18 | |
---|
19 | LIB "tst.lib"; |
---|
20 | tst_init(); |
---|
21 | tst_ignore("CVS ID : $Id$"); |
---|
22 | |
---|
23 | // |
---|
24 | // - ring r1=32003,x,dp. |
---|
25 | // |
---|
26 | |
---|
27 | tst_ignore( "ring r1=32003,x,dp;" ); |
---|
28 | ring r1=32003,x,dp; |
---|
29 | |
---|
30 | poly f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
31 | poly g; |
---|
32 | |
---|
33 | // some trivial examples |
---|
34 | resultant(0, 0, x); |
---|
35 | resultant(0, 3123, x); |
---|
36 | resultant(4353, 0, x); |
---|
37 | |
---|
38 | resultant(0, f, x); |
---|
39 | resultant(f, 0, x); |
---|
40 | |
---|
41 | resultant(23123, f, x); |
---|
42 | resultant(f, 13123, x); |
---|
43 | |
---|
44 | // some less trivial examples |
---|
45 | f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
46 | g=-9554*x^3-3341*x^2+6213*x; |
---|
47 | resultant(f, g, x); |
---|
48 | resultant(f, g+1, x); |
---|
49 | resultant(f, g*x+1, x); |
---|
50 | |
---|
51 | f=-11265*x^6+12161*x^5+10369*x^4-12161*x^3+896*x^2; |
---|
52 | g=10669*x^8-10673*x^7+5*x^6+8*x^5-10681*x^4+10665*x^3+7*x^2; |
---|
53 | resultant(f, g, x); |
---|
54 | resultant(f, g+1, x); |
---|
55 | resultant(f*x^2, g+1, x); |
---|
56 | |
---|
57 | f=-7918*x^9-14406*x^8-7256*x^7+2092*x^6-2198*x^5-12539*x^4-14631*x^3-7150*x^2; |
---|
58 | g=-14833*x^13-7011*x^12+15121*x^11-10864*x^10+12943*x^9-9871*x^8+10354*x^7-1437*x^6+6604*x^5-10394*x^4-3231*x^3-9348*x^2-2092*x; |
---|
59 | resultant(f, g, x); |
---|
60 | resultant(f, g+1, x); |
---|
61 | |
---|
62 | f=106*x^13-583*x^12-1060*x^11+8056*x^10+1696*x^9-327*x^8+12508*x^7+8277*x^6+5609*x^5-12879*x^4+13144*x^3-2544*x^2; |
---|
63 | g=11118*x^14-5404*x^13-908*x^12-13908*x^11+3188*x^10-8818*x^9+10439*x^8-14811*x^7+15530*x^6-4891*x^5+6322*x^4+15829*x^3-13686*x^2; |
---|
64 | resultant(f, g, x); |
---|
65 | resultant(f, g+1, x); |
---|
66 | |
---|
67 | f=-14613*x^17+2235*x^16-298*x^15+4540*x^14+7214*x^13+5494*x^12-3122*x^11-4720*x^10+8300*x^9-6582*x^8-9908*x^7-15983*x^6-5802*x^5-8634*x^4+7899*x^3+10556*x^2+6931*x+11063; |
---|
68 | g=-10168*x^20+6674*x^19+3004*x^18+13113*x^17+9449*x^16+9097*x^15-6420*x^14+50*x^13+434*x^12-15226*x^11+3727*x^10-14065*x^9-9751*x^8-15792*x^7+6004*x^6-5059*x^5+2479*x^4-12504*x^3-11328*x^2-11338*x-8280; |
---|
69 | resultant(f, g, x); |
---|
70 | resultant(f, g+1, x); |
---|
71 | |
---|
72 | f=3812*x^22-6874*x^21+12586*x^20+3003*x^19-9568*x^18+11117*x^17 +7524*x^16+11138*x^15-9743*x^14+1892*x^13+12485*x^12-569*x^11-8265*x^10-5991*x^9+13701*x^8+2644*x^7-3936*x^6-15875*x^5+1289*x^4+3956*x^3-10099*x^2-6616*x+5401; |
---|
73 | g=10652*x^20-4144*x^19-11810*x^18+8237*x^17-8675*x^16+6545*x^15-3601*x^14+14559*x^13+8090*x^12-8378*x^11+14255*x^10+8767*x^9-13932*x^8+11602*x^7-10751*x^6-4899*x^5+8637*x^4+14084*x^3-11583*x^2+5882*x+885; |
---|
74 | resultant(f, g, x); |
---|
75 | resultant(f, g+1, x); |
---|
76 | |
---|
77 | // |
---|
78 | // - ring r2=(32003,a),x,dp; minpoly=a^4+8734*a^3+a^2+11817*a+1. |
---|
79 | // |
---|
80 | |
---|
81 | tst_ignore( "ring r2=(32003,a),x,dp;" ); |
---|
82 | ring r2=(32003,a),x,dp; |
---|
83 | minpoly=a^4+8734*a^3+a^2+11817*a+1; |
---|
84 | |
---|
85 | poly f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
86 | poly g; |
---|
87 | |
---|
88 | // first, some of the r1 examples |
---|
89 | resultant(0, 0, x); |
---|
90 | resultant(0, 3123, x); |
---|
91 | resultant(4353, 0, x); |
---|
92 | |
---|
93 | resultant(0, f, x); |
---|
94 | resultant(f, 0, x); |
---|
95 | |
---|
96 | resultant(23123, f, x); |
---|
97 | resultant(f, 13123, x); |
---|
98 | |
---|
99 | // some less trivial examples |
---|
100 | f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
101 | g=-9554*x^3-3341*x^2+6213*x; |
---|
102 | resultant(f, g, x); |
---|
103 | resultant(f, g+1, x); |
---|
104 | resultant(f, g*x+1, x); |
---|
105 | |
---|
106 | f=-11265*x^6+12161*x^5+10369*x^4-12161*x^3+896*x^2; |
---|
107 | g=10669*x^8-10673*x^7+5*x^6+8*x^5-10681*x^4+10665*x^3+7*x^2; |
---|
108 | resultant(f, g, x); |
---|
109 | resultant(f, g+1, x); |
---|
110 | resultant(f*x^2, g+1, x); |
---|
111 | |
---|
112 | // now, examples involving the algebraic variable |
---|
113 | f=(25836*a^3*x^6+30467*a^2*x^6+26792*a*x^6+30467*x^6+27083*a^3*x^5+30808*a^2*x^5+28163*a*x^5+292*x^5+12440*a^3*x^4+19396*a^2*x^4+19616*a*x^4+23236*x^4+25156*a^3*x^3+31764*a^2*x^3+31235*a*x^3+6459*x^3); |
---|
114 | g=(14670*a^3*x^6+19715*a^2*x^6+22318*a*x^6+19715*x^6+19743*a^3*x^5+28179*a^2*x^5+19715*a*x^5+7335*x^5+6379*a^3*x^4+11397*a^2*x^4+23599*a*x^4+9861*x^4+16005*a^3*x^3+31525*a^2*x^3+30467*a*x^3+12918*x^3); |
---|
115 | resultant(f, g, x); |
---|
116 | resultant(f, g+1, x); |
---|
117 | |
---|
118 | f=(21147*a^3*x^5+10147*a^3*x^4+8142*a^2*x^4+27671*a*x^4+29289*x^4+29289*a^3*x^3); |
---|
119 | g=(6167*a^3*x^6+1536*a^2*x^6+5211*a*x^6+1536*x^6+17534*a^3*x^5+478*a^2*x^5+1536*a*x^5+19085*x^5+3203*a^3*x^4+26578*a^2*x^4+17052*a*x^4+26770*x^4+26002*a^3*x^3+24062*a^2*x^3+192*a*x^3+6386*x^3); |
---|
120 | resultant(f, g, x); |
---|
121 | resultant(f, g+1, x); |
---|
122 | |
---|
123 | f=(2295*a^2*x^11+5897*a^3*x^10+765*a^2*x^10+27718*a^3*x^9+1283*a^2*x^9+23792*a*x^9+518*x^9+22026*a^3*x^8+11468*a^2*x^8+16834*a*x^8+24778*x^8+28460*a^3*x^7+8140*a^2*x^7+28036*a*x^7+1613*x^7+18196*a^3*x^6+13274*a^2*x^6+4638*a*x^6+31194*x^6+12206*a^3*x^5+10349*a^2*x^5+30979*a*x^5+8612*x^5); |
---|
124 | g=(8192*a^3*x^10+8957*a^2*x^10+9659*a^3*x^9+28672*a^2*x^9+4553*a*x^9+12288*x^9+5819*a^3*x^8+320*a^2*x^8+14380*a*x^8+12104*x^8+12047*a^3*x^7+19823*a^2*x^7+6824*a*x^7+4335*x^7+29376*a^3*x^6+22190*a^2*x^6+31239*a*x^6+22647*x^6); |
---|
125 | resultant(f, g, x); |
---|
126 | resultant(f, g+1, x); |
---|
127 | |
---|
128 | // |
---|
129 | // - ring r3=(32003,t),x,dp. |
---|
130 | // |
---|
131 | |
---|
132 | tst_ignore( "ring r3=(32003,t),x,dp;" ); |
---|
133 | ring r3=(32003,t),x,dp; |
---|
134 | |
---|
135 | poly f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
136 | poly g; |
---|
137 | |
---|
138 | // first, some of the r1 examples |
---|
139 | resultant(0, 0, x); |
---|
140 | resultant(0, 3123, x); |
---|
141 | resultant(4353, 0, x); |
---|
142 | |
---|
143 | resultant(0, f, x); |
---|
144 | resultant(f, 0, x); |
---|
145 | |
---|
146 | resultant(23123, f, x); |
---|
147 | resultant(f, 13123, x); |
---|
148 | |
---|
149 | // some less trivial examples |
---|
150 | f=-9554*x^4-12895*x^3-10023*x^2-6213*x; |
---|
151 | g=-9554*x^3-3341*x^2+6213*x; |
---|
152 | resultant(f, g, x); |
---|
153 | resultant(f, g+1, x); |
---|
154 | resultant(f, g*x+1, x); |
---|
155 | |
---|
156 | f=-11265*x^6+12161*x^5+10369*x^4-12161*x^3+896*x^2; |
---|
157 | g=10669*x^8-10673*x^7+5*x^6+8*x^5-10681*x^4+10665*x^3+7*x^2; |
---|
158 | resultant(f, g, x); |
---|
159 | resultant(f, g+1, x); |
---|
160 | resultant(f*x^2, g+1, x); |
---|
161 | |
---|
162 | // now, examples involving the transcendental variable |
---|
163 | f=(25836*t^3*x^6+30467*t^2*x^6+26792*t*x^6+30467*x^6+27083*t^3*x^5+30808*t^2*x^5+28163*t*x^5+292*x^5+12440*t^3*x^4+19396*t^2*x^4+19616*t*x^4+23236*x^4+25156*t^3*x^3+31764*t^2*x^3+31235*t*x^3+6459*x^3); |
---|
164 | g=(14670*t^3*x^6+19715*t^2*x^6+22318*t*x^6+19715*x^6+19743*t^3*x^5+28179*t^2*x^5+19715*t*x^5+7335*x^5+6379*t^3*x^4+11397*t^2*x^4+23599*t*x^4+9861*x^4+16005*t^3*x^3+31525*t^2*x^3+30467*t*x^3+12918*x^3); |
---|
165 | resultant(f, g, x); |
---|
166 | resultant(f, g+1, x); |
---|
167 | |
---|
168 | f=(21147*t^3*x^5+10147*t^3*x^4+8142*t^2*x^4+27671*t*x^4+29289*x^4+29289*t^3*x^3); |
---|
169 | g=(6167*t^3*x^6+1536*t^2*x^6+5211*t*x^6+1536*x^6+17534*t^3*x^5+478*t^2*x^5+1536*t*x^5+19085*x^5+3203*t^3*x^4+26578*t^2*x^4+17052*t*x^4+26770*x^4+26002*t^3*x^3+24062*t^2*x^3+192*t*x^3+6386*x^3); |
---|
170 | resultant(f, g, x); |
---|
171 | resultant(f, g+1, x); |
---|
172 | |
---|
173 | f=(2295*t^2*x^11+5897*t^3*x^10+765*t^2*x^10+27718*t^3*x^9+1283*t^2*x^9+23792*t*x^9+518*x^9+22026*t^3*x^8+11468*t^2*x^8+16834*t*x^8+24778*x^8+28460*t^3*x^7+8140*t^2*x^7+28036*t*x^7+1613*x^7+18196*t^3*x^6+13274*t^2*x^6+4638*t*x^6+31194*x^6+12206*t^3*x^5+10349*t^2*x^5+30979*t*x^5+8612*x^5); |
---|
174 | g=(8192*t^3*x^10+8957*t^2*x^10+9659*t^3*x^9+28672*t^2*x^9+4553*t*x^9+12288*x^9+5819*t^3*x^8+320*t^2*x^8+14380*t*x^8+12104*x^8+12047*t^3*x^7+19823*t^2*x^7+6824*t*x^7+4335*x^7+29376*t^3*x^6+22190*t^2*x^6+31239*t*x^6+22647*x^6); |
---|
175 | resultant(f, g, x); |
---|
176 | resultant(f, g+1, x); |
---|
177 | tst_status(1);$ |
---|