1% Tests of the poly package polynomial decomposition and gcds.
2
3
4% Test for the univariate and multivariate polynomial decomposition.
5
6% Herbert Melenk, ZIB Berlin, 1990.
7
8procedure testdecompose u;
9   begin scalar r,p,val,nextvar;
10       write "decomposition of ",u;
11       r := decompose u;
12       if length r = 1 then rederr "decomposition failed";
13       write " leads to ",r;
14	 % test if the result is algebraically correct.
15       r := reverse r;
16       nextvar := lhs first r; val := rhs first r;
17       r := rest r;
18       while not(r={}) do
19       << p := first r; r := rest r;
20          if 'equal = part(p,0) then
21          <<val := sub(nextvar=val,rhs p); nextvar := lhs p>>
22              else
23            val := sub(nextvar=val,p);
24       >>;
25       if val = u then write "     O.K.  "
26          else
27         <<write "**** reconstructed polynomial: ";
28           write val;
29           rederr "reconstruction leads to different polynomial";
30         >>;
31    end;
32
33
34testdecompose
35
36
37
38    % univariate decompositions
39testdecompose(x**4+x**2+1);
40
41
42                  4    2
43decomposition of x  + x  + 1
44
45            2            2
46 leads to {u  + u + 1,u=x }
47
48     O.K.
49
50testdecompose(x**6+9x**5+52x**4+177x**3+435x**2+630x+593);
51
52
53                  6      5       4        3        2
54decomposition of x  + 9*x  + 52*x  + 177*x  + 435*x  + 630*x + 593
55
56            3       2                  2
57 leads to {u  + 25*u  + 210*u + 593,u=x  + 3*x}
58
59     O.K.
60
61testdecompose(x**6+6x**4+x**3+9x**2+3x-5);
62
63
64                  6      4    3      2
65decomposition of x  + 6*x  + x  + 9*x  + 3*x - 5
66
67            2            3
68 leads to {u  + u - 5,u=x  + 3*x}
69
70     O.K.
71
72testdecompose(x**8-88*x**7+2924*x**6-43912*x**5+263431*x**4-218900*x**3+
73           65690*x**2-7700*x+234);
74
75
76                  8       7         6          5           4           3
77decomposition of x  - 88*x  + 2924*x  - 43912*x  + 263431*x  - 218900*x
78
79                           2
80                  + 65690*x  - 7700*x + 234
81
82            2
83 leads to {u  + 35*u + 234,
84
85              2
86           u=v  + 10*v,
87
88              2
89           v=x  - 22*x}
90
91     O.K.
92
93
94    % multivariate cases
95testdecompose(u**2+v**2+2u*v+1);
96
97
98                  2            2
99decomposition of u  + 2*u*v + v  + 1
100
101            2
102 leads to {w  + 1,w=u + v}
103
104     O.K.
105
106testdecompose(x**4+2x**3*y + 3x**2*y**2 + 2x*y**3 + y**4 + 2x**2*y
107         +2x*y**2 + 2y**3 + 5 x**2 + 5*x*y + 6*y**2 + 5y + 9);
108
109
110                  4      3        2  2      2        2        3        2
111decomposition of x  + 2*x *y + 3*x *y  + 2*x *y + 5*x  + 2*x*y  + 2*x*y  + 5*x*y
112
113                     4      3      2
114                  + y  + 2*y  + 6*y  + 5*y + 9
115
116            2              2          2
117 leads to {u  + 5*u + 9,u=x  + x*y + y  + y}
118
119     O.K.
120
121testdecompose  sub(u=(2 x**2 + 17 x+y + y**3),u**2+2 u + 1);
122
123
124                    4       3      2  3      2          2         3
125decomposition of 4*x  + 68*x  + 4*x *y  + 4*x *y + 293*x  + 34*x*y  + 34*x*y
126
127                            6      4      3    2
128                  + 34*x + y  + 2*y  + 2*y  + y  + 2*y + 1
129
130            2                2           3
131 leads to {u  + 2*u + 1,u=2*x  + 17*x + y  + y}
132
133     O.K.
134
135testdecompose  sub(u=(2 x**2 *y + 17 x+y + y**3),u**2+2 u + 1);
136
137
138                    4  2       3        2  4      2  2      2          2
139decomposition of 4*x *y  + 68*x *y + 4*x *y  + 4*x *y  + 4*x *y + 289*x
140
141                          3                    6      4      3    2
142                  + 34*x*y  + 34*x*y + 34*x + y  + 2*y  + 2*y  + y  + 2*y + 1
143
144            2                2             3
145 leads to {u  + 2*u + 1,u=2*x *y + 17*x + y  + y}
146
147     O.K.
148
149
150    % some cases which require a special (internal) mapping
151testdecompose  ( (x + y)**2);
152
153
154                  2            2
155decomposition of x  + 2*x*y + y
156
157            2
158 leads to {u ,u=x + y}
159
160     O.K.
161
162testdecompose ((x + y**2)**2);
163
164
165                  2        2    4
166decomposition of x  + 2*x*y  + y
167
168            2        2
169 leads to {u ,u=x + y }
170
171     O.K.
172
173testdecompose  ( (x**2 + y)**2);
174
175
176                  4      2      2
177decomposition of x  + 2*x *y + y
178
179            2    2
180 leads to {u ,u=x  + y}
181
182     O.K.
183
184testdecompose  ( (u + v)**2 +10 );
185
186
187                  2            2
188decomposition of u  + 2*u*v + v  + 10
189
190            2
191 leads to {w  + 10,w=u + v}
192
193     O.K.
194
195
196    % the decomposition is not unique and might generate quite
197    % different images:
198testdecompose  ( (u + v + 10)**2 -100 );
199
200
201                  2                   2
202decomposition of u  + 2*u*v + 20*u + v  + 20*v
203
204 leads to {w*(w + 20),w=u + v}
205
206     O.K.
207
208
209    % some special (difficult) cases
210testdecompose (X**4 + 88*X**3*Y + 2904*X**2*Y**2 - 10*X**2
211           + 42592*X*Y**3 - 440*X*Y + 234256*Y**4 - 4840*Y**2);
212
213
214                  4       3           2  2       2            3
215decomposition of x  + 88*x *y + 2904*x *y  - 10*x  + 42592*x*y  - 440*x*y
216
217                            4         2
218                  + 234256*y  - 4840*y
219
220                         2
221 leads to {u*(u - 10),u=v ,v=x + 22*y}
222
223     O.K.
224
225
226    % a polynomial with complex coefficients
227on complex;
228
229
230testdecompose(X**4 + (88*I)*X**3*Y - 2904*X**2*Y**2 - 10*X**2 -
231              (42592*I)*X*Y**3 - (440*I)*X*Y + 234256*Y**4 + 4840*Y**2);
232
233
234                  4         3           2  2       2              3
235decomposition of x  + 88*i*x *y - 2904*x *y  - 10*x  - 42592*i*x*y  - 440*i*x*y
236
237                            4         2
238                  + 234256*y  + 4840*y
239
240                         2
241 leads to {u*(u - 10),u=v ,v=x + 22*i*y}
242
243     O.K.
244
245off complex;
246
247
248
249
250% Examples given by J. Gutierrez and J.M. Olazabal.
251
252f1:=x**6-2x**5+x**4-3x**3+3x**2+5$
253
254
255testdecompose(f1);
256
257
258                  6      5    4      3      2
259decomposition of x  - 2*x  + x  - 3*x  + 3*x  + 5
260
261            2              3    2
262 leads to {u  - 3*u + 5,u=x  - x }
263
264     O.K.
265
266
267f2:=x**32-1$
268
269
270testdecompose(f2);
271
272
273                  32
274decomposition of x   - 1
275
276            2        2    2    2    2
277 leads to {u  - 1,u=v ,v=w ,w=a ,a=x }
278
279     O.K.
280
281
282f3:=x**4-(2/3)*x**3-(26/9)*x**2+x+3$
283
284
285testdecompose(f3);
286
287
288                     4      3       2
289                  9*x  - 6*x  - 26*x  + 9*x + 27
290decomposition of --------------------------------
291                                9
292
293             2
294            u  - 9*u + 27       2
295 leads to {---------------,u=3*x  - x}
296                  9
297
298     O.K.
299
300
301f4:=sub(x=x**4-x**3-2x+1,x**3-x**2-1)$
302
303
304testdecompose(f4);
305
306
307                  12      11      10      9       8       7       6       5
308decomposition of x   - 3*x   + 3*x   - 7*x  + 14*x  - 10*x  + 14*x  - 20*x
309
310                       4      3      2
311                  + 9*x  - 9*x  + 8*x  - 2*x - 1
312
313            3      2            4    3
314 leads to {u  + 2*u  + u - 1,u=x  - x  - 2*x}
315
316     O.K.
317
318
319f5:=sub(x=f4,x**5-5)$
320
321
322testdecompose(f5);
323
324
325                  60       59        58        57         56         55
326decomposition of x   - 15*x   + 105*x   - 485*x   + 1795*x   - 5873*x
327
328                           54          53           52           51           50
329                  + 17255*x   - 45845*x   + 112950*x   - 261300*x   + 567203*x
330
331                             49            48            47            46
332                  - 1164475*x   + 2280835*x   - 4259830*x   + 7604415*x
333
334                              45             44             43             42
335                  - 13053437*x   + 21545220*x   - 34200855*x   + 52436150*x
336
337                              41              40              39              38
338                  - 77668230*x   + 111050794*x   - 153746645*x   + 206190770*x
339
340                               37              36              35
341                  - 267484170*x   + 336413145*x   - 410387890*x
342
343                               34              33              32
344                  + 484672110*x   - 555048350*x   + 616671710*x
345
346                               31              30              29
347                  - 663135380*x   + 690884384*x   - 697721320*x
348
349                               28              27              26
350                  + 681039235*x   - 642661265*x   + 586604975*x
351
352                               25              24              23
353                  - 516016275*x   + 437051535*x   - 356628245*x
354
355                               22              21              20
356                  + 278991765*x   - 208571965*x   + 149093999*x
357
358                               19             18             17             16
359                  - 101204325*x   + 64656350*x   - 38848040*x   + 21710870*x
360
361                              15            14            13           12
362                  - 10971599*x   + 4928210*x   - 1904450*x   + 519730*x
363
364                           11          10          9          8         7
365                  - 15845*x   - 71947*x   + 52015*x  - 26740*x  + 5510*x
366
367                          6         5       4        3
368                  + 3380*x  - 1972*x  - 75*x  + 195*x  - 10*x - 6
369
370            5      4       3       2
371 leads to {u  - 5*u  + 10*u  - 10*u  + 5*u - 6,
372
373              3      2
374           u=v  + 2*v  + v,
375
376              4    3
377           v=x  - x  - 2*x}
378
379     O.K.
380
381
382clear f1,f2,f3,f4,f5;
383
384
385
386
387% Tests of gcd code.
388
389% The following examples were introduced in Moses, J. and Yun, D.Y.Y.,
390% "The EZ GCD Algorithm", Proc. ACM 73 (1973) 159-166, and considered
391% further in Hearn, A.C., "Non-modular Computation of Polynomial GCD's
392% Using Trial Division", Proc. EUROSAM 79, 227-239, 72, published as
393% Lecture Notes on Comp. Science, # 72, Springer-Verlag, Berlin, 1979.
394
395on gcd;
396
397
398
399% The following is the best setting for this file.
400
401on ezgcd;
402
403
404
405% In systems that have the heugcd code, the following is also a
406% possibility, although not all examples complete in a reasonable time.
407
408% load heugcd; on heugcd;
409
410% The final alternative is to use neither ezgcd nor heugcd. In that case,
411% most examples take excessive amounts of computer time.
412
413share n;
414
415
416
417operator xx;
418
419
420
421% Case 1.
422
423for n := 2:5
424   do write gcd(((for i:=1:n sum xx(i))-1)*((for i:=1:n sum xx(i)) + 2),
425		((for i:=1:n sum xx(i))+1)
426		     *(-3xx(2)*xx(1)**2+xx(2)**2-1)**2);
427
428
4291
430
4311
432
4331
434
4351
436
437
438% Case 2.
439
440let d = (for i:=1:n sum xx(i)**n) + 1;
441
442
443
444for n := 2:7 do write gcd(d*((for i:=1:n sum xx(i)**n) - 2),
445			  d*((for i:=1:n sum xx(i)**n) + 2));
446
447
448     2        2
449xx(2)  + xx(1)  + 1
450
451     3        3        3
452xx(3)  + xx(2)  + xx(1)  + 1
453
454     4        4        4        4
455xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
456
457     5        5        5        5        5
458xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
459
460     6        6        6        6        6        6
461xx(6)  + xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
462
463     7        7        7        7        7        7        7
464xx(7)  + xx(6)  + xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
465
466
467
468for n := 2:7 do write gcd(d*((for i:=1:n sum xx(i)**n) - 2),
469			  d*((for i:=1:n sum xx(i)**(n-1)) + 2));
470
471
472     2        2
473xx(2)  + xx(1)  + 1
474
475     3        3        3
476xx(3)  + xx(2)  + xx(1)  + 1
477
478     4        4        4        4
479xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
480
481     5        5        5        5        5
482xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
483
484     6        6        6        6        6        6
485xx(6)  + xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
486
487     7        7        7        7        7        7        7
488xx(7)  + xx(6)  + xx(5)  + xx(4)  + xx(3)  + xx(2)  + xx(1)  + 1
489
490
491% Case 3.
492
493let d = xx(2)**2*xx(1)**2 + (for i := 3:n sum xx(i)**2) + 1;
494
495
496
497for n := 2:5
498   do write gcd(d*(xx(2)*xx(1) + (for i:=3:n sum xx(i)) + 2)**2,
499		d*(xx(1)**2-xx(2)**2 + (for i:=3:n sum xx(i)**2) - 1));
500
501
502     2      2
503xx(2) *xx(1)  + 1
504
505     2        2      2
506xx(3)  + xx(2) *xx(1)  + 1
507
508     2        2        2      2
509xx(4)  + xx(3)  + xx(2) *xx(1)  + 1
510
511     2        2        2        2      2
512xx(5)  + xx(4)  + xx(3)  + xx(2) *xx(1)  + 1
513
514
515% Case 4.
516
517let u = xx(1) - xx(2)*xx(3) + 1,
518    v = xx(1) - xx(2) + 3xx(3);
519
520
521
522gcd(u*v**2,v*u**2);
523
524
525       2                    2
5263*xx(3) *xx(2) - xx(3)*xx(2)  + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
527
528                              2
529 + xx(2)*xx(1) + xx(2) - xx(1)  - xx(1)
530
531
532gcd(u*v**3,v*u**3);
533
534
535       2                    2
5363*xx(3) *xx(2) - xx(3)*xx(2)  + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
537
538                              2
539 + xx(2)*xx(1) + xx(2) - xx(1)  - xx(1)
540
541
542gcd(u*v**4,v*u**4);
543
544
545       2                    2
5463*xx(3) *xx(2) - xx(3)*xx(2)  + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
547
548                              2
549 + xx(2)*xx(1) + xx(2) - xx(1)  - xx(1)
550
551
552gcd(u**2*v**4,v**2*u**4);
553
554
555       4      2          3      3          3      2
5569*xx(3) *xx(2)  - 6*xx(3) *xx(2)  + 6*xx(3) *xx(2) *xx(1)
557
558           3                       3              2      4
559 - 18*xx(3) *xx(2)*xx(1) - 18*xx(3) *xx(2) + xx(3) *xx(2)
560
561          2      3              2      2      2           2      2
562 - 2*xx(3) *xx(2) *xx(1) + xx(3) *xx(2) *xx(1)  + 12*xx(3) *xx(2) *xx(1)
563
564           2      2           2            2           2
565 + 12*xx(3) *xx(2)  - 12*xx(3) *xx(2)*xx(1)  - 12*xx(3) *xx(2)*xx(1)
566
567          2      2           2                2                3
568 + 9*xx(3) *xx(1)  + 18*xx(3) *xx(1) + 9*xx(3)  - 2*xx(3)*xx(2) *xx(1)
569
570                3                2      2                2
571 - 2*xx(3)*xx(2)  + 4*xx(3)*xx(2) *xx(1)  + 4*xx(3)*xx(2) *xx(1)
572
573                      3                      2
574 - 2*xx(3)*xx(2)*xx(1)  - 8*xx(3)*xx(2)*xx(1)  - 12*xx(3)*xx(2)*xx(1)
575
576                                3                 2
577 - 6*xx(3)*xx(2) + 6*xx(3)*xx(1)  + 12*xx(3)*xx(1)  + 6*xx(3)*xx(1)
578
579        2      2          2              2                3                2
580 + xx(2) *xx(1)  + 2*xx(2) *xx(1) + xx(2)  - 2*xx(2)*xx(1)  - 4*xx(2)*xx(1)
581
582                        4          3        2
583 - 2*xx(2)*xx(1) + xx(1)  + 2*xx(1)  + xx(1)
584
585
586
587% Case 5.
588
589let d = (for i := 1:n product (xx(i)+1)) - 3;
590
591
592
593for n := 2:5 do write gcd(d*for i := 1:n product (xx(i) - 2),
594			  d*for i := 1:n product (xx(i) + 2));
595
596
597xx(2)*xx(1) + xx(2) + xx(1) - 2
598
599xx(3)*xx(2)*xx(1) + xx(3)*xx(2) + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2)
600
601 + xx(1) - 2
602
603xx(4)*xx(3)*xx(2)*xx(1) + xx(4)*xx(3)*xx(2) + xx(4)*xx(3)*xx(1) + xx(4)*xx(3)
604
605 + xx(4)*xx(2)*xx(1) + xx(4)*xx(2) + xx(4)*xx(1) + xx(4) + xx(3)*xx(2)*xx(1)
606
607 + xx(3)*xx(2) + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2) + xx(1) - 2
608
609xx(5)*xx(4)*xx(3)*xx(2)*xx(1) + xx(5)*xx(4)*xx(3)*xx(2)
610
611 + xx(5)*xx(4)*xx(3)*xx(1) + xx(5)*xx(4)*xx(3) + xx(5)*xx(4)*xx(2)*xx(1)
612
613 + xx(5)*xx(4)*xx(2) + xx(5)*xx(4)*xx(1) + xx(5)*xx(4) + xx(5)*xx(3)*xx(2)*xx(1)
614
615 + xx(5)*xx(3)*xx(2) + xx(5)*xx(3)*xx(1) + xx(5)*xx(3) + xx(5)*xx(2)*xx(1)
616
617 + xx(5)*xx(2) + xx(5)*xx(1) + xx(5) + xx(4)*xx(3)*xx(2)*xx(1)
618
619 + xx(4)*xx(3)*xx(2) + xx(4)*xx(3)*xx(1) + xx(4)*xx(3) + xx(4)*xx(2)*xx(1)
620
621 + xx(4)*xx(2) + xx(4)*xx(1) + xx(4) + xx(3)*xx(2)*xx(1) + xx(3)*xx(2)
622
623 + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2) + xx(1) - 2
624
625
626clear d,u,v;
627
628
629
630
631% The following examples were discussed in Char, B.W., Geddes, K.O.,
632% Gonnet, G.H., "GCDHEU:  Heuristic Polynomial GCD Algorithm Based
633% on Integer GCD Computation", Proc. EUROSAM 84, 285-296, published as
634% Lecture Notes on Comp. Science, # 174, Springer-Verlag, Berlin, 1984.
635
636
637% Maple Problem 1.
638
639gcd(34*x**80-91*x**99+70*x**31-25*x**52+20*x**76-86*x**44-17*x**33
640    -6*x**89-56*x**54-17,
641    91*x**49+64*x**10-21*x**52-88*x**74-38*x**76-46*x**84-16*x**95
642    -81*x**72+96*x**25-20);
643
644
6451
646
647
648% Maple Problem 2.
649
650g := 34*x**19-91*x+70*x**7-25*x**16+20*x**3-86;
651
652
653         19       16       7       3
654g := 34*x   - 25*x   + 70*x  + 20*x  - 91*x - 86
655
656
657gcd(g * (64*x**34-21*x**47-126*x**8-46*x**5-16*x**60-81),
658    g * (72*x**60-25*x**25-19*x**23-22*x**39-83*x**52+54*x**10+81) );
659
660
661    19       16       7       3
66234*x   - 25*x   + 70*x  + 20*x  - 91*x - 86
663
664
665% Maple Problem 3.
666
667gcd(3427088418+8032938293*x-9181159474*x**2-9955210536*x**3
668    +7049846077*x**4-3120124818*x**5-2517523455*x**6+5255435973*x**7
669    +2020369281*x**8-7604863368*x**9-8685841867*x**10+4432745169*x**11
670    -1746773680*x**12-3351440965*x**13-580100705*x**14+8923168914*x**15
671    -5660404998*x**16 +5441358149*x**17-1741572352*x**18
672    +9148191435*x**19-4940173788*x**20+6420433154*x**21+980100567*x**22
673    -2128455689*x**23+5266911072*x**24-8800333073*x**25-7425750422*x**26
674    -3801290114*x**27-7680051202*x**28-4652194273*x**29-8472655390*x**30
675    -1656540766*x**31+9577718075*x**32-8137446394*x**33+7232922578*x**34
676    +9601468396*x**35-2497427781*x**36-2047603127*x**37-1893414455*x**38
677    -2508354375*x**39-2231932228*x**40,
678    2503247071-8324774912*x+6797341645*x**2+5418887080*x**3
679    -6779305784*x**4+8113537696*x**5+2229288956*x**6+2732713505*x**7
680    +9659962054*x**8-1514449131*x**9+7981583323*x**10+3729868918*x**11
681    -2849544385*x**12-5246360984*x**13+2570821160*x**14-5533328063*x**15
682    -274185102*x**16+8312755945*x**17-2941669352*x**18-4320254985*x**19
683    +9331460166*x**20-2906491973*x**21-7780292310*x**22-4971715970*x**23
684    -6474871482*x**24-6832431522*x**25-5016229128*x**26-6422216875*x**27
685    -471583252*x**28+3073673916*x**29+2297139923*x**30+9034797416*x**31
686    +6247010865*x**32+5965858387*x**33-4612062748*x**34+5837579849*x**35
687    -2820832810*x**36-7450648226*x**37+2849150856*x**38+2109912954*x**39
688    +2914906138*x**40);
689
690
6911
692
693
694% Maple Problem 4.
695
696g := 34271+80330*x-91812*x**2-99553*x**3+70499*x**4-31201*x**5
697     -25175*x**6+52555*x**7+20204*x**8-76049*x**9-86859*x**10;
698
699
700               10          9          8          7          6          5
701g :=  - 86859*x   - 76049*x  + 20204*x  + 52555*x  - 25175*x  - 31201*x
702
703               4          3          2
704      + 70499*x  - 99553*x  - 91812*x  + 80330*x + 34271
705
706
707gcd(g * (44328-17468*x-33515*x**2-5801*x**3+89232*x**4-56604*x**5
708	 +54414*x**6-17416*x**7+91482*x**8-49402*x**9+64205*x**10
709	 +9801*x**11-21285*x**12+52669*x**13-88004*x**14-74258*x**15
710	 -38013*x**16-76801*x**17-46522*x**18-84727*x**19-16565*x**20
711	 +95778*x**21-81375*x**22+72330*x**23+96015*x**24-24974*x**25
712	 -20476*x**26-18934*x**27-25084*x**28-22319*x**29+25033*x**30),
713    g * (-83248+67974*x+54189*x**2-67793*x**3+81136*x**4+22293*x**5
714	 +27327*x**6+96600*x**7-15145*x**8+79816*x**9+37299*x**10
715	 -28496*x**11-52464*x**12+25708*x**13-55334*x**14-2742*x**15
716	 +83128*x**16-29417*x**17-43203*x**18+93315*x**19-29065*x**20
717	 -77803*x**21-49717*x**22-64749*x**23-68325*x**24-50163*x**25
718	 -64222*x**26-4716*x**27+30737*x**28+22972*x**29+90348*x**30));
719
720
721       10          9          8          7          6          5          4
72286859*x   + 76049*x  - 20204*x  - 52555*x  + 25175*x  + 31201*x  - 70499*x
723
724          3          2
725 + 99553*x  + 91812*x  - 80330*x - 34271
726
727
728% Maple Problem 5.
729
730gcd(-8472*x**4*y**10-8137*x**9*y**10-2497*x**4*y**4-2508*x**4*y**6
731    -8324*x**9*y**8-6779*x**9*y**6+2733*x**10*y**4+7981*x**7*y**3
732    -5246*x**6*y**2-274*x**10*y**3-4320,
733    15168*x**3*y-4971*x*y-2283*x*y**5+3074*x**6*y**10+6247*x**8*y**2
734    +2849*x**6*y**7-2039*x**7-2626*x**2*y**7+9229*x**6*y**5+2404*y**5
735    +1387*x**4*y**8+5602*x**5*y**2-6212*x**3*y**7-8561);
736
737
7381
739
740
741% Maple Problem 6.
742
743g := -19*x**4*y**4+25*y**9+54*x*y**9+22*x**7*y**10-15*x**9*y**7-28;
744
745
746            9  7       7  10       4  4         9       9
747g :=  - 15*x *y  + 22*x *y   - 19*x *y  + 54*x*y  + 25*y  - 28
748
749
750gcd(g*(91*x**2*y**9+10*x**4*y**8-88*x*y**3-76*x**2-16*x**10*y
751       +72*x**10*y**4-20),
752    g*(34*x**9-99*x**9*y**3-25*x**8*y**6-76*y**7-17*x**3*y**5
753       +89*x**2*y**8-17));
754
755
756    9  7       7  10       4  4         9       9
75715*x *y  - 22*x *y   + 19*x *y  - 54*x*y  - 25*y  + 28
758
759
760% Maple Problem 7.
761
762gcd(6713544209*x**9+8524923038*x**3*y**3*z**7+6010184640*x*z**7
763    +4126613160*x**3*y**4*z**9+2169797500*x**7*y**4*z**9
764    +2529913106*x**8*y**5*z**3+7633455535*y*z**3+1159974399*x**2*z**4
765    +9788859037*y**8*z**9+3751286109*x**3*y**4*z**3,
766    3884033886*x**6*z**8+7709443539*x*y**9*z**6
767    +6366356752*x**9*y**4*z**8+6864934459*x**3*y**2*z**6
768    +2233335968*x**4*y**9*z**3+2839872507*x**9*y**3*z
769    +2514142015*x*y*z**2+1788891562*x**4*y**6*z**6
770    +9517398707*x**8*y**7*z**2+7918789924*x**3*y*z**6
771    +6054956477*x**6*y**3*z**6);
772
773
7741
775
776
777% Maple Problem 8.
778
779g := u**3*(x**2-y)*z**2+(u-3*u**2*x)*y*z-u**4*x*y+3;
780
781
782         4        3  2  2    3    2      2
783g :=  - u *x*y + u *x *z  - u *y*z  - 3*u *x*y*z + u*y*z + 3
784
785gcd(g * ((y**2+x)*z**2+u**5*(x*y+x**2)*z-y+5),
786    g * ((y**2-x)*z**2+u**5*(x*y-x**2)*z+y+9) );
787
788
789 4        3  2  2    3    2      2
790u *x*y - u *x *z  + u *y*z  + 3*u *x*y*z - u*y*z - 3
791
792
793% Maple Problem 9.
794
795g := 34*u**2*y**2*z-25*u**2*v*z**2-18*v*x**2*z**2-18*u**2*x**2*y*z+53
796     +x**3;
797
798
799            2    2       2  2           2  2           2  2    3
800g :=  - 25*u *v*z  - 18*u *x *y*z + 34*u *y *z - 18*v*x *z  + x  + 53
801
802gcd( g * (-85*u*v**2*y**2*z**2-25*u*v*x*y*z-84*u**2*v**2*y**2*z
803      +27*u**2*v*x**2*y**2*z-53*u*x*y**2*z+34*x**3),
804     g * (48*x**3-99*u*x**2*y**2*z-69*x*y*z-75*u*v*x*y*z**2
805     -43*u**2*v+91*u**2*v**2*y**2*z) );
806
807
808    2    2       2  2           2  2           2  2    3
80925*u *v*z  + 18*u *x *y*z - 34*u *y *z + 18*v*x *z  - x  - 53
810
811
812% Maple Problem 10.
813
814gcd(-9955*v**9*x**3*y**4*z**8+2020*v*y**7*z**4
815    -3351*v**5*x**10*y**2*z**8-1741*v**10*x**2*y**9*z**6
816    -2128*v**8*y*z**3-7680*v**2*y**4*z**10-8137*v**9*x**10*y**4*z**4
817    -1893*v**4*x**4*y**6+6797*v**8*x*y**9*z**6
818    +2733*v**10*x**4*y**9*z**7-2849*v**2*x**6*y**2*z**5
819    +8312*v**3*x**3*y**10*z**3-7780*v**2*x*y*z**2
820    -6422*v**5*x**7*y**6*z**10+6247*v**8*x**2*y**8*z**3
821    -7450*v**7*x**6*y**7*z**4+3625*x**4*y**2*z**7+9229*v**6*x**5*y**6
822    -112*v**6*x**4*y**8*z**7-7867*v**5*x**8*y**5*z**2
823    -6212*v**3*x**7*z**5+8699*v**8*x**2*y**2*z**5
824    +4442*v**10*x**5*y**4*z+1965*v**10*y**3*z**3-8906*v**6*x*y**4*z**5
825    +5552*x**10*y**4+3055*v**5*x**3*y**6*z**2+6658*v**7*x**10*z**6
826    +3721*v**8*x**9*y**4*z**8+9511*v*x**6*y+5437*v**3*x**9*y**9*z**7
827    -1957*v**6*x**4*y*z**3+9214*v**3*x**9*y**3*z**7
828    +7273*v**2*x**8*y**4*z**10+1701*x**10*y**7*z**2
829    +4944*v**5*x**5*y**8*z**8-1935*v**3*x**6*y**10*z**7
830    +4029*x**6*y**10*z**3+9462*v**6*x**5*y**4*z**8-3633*v**4*x*y**7*z**5
831    -1876,
832    -5830*v**7*x**8*y*z**2-1217*v**8*x*y**2*z**5
833    -1510*v**9*x**3*y**10*z**10+7036*v**6*x**8*y**3*z**3
834    +1022*v**9*y**3*z**8+3791*v**8*x**3*y**7+6906*v**6*x*y*z**10
835    +117*v**7*x**2*y**4*z**4+6654*v**6*x**5*y**2*z**3
836    -7302*v**10*x**8*y**3-5343*v**8*x**5*y**9*z
837    -2244*v**9*x**3*y**8*z**9-3719*v**5*x**10*y**6*z**8
838    +2629*x**3*y**2*z**10+8517*x**9*y**6*z**7-9551*v**5*x**6*y**6*z**2
839    -7750*x**10*y**7*z**4-5035*v**5*x**2*y**5*z-5967*v**9*x**5*y**9*z**5
840    -8517*v**3*x**2*y**7*z**6-2668*v**10*y**9*z**4+1630*v**5*x**5*y*z**8
841    +9099*v**7*x**9*y**4*z**3-5358*v**9*x**5*y**6*z**2
842    +5766*v**5*y**3*z**4-3624*v*x**4*y**10*z**10
843    +8839*v**6*x**9*y**10*z**4+3378*x**7*y**2*z**5+7582*v**7*x*y**8*z**7
844    -85*v*x**2*y**9*z**6-9495*v**9*x**10*y**6*z**3+1983*v**9*x**3*y
845    -4613*v**10*x**4*y**7*z**6+5529*v**10*x*y**6
846    +5030*v**4*x**5*y**4*z**9-9202*x**6*y**3*z**9
847    -4988*v**2*x**2*y**10*z**4-8572*v**9*x**7*y**10*z**10
848    +4080*v**4*x**8*z**8-382*v**9*x**9*y**2*z**2-7326);
849
850
8511
852
853
854end;
855
856Tested on x86_64-pc-windows CSL
857Time (counter 1): 31 ms  plus GC time: 16 ms
858
859End of Lisp run after 0.03+0.06 seconds
860real 0.25
861user 0.01
862sys 0.04
863