[559a4b] | 1 | // $Id: gcd0_s.tst,v 1.1 1998-04-21 12:55:43 schmidt Exp $ |
---|
| 2 | |
---|
| 3 | // |
---|
| 4 | // gcd0_s.tst - short tests for gcd calculations in Z. |
---|
| 5 | // |
---|
| 6 | // All univariate non-trivial examples come from gcdUniv0Std.fex or |
---|
| 7 | // gcdUniv0Alpha.fex. Some of the examples are multiplied with elements |
---|
| 8 | // from Q to test clearing of denominators. |
---|
| 9 | // |
---|
| 10 | // The examples in variables `u' and `v' came from `coprasse(2/0/1)' |
---|
| 11 | // in stdMultiv0Gcd.in. |
---|
| 12 | // |
---|
| 13 | // To Do: |
---|
| 14 | // |
---|
| 15 | // o multivariate gcd calculations with parameters |
---|
| 16 | // o algrebraic extensions of char 0 not implemented yet |
---|
| 17 | // (but tests already exist) |
---|
| 18 | // |
---|
| 19 | |
---|
| 20 | LIB "tst.lib"; |
---|
| 21 | tst_init(); |
---|
| 22 | tst_ignore("CVS ID : $Id: gcd0_s.tst,v 1.1 1998-04-21 12:55:43 schmidt Exp $"); |
---|
| 23 | |
---|
| 24 | // |
---|
| 25 | // - ring r1=0,x,dp. |
---|
| 26 | // |
---|
| 27 | |
---|
| 28 | tst_ignore( "ring r1=0,x,dp;" ); |
---|
| 29 | ring r1=0,x,dp; |
---|
| 30 | |
---|
| 31 | poly f=(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 32 | poly g; |
---|
| 33 | |
---|
| 34 | // some trivial examples |
---|
| 35 | gcd(0, 0); |
---|
| 36 | gcd(0, 3123); |
---|
| 37 | gcd(4353, 0); |
---|
| 38 | |
---|
| 39 | gcd(0, f); |
---|
| 40 | gcd(f, 0); |
---|
| 41 | |
---|
| 42 | gcd(23123, f); |
---|
| 43 | gcd(f, 13123); |
---|
| 44 | |
---|
| 45 | // some trivial examples involving rational numbers |
---|
| 46 | f=11/47894*19*(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 47 | |
---|
| 48 | gcd(0, 3123/123456); |
---|
| 49 | gcd(4353/8798798, 0); |
---|
| 50 | |
---|
| 51 | gcd(0, f); |
---|
| 52 | gcd(f, 0); |
---|
| 53 | |
---|
| 54 | gcd(23123/3, f); |
---|
| 55 | gcd(f, 13123/2); |
---|
| 56 | |
---|
| 57 | // some less trivial examples |
---|
| 58 | f=(2*x^3+2*x^2+2*x); |
---|
| 59 | g=(x^3+2*x^2+2*x+1); |
---|
| 60 | gcd(f, g); |
---|
| 61 | |
---|
| 62 | f=(-x^9-6*x^8-11*x^7-17*x^6-14*x^5-14*x^4-8*x^3-6*x^2-2*x-1); |
---|
| 63 | g=(-x^9-2*x^8-2*x^7-3*x^4-6*x^3-6*x^2-3*x-1); |
---|
| 64 | gcd(f, g); |
---|
| 65 | |
---|
| 66 | f=(4*x^9+12*x^8+29*x^7+42*x^6+54*x^5+48*x^4+35*x^3+17*x^2+6*x+1); |
---|
| 67 | g=(x^11+6*x^10+11*x^9+17*x^8+14*x^7+14*x^6+8*x^5+6*x^4+2*x^3+x^2); |
---|
| 68 | gcd(f, g); |
---|
| 69 | gcd(1/13*f, 1/4*g); |
---|
| 70 | |
---|
| 71 | f=(1412500*x^6+6218750*x^5-6910000*x^4-1201250*x^3-19470000*x^2-27277500*x); |
---|
| 72 | g=(156600000*x^5-1363865625*x^4+2627604000*x^3-2727731250*x^2+4628808000*x); |
---|
| 73 | gcd(f, g); |
---|
| 74 | |
---|
| 75 | // |
---|
| 76 | // - ring r2=(0,a),x,dp; minpoly=a^4+a^3+a^2+a+1. |
---|
| 77 | // |
---|
| 78 | |
---|
| 79 | tst_ignore( "ring r2=(0,a),x,dp;" ); |
---|
| 80 | ring r2=(0,a),x,dp; |
---|
| 81 | minpoly=a^4+a^3+a^2+a+1; |
---|
| 82 | |
---|
| 83 | poly f=(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 84 | poly g; |
---|
| 85 | |
---|
| 86 | // first, some of the r1 examples (slightly modified) |
---|
| 87 | gcd(0, 0); |
---|
| 88 | gcd(0, 3123*a); |
---|
| 89 | gcd(4353, 0); |
---|
| 90 | |
---|
| 91 | gcd(0, f); |
---|
| 92 | gcd(f, 0); |
---|
| 93 | |
---|
| 94 | gcd(23123, f); |
---|
| 95 | gcd(f, 13123); |
---|
| 96 | |
---|
| 97 | // some trivial examples involving rational numbers |
---|
| 98 | f=11/47894*19*(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 99 | |
---|
| 100 | gcd(0, 3123/(123456*a)); |
---|
| 101 | gcd(4353/8798798, 0); |
---|
| 102 | |
---|
| 103 | gcd(0, f/a); |
---|
| 104 | gcd(f, 0); |
---|
| 105 | |
---|
| 106 | gcd(23123/(3*a), f); |
---|
| 107 | gcd(f, 13123/2); |
---|
| 108 | |
---|
| 109 | // some less trivial examples |
---|
| 110 | f=(2*x^3+2*x^2+2*x); |
---|
| 111 | g=(x^3+2*x^2+2*x+1); |
---|
| 112 | gcd(f, g); |
---|
| 113 | |
---|
| 114 | // we go on with modified variable names |
---|
| 115 | tst_ignore( "ring r2=(0,v),u,dp;" ); |
---|
| 116 | kill r2; |
---|
| 117 | ring r2=(0,v),u,dp; |
---|
| 118 | minpoly=v^4+v^3+v^2+v+1; |
---|
| 119 | |
---|
| 120 | poly f; |
---|
| 121 | poly g; |
---|
| 122 | |
---|
| 123 | // last not least, some less trivial examples |
---|
| 124 | // involving the algebraic variable. Examples |
---|
| 125 | // are from r3. |
---|
| 126 | f=(-8*u^2*v+8*u*v^2-24*u); |
---|
| 127 | g=(-64*u^2*v+16*u*v^2); |
---|
| 128 | gcd(f, g); |
---|
| 129 | |
---|
| 130 | f=(192*u^6*v^4-240*u^5*v^5+384*u^5*v^3+48*u^4*v^6+96*u^4*v^4-576*u^4*v^2-48*u^3*v^5+144*u^3*v^3); |
---|
| 131 | g=(1536*u^6*v^4-768*u^5*v^5-1536*u^5*v^3+96*u^4*v^6+768*u^4*v^4-96*u^3*v^5); |
---|
| 132 | gcd(f, g); |
---|
| 133 | |
---|
| 134 | f=(-256*u^3*v+128*u^2*v^2-16*u*v^3); |
---|
| 135 | g=(-64*u^3+48*u^2*v^2+32*u^2*v-192*u^2-12*u*v^3-4*u*v^2+48*u*v); |
---|
| 136 | gcd(f, g); |
---|
| 137 | |
---|
| 138 | // |
---|
| 139 | // - ring r3=(0,t),x,dp. |
---|
| 140 | // |
---|
| 141 | |
---|
| 142 | tst_ignore( "ring r3=(0,t),x,dp;" ); |
---|
| 143 | ring r3=(0,t),x,dp; |
---|
| 144 | |
---|
| 145 | poly f=(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 146 | poly g; |
---|
| 147 | |
---|
| 148 | // first, some of the r1 examples (slightly modified) |
---|
| 149 | gcd(0, 0); |
---|
| 150 | gcd(0, 3123*t); |
---|
| 151 | gcd(4353, 0); |
---|
| 152 | |
---|
| 153 | gcd(0, f); |
---|
| 154 | gcd(f, 0); |
---|
| 155 | |
---|
| 156 | gcd(23123, f); |
---|
| 157 | gcd(f, 13123); |
---|
| 158 | |
---|
| 159 | // some trivial examples involving rational numbers |
---|
| 160 | f=11/47894*19*(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 161 | |
---|
| 162 | gcd(0, 3123/(123456*t)); |
---|
| 163 | gcd(4353/8798798, 0); |
---|
| 164 | |
---|
| 165 | gcd(0, f/t); |
---|
| 166 | gcd(f, 0); |
---|
| 167 | |
---|
| 168 | gcd(23123/(3*t), f); |
---|
| 169 | gcd(f, 13123/2); |
---|
| 170 | |
---|
| 171 | // some less trivial examples |
---|
| 172 | f=(2*x^3+2*x^2+2*x); |
---|
| 173 | g=(x^3+2*x^2+2*x+1); |
---|
| 174 | gcd(f, g); |
---|
| 175 | |
---|
| 176 | // we go on with modified variable names |
---|
| 177 | tst_ignore( "ring r3=(0,u),v,dp;" ); |
---|
| 178 | kill r3; |
---|
| 179 | ring r3=(0,u),v,dp; |
---|
| 180 | |
---|
| 181 | poly f; |
---|
| 182 | poly g; |
---|
| 183 | |
---|
| 184 | // last not least, some less trivial examples |
---|
| 185 | // involving the transcendental variable |
---|
| 186 | f=(-8*u^2*v+8*u*v^2-24*u); |
---|
| 187 | g=(-64*u^2*v+16*u*v^2); |
---|
| 188 | gcd(f, g); |
---|
| 189 | |
---|
| 190 | f=(192*u^6*v^4-240*u^5*v^5+384*u^5*v^3+48*u^4*v^6+96*u^4*v^4-576*u^4*v^2-48*u^3*v^5+144*u^3*v^3); |
---|
| 191 | g=(1536*u^6*v^4-768*u^5*v^5-1536*u^5*v^3+96*u^4*v^6+768*u^4*v^4-96*u^3*v^5); |
---|
| 192 | gcd(f, g); |
---|
| 193 | |
---|
| 194 | f=(-256*u^3*v+128*u^2*v^2-16*u*v^3); |
---|
| 195 | g=(-64*u^3+48*u^2*v^2+32*u^2*v-192*u^2-12*u*v^3-4*u*v^2+48*u*v); |
---|
| 196 | gcd(f, g); |
---|
| 197 | |
---|
| 198 | // |
---|
| 199 | // - ring r4=0,(t,x),dp. |
---|
| 200 | // |
---|
| 201 | // The examples from r4 are those from r3 with parameters |
---|
| 202 | // changed to ring variables. |
---|
| 203 | // |
---|
| 204 | |
---|
| 205 | tst_ignore( "ring r4=0,(t,x),dp;" ); |
---|
| 206 | ring r4=0,(t,x),dp; |
---|
| 207 | |
---|
| 208 | poly f=(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 209 | poly g; |
---|
| 210 | |
---|
| 211 | // first, some of the r1 examples (slightly modified) |
---|
| 212 | gcd(0, 0); |
---|
| 213 | gcd(0, 3123*t); |
---|
| 214 | gcd(4353, 0); |
---|
| 215 | |
---|
| 216 | gcd(0, f); |
---|
| 217 | gcd(f, 0); |
---|
| 218 | |
---|
| 219 | gcd(23123, f); |
---|
| 220 | gcd(f, 13123); |
---|
| 221 | |
---|
| 222 | // some trivial examples involving rational numbers |
---|
| 223 | f=11/47894*19*(-9554*x^4-12895*x^3-10023*x^2-6213*x); |
---|
| 224 | |
---|
| 225 | gcd(0, 3123/123456*t); |
---|
| 226 | gcd(4353/8798798, 0); |
---|
| 227 | |
---|
| 228 | gcd(23123/3*t, f); |
---|
| 229 | gcd(f, 13123/2); |
---|
| 230 | |
---|
| 231 | // some less trivial examples |
---|
| 232 | f=(2*x^3+2*x^2+2*x); |
---|
| 233 | g=(x^3+2*x^2+2*x+1); |
---|
| 234 | gcd(f, g); |
---|
| 235 | |
---|
| 236 | // we go on with modified variable names |
---|
| 237 | tst_ignore( "ring r4=0,(u,v),dp;" ); |
---|
| 238 | kill r4; |
---|
| 239 | ring r4=0,(u,v),dp; |
---|
| 240 | |
---|
| 241 | poly f; |
---|
| 242 | poly g; |
---|
| 243 | |
---|
| 244 | // last not least, some less trivial examples |
---|
| 245 | // involving both variables |
---|
| 246 | f=(-8*u^2*v+8*u*v^2-24*u); |
---|
| 247 | g=(-64*u^2*v+16*u*v^2); |
---|
| 248 | gcd(f, g); |
---|
| 249 | |
---|
| 250 | f=(192*u^6*v^4-240*u^5*v^5+384*u^5*v^3+48*u^4*v^6+96*u^4*v^4-576*u^4*v^2-48*u^3*v^5+144*u^3*v^3); |
---|
| 251 | g=(1536*u^6*v^4-768*u^5*v^5-1536*u^5*v^3+96*u^4*v^6+768*u^4*v^4-96*u^3*v^5); |
---|
| 252 | gcd(f, g); |
---|
| 253 | |
---|
| 254 | f=(-256*u^3*v+128*u^2*v^2-16*u*v^3); |
---|
| 255 | g=(-64*u^3+48*u^2*v^2+32*u^2*v-192*u^2-12*u*v^3-4*u*v^2+48*u*v); |
---|
| 256 | gcd(f, g); |
---|
| 257 | $ |
---|