poly.rlg 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. Sun Aug 18 15:48:48 2002 run on Windows
  2. % Tests of the poly package polynomial decomposition and gcds.
  3. % Test for the univariate and multivariate polynomial decomposition.
  4. % Herbert Melenk, ZIB Berlin, 1990.
  5. procedure testdecompose u;
  6. begin scalar r,p,val,nextvar;
  7. write "decomposition of ",u;
  8. r := decompose u;
  9. if length r = 1 then rederr "decomposition failed";
  10. write " leads to ",r;
  11. % test if the result is algebraically correct.
  12. r := reverse r;
  13. nextvar := lhs first r; val := rhs first r;
  14. r := rest r;
  15. while not(r={}) do
  16. << p := first r; r := rest r;
  17. if 'equal = part(p,0) then
  18. <<val := sub(nextvar=val,rhs p); nextvar := lhs p>>
  19. else
  20. val := sub(nextvar=val,p);
  21. >>;
  22. if val = u then write " O.K. "
  23. else
  24. <<write "**** reconstructed polynomial: ";
  25. write val;
  26. rederr "reconstruction leads to different polynomial";
  27. >>;
  28. end;
  29. testdecompose
  30. % univariate decompositions
  31. testdecompose(x**4+x**2+1);
  32. 4 2
  33. decomposition of x + x + 1
  34. 2 2
  35. leads to {u + u + 1,u=x }
  36. O.K.
  37. testdecompose(x**6+9x**5+52x**4+177x**3+435x**2+630x+593);
  38. 6 5 4 3 2
  39. decomposition of x + 9*x + 52*x + 177*x + 435*x + 630*x + 593
  40. 3 2 2
  41. leads to {u + 25*u + 210*u + 593,u=x + 3*x}
  42. O.K.
  43. testdecompose(x**6+6x**4+x**3+9x**2+3x-5);
  44. 6 4 3 2
  45. decomposition of x + 6*x + x + 9*x + 3*x - 5
  46. 2 3
  47. leads to {u + u - 5,u=x + 3*x}
  48. O.K.
  49. testdecompose(x**8-88*x**7+2924*x**6-43912*x**5+263431*x**4-218900*x**3+
  50. 65690*x**2-7700*x+234);
  51. 8 7 6 5 4 3
  52. decomposition of x - 88*x + 2924*x - 43912*x + 263431*x - 218900*x
  53. 2
  54. + 65690*x - 7700*x + 234
  55. 2
  56. leads to {u + 35*u + 234,
  57. 2
  58. u=v + 10*v,
  59. 2
  60. v=x - 22*x}
  61. O.K.
  62. % multivariate cases
  63. testdecompose(u**2+v**2+2u*v+1);
  64. 2 2
  65. decomposition of u + 2*u*v + v + 1
  66. 2
  67. leads to {w + 1,w=u + v}
  68. O.K.
  69. testdecompose(x**4+2x**3*y + 3x**2*y**2 + 2x*y**3 + y**4 + 2x**2*y
  70. +2x*y**2 + 2y**3 + 5 x**2 + 5*x*y + 6*y**2 + 5y + 9);
  71. 4 3 2 2 2 2 3 2
  72. decomposition of x + 2*x *y + 3*x *y + 2*x *y + 5*x + 2*x*y + 2*x*y + 5*x*y
  73. 4 3 2
  74. + y + 2*y + 6*y + 5*y + 9
  75. 2 2 2
  76. leads to {u + 5*u + 9,u=x + x*y + y + y}
  77. O.K.
  78. testdecompose sub(u=(2 x**2 + 17 x+y + y**3),u**2+2 u + 1);
  79. 4 3 2 3 2 2 3
  80. decomposition of 4*x + 68*x + 4*x *y + 4*x *y + 293*x + 34*x*y + 34*x*y
  81. 6 4 3 2
  82. + 34*x + y + 2*y + 2*y + y + 2*y + 1
  83. 2 2 3
  84. leads to {u + 2*u + 1,u=2*x + 17*x + y + y}
  85. O.K.
  86. testdecompose sub(u=(2 x**2 *y + 17 x+y + y**3),u**2+2 u + 1);
  87. 4 2 3 2 4 2 2 2 2
  88. decomposition of 4*x *y + 68*x *y + 4*x *y + 4*x *y + 4*x *y + 289*x
  89. 3 6 4 3 2
  90. + 34*x*y + 34*x*y + 34*x + y + 2*y + 2*y + y + 2*y + 1
  91. 2 2 3
  92. leads to {u + 2*u + 1,u=2*x *y + 17*x + y + y}
  93. O.K.
  94. % some cases which require a special (internal) mapping
  95. testdecompose ( (x + y)**2);
  96. 2 2
  97. decomposition of x + 2*x*y + y
  98. 2
  99. leads to {u ,u=x + y}
  100. O.K.
  101. testdecompose ((x + y**2)**2);
  102. 2 2 4
  103. decomposition of x + 2*x*y + y
  104. 2 2
  105. leads to {u ,u=x + y }
  106. O.K.
  107. testdecompose ( (x**2 + y)**2);
  108. 4 2 2
  109. decomposition of x + 2*x *y + y
  110. 2 2
  111. leads to {u ,u=x + y}
  112. O.K.
  113. testdecompose ( (u + v)**2 +10 );
  114. 2 2
  115. decomposition of u + 2*u*v + v + 10
  116. 2
  117. leads to {w + 10,w=u + v}
  118. O.K.
  119. % the decomposition is not unique and might generate quite
  120. % different images:
  121. testdecompose ( (u + v + 10)**2 -100 );
  122. 2 2
  123. decomposition of u + 2*u*v + 20*u + v + 20*v
  124. leads to {w*(w + 20),w=u + v}
  125. O.K.
  126. % some special (difficult) cases
  127. testdecompose (X**4 + 88*X**3*Y + 2904*X**2*Y**2 - 10*X**2
  128. + 42592*X*Y**3 - 440*X*Y + 234256*Y**4 - 4840*Y**2);
  129. 4 3 2 2 2 3
  130. decomposition of x + 88*x *y + 2904*x *y - 10*x + 42592*x*y - 440*x*y
  131. 4 2
  132. + 234256*y - 4840*y
  133. 2
  134. leads to {u*(u - 10),u=v ,v=x + 22*y}
  135. O.K.
  136. % a polynomial with complex coefficients
  137. on complex;
  138. testdecompose(X**4 + (88*I)*X**3*Y - 2904*X**2*Y**2 - 10*X**2 -
  139. (42592*I)*X*Y**3 - (440*I)*X*Y + 234256*Y**4 + 4840*Y**2);
  140. 4 3 2 2 2 3
  141. decomposition of x + 88*i*x *y - 2904*x *y - 10*x - 42592*i*x*y - 440*i*x*y
  142. 4 2
  143. + 234256*y + 4840*y
  144. 2
  145. leads to {u*(u - 10),u=v ,v=x + 22*i*y}
  146. O.K.
  147. off complex;
  148. % Examples given by J. Gutierrez and J.M. Olazabal.
  149. f1:=x**6-2x**5+x**4-3x**3+3x**2+5$
  150. testdecompose(f1);
  151. 6 5 4 3 2
  152. decomposition of x - 2*x + x - 3*x + 3*x + 5
  153. 2 3 2
  154. leads to {u - 3*u + 5,u=x - x }
  155. O.K.
  156. f2:=x**32-1$
  157. testdecompose(f2);
  158. 32
  159. decomposition of x - 1
  160. 2 2 2 2 2
  161. leads to {u - 1,u=v ,v=w ,w=a ,a=x }
  162. O.K.
  163. f3:=x**4-(2/3)*x**3-(26/9)*x**2+x+3$
  164. testdecompose(f3);
  165. 4 3 2
  166. 9*x - 6*x - 26*x + 9*x + 27
  167. decomposition of --------------------------------
  168. 9
  169. 2
  170. u - 9*u + 27 2
  171. leads to {---------------,u=3*x - x}
  172. 9
  173. O.K.
  174. f4:=sub(x=x**4-x**3-2x+1,x**3-x**2-1)$
  175. testdecompose(f4);
  176. 12 11 10 9 8 7 6 5
  177. decomposition of x - 3*x + 3*x - 7*x + 14*x - 10*x + 14*x - 20*x
  178. 4 3 2
  179. + 9*x - 9*x + 8*x - 2*x - 1
  180. 3 2 4 3
  181. leads to {u + 2*u + u - 1,u=x - x - 2*x}
  182. O.K.
  183. f5:=sub(x=f4,x**5-5)$
  184. testdecompose(f5);
  185. 60 59 58 57 56 55
  186. decomposition of x - 15*x + 105*x - 485*x + 1795*x - 5873*x
  187. 54 53 52 51 50
  188. + 17255*x - 45845*x + 112950*x - 261300*x + 567203*x
  189. 49 48 47 46
  190. - 1164475*x + 2280835*x - 4259830*x + 7604415*x
  191. 45 44 43 42
  192. - 13053437*x + 21545220*x - 34200855*x + 52436150*x
  193. 41 40 39 38
  194. - 77668230*x + 111050794*x - 153746645*x + 206190770*x
  195. 37 36 35
  196. - 267484170*x + 336413145*x - 410387890*x
  197. 34 33 32
  198. + 484672110*x - 555048350*x + 616671710*x
  199. 31 30 29
  200. - 663135380*x + 690884384*x - 697721320*x
  201. 28 27 26
  202. + 681039235*x - 642661265*x + 586604975*x
  203. 25 24 23
  204. - 516016275*x + 437051535*x - 356628245*x
  205. 22 21 20
  206. + 278991765*x - 208571965*x + 149093999*x
  207. 19 18 17 16
  208. - 101204325*x + 64656350*x - 38848040*x + 21710870*x
  209. 15 14 13 12
  210. - 10971599*x + 4928210*x - 1904450*x + 519730*x
  211. 11 10 9 8 7
  212. - 15845*x - 71947*x + 52015*x - 26740*x + 5510*x
  213. 6 5 4 3
  214. + 3380*x - 1972*x - 75*x + 195*x - 10*x - 6
  215. 5 4 3 2
  216. leads to {u - 5*u + 10*u - 10*u + 5*u - 6,
  217. 3 2
  218. u=v + 2*v + v,
  219. 4 3
  220. v=x - x - 2*x}
  221. O.K.
  222. clear f1,f2,f3,f4,f5;
  223. % Tests of gcd code.
  224. % The following examples were introduced in Moses, J. and Yun, D.Y.Y.,
  225. % "The EZ GCD Algorithm", Proc. ACM 73 (1973) 159-166, and considered
  226. % further in Hearn, A.C., "Non-modular Computation of Polynomial GCD's
  227. % Using Trial Division", Proc. EUROSAM 79, 227-239, 72, published as
  228. % Lecture Notes on Comp. Science, # 72, Springer-Verlag, Berlin, 1979.
  229. on gcd;
  230. % The following is the best setting for this file.
  231. on ezgcd;
  232. % In systems that have the heugcd code, the following is also a
  233. % possibility, although not all examples complete in a reasonable time.
  234. % load heugcd; on heugcd;
  235. % The final alternative is to use neither ezgcd nor heugcd. In that case,
  236. % most examples take excessive amounts of computer time.
  237. share n;
  238. operator xx;
  239. % Case 1.
  240. for n := 2:5
  241. do write gcd(((for i:=1:n sum xx(i))-1)*((for i:=1:n sum xx(i)) + 2),
  242. ((for i:=1:n sum xx(i))+1)
  243. *(-3xx(2)*xx(1)**2+xx(2)**2-1)**2);
  244. 1
  245. 1
  246. 1
  247. 1
  248. % Case 2.
  249. let d = (for i:=1:n sum xx(i)**n) + 1;
  250. for n := 2:7 do write gcd(d*((for i:=1:n sum xx(i)**n) - 2),
  251. d*((for i:=1:n sum xx(i)**n) + 2));
  252. 2 2
  253. xx(2) + xx(1) + 1
  254. 3 3 3
  255. xx(3) + xx(2) + xx(1) + 1
  256. 4 4 4 4
  257. xx(4) + xx(3) + xx(2) + xx(1) + 1
  258. 5 5 5 5 5
  259. xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  260. 6 6 6 6 6 6
  261. xx(6) + xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  262. 7 7 7 7 7 7 7
  263. xx(7) + xx(6) + xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  264. for n := 2:7 do write gcd(d*((for i:=1:n sum xx(i)**n) - 2),
  265. d*((for i:=1:n sum xx(i)**(n-1)) + 2));
  266. 2 2
  267. xx(2) + xx(1) + 1
  268. 3 3 3
  269. xx(3) + xx(2) + xx(1) + 1
  270. 4 4 4 4
  271. xx(4) + xx(3) + xx(2) + xx(1) + 1
  272. 5 5 5 5 5
  273. xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  274. 6 6 6 6 6 6
  275. xx(6) + xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  276. 7 7 7 7 7 7 7
  277. xx(7) + xx(6) + xx(5) + xx(4) + xx(3) + xx(2) + xx(1) + 1
  278. % Case 3.
  279. let d = xx(2)**2*xx(1)**2 + (for i := 3:n sum xx(i)**2) + 1;
  280. for n := 2:5
  281. do write gcd(d*(xx(2)*xx(1) + (for i:=3:n sum xx(i)) + 2)**2,
  282. d*(xx(1)**2-xx(2)**2 + (for i:=3:n sum xx(i)**2) - 1));
  283. 2 2
  284. xx(2) *xx(1) + 1
  285. 2 2 2
  286. xx(3) + xx(2) *xx(1) + 1
  287. 2 2 2 2
  288. xx(4) + xx(3) + xx(2) *xx(1) + 1
  289. 2 2 2 2 2
  290. xx(5) + xx(4) + xx(3) + xx(2) *xx(1) + 1
  291. % Case 4.
  292. let u = xx(1) - xx(2)*xx(3) + 1,
  293. v = xx(1) - xx(2) + 3xx(3);
  294. gcd(u*v**2,v*u**2);
  295. 2 2
  296. 3*xx(3) *xx(2) - xx(3)*xx(2) + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
  297. 2
  298. + xx(2)*xx(1) + xx(2) - xx(1) - xx(1)
  299. gcd(u*v**3,v*u**3);
  300. 2 2
  301. 3*xx(3) *xx(2) - xx(3)*xx(2) + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
  302. 2
  303. + xx(2)*xx(1) + xx(2) - xx(1) - xx(1)
  304. gcd(u*v**4,v*u**4);
  305. 2 2
  306. 3*xx(3) *xx(2) - xx(3)*xx(2) + xx(3)*xx(2)*xx(1) - 3*xx(3)*xx(1) - 3*xx(3)
  307. 2
  308. + xx(2)*xx(1) + xx(2) - xx(1) - xx(1)
  309. gcd(u**2*v**4,v**2*u**4);
  310. 4 2 3 3 3 2
  311. 9*xx(3) *xx(2) - 6*xx(3) *xx(2) + 6*xx(3) *xx(2) *xx(1)
  312. 3 3 2 4
  313. - 18*xx(3) *xx(2)*xx(1) - 18*xx(3) *xx(2) + xx(3) *xx(2)
  314. 2 3 2 2 2 2 2
  315. - 2*xx(3) *xx(2) *xx(1) + xx(3) *xx(2) *xx(1) + 12*xx(3) *xx(2) *xx(1)
  316. 2 2 2 2 2
  317. + 12*xx(3) *xx(2) - 12*xx(3) *xx(2)*xx(1) - 12*xx(3) *xx(2)*xx(1)
  318. 2 2 2 2 3
  319. + 9*xx(3) *xx(1) + 18*xx(3) *xx(1) + 9*xx(3) - 2*xx(3)*xx(2) *xx(1)
  320. 3 2 2 2
  321. - 2*xx(3)*xx(2) + 4*xx(3)*xx(2) *xx(1) + 4*xx(3)*xx(2) *xx(1)
  322. 3 2
  323. - 2*xx(3)*xx(2)*xx(1) - 8*xx(3)*xx(2)*xx(1) - 12*xx(3)*xx(2)*xx(1)
  324. 3 2
  325. - 6*xx(3)*xx(2) + 6*xx(3)*xx(1) + 12*xx(3)*xx(1) + 6*xx(3)*xx(1)
  326. 2 2 2 2 3 2
  327. + xx(2) *xx(1) + 2*xx(2) *xx(1) + xx(2) - 2*xx(2)*xx(1) - 4*xx(2)*xx(1)
  328. 4 3 2
  329. - 2*xx(2)*xx(1) + xx(1) + 2*xx(1) + xx(1)
  330. % Case 5.
  331. let d = (for i := 1:n product (xx(i)+1)) - 3;
  332. for n := 2:5 do write gcd(d*for i := 1:n product (xx(i) - 2),
  333. d*for i := 1:n product (xx(i) + 2));
  334. xx(2)*xx(1) + xx(2) + xx(1) - 2
  335. xx(3)*xx(2)*xx(1) + xx(3)*xx(2) + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2)
  336. + xx(1) - 2
  337. xx(4)*xx(3)*xx(2)*xx(1) + xx(4)*xx(3)*xx(2) + xx(4)*xx(3)*xx(1) + xx(4)*xx(3)
  338. + xx(4)*xx(2)*xx(1) + xx(4)*xx(2) + xx(4)*xx(1) + xx(4) + xx(3)*xx(2)*xx(1)
  339. + xx(3)*xx(2) + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2) + xx(1) - 2
  340. xx(5)*xx(4)*xx(3)*xx(2)*xx(1) + xx(5)*xx(4)*xx(3)*xx(2)
  341. + xx(5)*xx(4)*xx(3)*xx(1) + xx(5)*xx(4)*xx(3) + xx(5)*xx(4)*xx(2)*xx(1)
  342. + xx(5)*xx(4)*xx(2) + xx(5)*xx(4)*xx(1) + xx(5)*xx(4) + xx(5)*xx(3)*xx(2)*xx(1)
  343. + xx(5)*xx(3)*xx(2) + xx(5)*xx(3)*xx(1) + xx(5)*xx(3) + xx(5)*xx(2)*xx(1)
  344. + xx(5)*xx(2) + xx(5)*xx(1) + xx(5) + xx(4)*xx(3)*xx(2)*xx(1)
  345. + xx(4)*xx(3)*xx(2) + xx(4)*xx(3)*xx(1) + xx(4)*xx(3) + xx(4)*xx(2)*xx(1)
  346. + xx(4)*xx(2) + xx(4)*xx(1) + xx(4) + xx(3)*xx(2)*xx(1) + xx(3)*xx(2)
  347. + xx(3)*xx(1) + xx(3) + xx(2)*xx(1) + xx(2) + xx(1) - 2
  348. clear d,u,v;
  349. % The following examples were discussed in Char, B.W., Geddes, K.O.,
  350. % Gonnet, G.H., "GCDHEU: Heuristic Polynomial GCD Algorithm Based
  351. % on Integer GCD Computation", Proc. EUROSAM 84, 285-296, published as
  352. % Lecture Notes on Comp. Science, # 174, Springer-Verlag, Berlin, 1984.
  353. % Maple Problem 1.
  354. gcd(34*x**80-91*x**99+70*x**31-25*x**52+20*x**76-86*x**44-17*x**33
  355. -6*x**89-56*x**54-17,
  356. 91*x**49+64*x**10-21*x**52-88*x**74-38*x**76-46*x**84-16*x**95
  357. -81*x**72+96*x**25-20);
  358. 1
  359. % Maple Problem 2.
  360. g := 34*x**19-91*x+70*x**7-25*x**16+20*x**3-86;
  361. 19 16 7 3
  362. g := 34*x - 25*x + 70*x + 20*x - 91*x - 86
  363. gcd(g * (64*x**34-21*x**47-126*x**8-46*x**5-16*x**60-81),
  364. g * (72*x**60-25*x**25-19*x**23-22*x**39-83*x**52+54*x**10+81) );
  365. 19 16 7 3
  366. 34*x - 25*x + 70*x + 20*x - 91*x - 86
  367. % Maple Problem 3.
  368. gcd(3427088418+8032938293*x-9181159474*x**2-9955210536*x**3
  369. +7049846077*x**4-3120124818*x**5-2517523455*x**6+5255435973*x**7
  370. +2020369281*x**8-7604863368*x**9-8685841867*x**10+4432745169*x**11
  371. -1746773680*x**12-3351440965*x**13-580100705*x**14+8923168914*x**15
  372. -5660404998*x**16 +5441358149*x**17-1741572352*x**18
  373. +9148191435*x**19-4940173788*x**20+6420433154*x**21+980100567*x**22
  374. -2128455689*x**23+5266911072*x**24-8800333073*x**25-7425750422*x**26
  375. -3801290114*x**27-7680051202*x**28-4652194273*x**29-8472655390*x**30
  376. -1656540766*x**31+9577718075*x**32-8137446394*x**33+7232922578*x**34
  377. +9601468396*x**35-2497427781*x**36-2047603127*x**37-1893414455*x**38
  378. -2508354375*x**39-2231932228*x**40,
  379. 2503247071-8324774912*x+6797341645*x**2+5418887080*x**3
  380. -6779305784*x**4+8113537696*x**5+2229288956*x**6+2732713505*x**7
  381. +9659962054*x**8-1514449131*x**9+7981583323*x**10+3729868918*x**11
  382. -2849544385*x**12-5246360984*x**13+2570821160*x**14-5533328063*x**15
  383. -274185102*x**16+8312755945*x**17-2941669352*x**18-4320254985*x**19
  384. +9331460166*x**20-2906491973*x**21-7780292310*x**22-4971715970*x**23
  385. -6474871482*x**24-6832431522*x**25-5016229128*x**26-6422216875*x**27
  386. -471583252*x**28+3073673916*x**29+2297139923*x**30+9034797416*x**31
  387. +6247010865*x**32+5965858387*x**33-4612062748*x**34+5837579849*x**35
  388. -2820832810*x**36-7450648226*x**37+2849150856*x**38+2109912954*x**39
  389. +2914906138*x**40);
  390. 1
  391. % Maple Problem 4.
  392. g := 34271+80330*x-91812*x**2-99553*x**3+70499*x**4-31201*x**5
  393. -25175*x**6+52555*x**7+20204*x**8-76049*x**9-86859*x**10;
  394. 10 9 8 7 6 5
  395. g := - 86859*x - 76049*x + 20204*x + 52555*x - 25175*x - 31201*x
  396. 4 3 2
  397. + 70499*x - 99553*x - 91812*x + 80330*x + 34271
  398. gcd(g * (44328-17468*x-33515*x**2-5801*x**3+89232*x**4-56604*x**5
  399. +54414*x**6-17416*x**7+91482*x**8-49402*x**9+64205*x**10
  400. +9801*x**11-21285*x**12+52669*x**13-88004*x**14-74258*x**15
  401. -38013*x**16-76801*x**17-46522*x**18-84727*x**19-16565*x**20
  402. +95778*x**21-81375*x**22+72330*x**23+96015*x**24-24974*x**25
  403. -20476*x**26-18934*x**27-25084*x**28-22319*x**29+25033*x**30),
  404. g * (-83248+67974*x+54189*x**2-67793*x**3+81136*x**4+22293*x**5
  405. +27327*x**6+96600*x**7-15145*x**8+79816*x**9+37299*x**10
  406. -28496*x**11-52464*x**12+25708*x**13-55334*x**14-2742*x**15
  407. +83128*x**16-29417*x**17-43203*x**18+93315*x**19-29065*x**20
  408. -77803*x**21-49717*x**22-64749*x**23-68325*x**24-50163*x**25
  409. -64222*x**26-4716*x**27+30737*x**28+22972*x**29+90348*x**30));
  410. 10 9 8 7 6 5 4
  411. 86859*x + 76049*x - 20204*x - 52555*x + 25175*x + 31201*x - 70499*x
  412. 3 2
  413. + 99553*x + 91812*x - 80330*x - 34271
  414. % Maple Problem 5.
  415. gcd(-8472*x**4*y**10-8137*x**9*y**10-2497*x**4*y**4-2508*x**4*y**6
  416. -8324*x**9*y**8-6779*x**9*y**6+2733*x**10*y**4+7981*x**7*y**3
  417. -5246*x**6*y**2-274*x**10*y**3-4320,
  418. 15168*x**3*y-4971*x*y-2283*x*y**5+3074*x**6*y**10+6247*x**8*y**2
  419. +2849*x**6*y**7-2039*x**7-2626*x**2*y**7+9229*x**6*y**5+2404*y**5
  420. +1387*x**4*y**8+5602*x**5*y**2-6212*x**3*y**7-8561);
  421. 1
  422. % Maple Problem 6.
  423. g := -19*x**4*y**4+25*y**9+54*x*y**9+22*x**7*y**10-15*x**9*y**7-28;
  424. 9 7 7 10 4 4 9 9
  425. g := - 15*x *y + 22*x *y - 19*x *y + 54*x*y + 25*y - 28
  426. gcd(g*(91*x**2*y**9+10*x**4*y**8-88*x*y**3-76*x**2-16*x**10*y
  427. +72*x**10*y**4-20),
  428. g*(34*x**9-99*x**9*y**3-25*x**8*y**6-76*y**7-17*x**3*y**5
  429. +89*x**2*y**8-17));
  430. 9 7 7 10 4 4 9 9
  431. 15*x *y - 22*x *y + 19*x *y - 54*x*y - 25*y + 28
  432. % Maple Problem 7.
  433. gcd(6713544209*x**9+8524923038*x**3*y**3*z**7+6010184640*x*z**7
  434. +4126613160*x**3*y**4*z**9+2169797500*x**7*y**4*z**9
  435. +2529913106*x**8*y**5*z**3+7633455535*y*z**3+1159974399*x**2*z**4
  436. +9788859037*y**8*z**9+3751286109*x**3*y**4*z**3,
  437. 3884033886*x**6*z**8+7709443539*x*y**9*z**6
  438. +6366356752*x**9*y**4*z**8+6864934459*x**3*y**2*z**6
  439. +2233335968*x**4*y**9*z**3+2839872507*x**9*y**3*z
  440. +2514142015*x*y*z**2+1788891562*x**4*y**6*z**6
  441. +9517398707*x**8*y**7*z**2+7918789924*x**3*y*z**6
  442. +6054956477*x**6*y**3*z**6);
  443. 1
  444. % Maple Problem 8.
  445. g := u**3*(x**2-y)*z**2+(u-3*u**2*x)*y*z-u**4*x*y+3;
  446. 4 3 2 2 3 2 2
  447. g := - u *x*y + u *x *z - u *y*z - 3*u *x*y*z + u*y*z + 3
  448. gcd(g * ((y**2+x)*z**2+u**5*(x*y+x**2)*z-y+5),
  449. g * ((y**2-x)*z**2+u**5*(x*y-x**2)*z+y+9) );
  450. 4 3 2 2 3 2 2
  451. u *x*y - u *x *z + u *y*z + 3*u *x*y*z - u*y*z - 3
  452. % Maple Problem 9.
  453. g := 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
  454. +x**3;
  455. 2 2 2 2 2 2 2 2 3
  456. g := - 25*u *v*z - 18*u *x *y*z + 34*u *y *z - 18*v*x *z + x + 53
  457. gcd( g * (-85*u*v**2*y**2*z**2-25*u*v*x*y*z-84*u**2*v**2*y**2*z
  458. +27*u**2*v*x**2*y**2*z-53*u*x*y**2*z+34*x**3),
  459. g * (48*x**3-99*u*x**2*y**2*z-69*x*y*z-75*u*v*x*y*z**2
  460. -43*u**2*v+91*u**2*v**2*y**2*z) );
  461. 2 2 2 2 2 2 2 2 3
  462. 25*u *v*z + 18*u *x *y*z - 34*u *y *z + 18*v*x *z - x - 53
  463. % Maple Problem 10.
  464. gcd(-9955*v**9*x**3*y**4*z**8+2020*v*y**7*z**4
  465. -3351*v**5*x**10*y**2*z**8-1741*v**10*x**2*y**9*z**6
  466. -2128*v**8*y*z**3-7680*v**2*y**4*z**10-8137*v**9*x**10*y**4*z**4
  467. -1893*v**4*x**4*y**6+6797*v**8*x*y**9*z**6
  468. +2733*v**10*x**4*y**9*z**7-2849*v**2*x**6*y**2*z**5
  469. +8312*v**3*x**3*y**10*z**3-7780*v**2*x*y*z**2
  470. -6422*v**5*x**7*y**6*z**10+6247*v**8*x**2*y**8*z**3
  471. -7450*v**7*x**6*y**7*z**4+3625*x**4*y**2*z**7+9229*v**6*x**5*y**6
  472. -112*v**6*x**4*y**8*z**7-7867*v**5*x**8*y**5*z**2
  473. -6212*v**3*x**7*z**5+8699*v**8*x**2*y**2*z**5
  474. +4442*v**10*x**5*y**4*z+1965*v**10*y**3*z**3-8906*v**6*x*y**4*z**5
  475. +5552*x**10*y**4+3055*v**5*x**3*y**6*z**2+6658*v**7*x**10*z**6
  476. +3721*v**8*x**9*y**4*z**8+9511*v*x**6*y+5437*v**3*x**9*y**9*z**7
  477. -1957*v**6*x**4*y*z**3+9214*v**3*x**9*y**3*z**7
  478. +7273*v**2*x**8*y**4*z**10+1701*x**10*y**7*z**2
  479. +4944*v**5*x**5*y**8*z**8-1935*v**3*x**6*y**10*z**7
  480. +4029*x**6*y**10*z**3+9462*v**6*x**5*y**4*z**8-3633*v**4*x*y**7*z**5
  481. -1876,
  482. -5830*v**7*x**8*y*z**2-1217*v**8*x*y**2*z**5
  483. -1510*v**9*x**3*y**10*z**10+7036*v**6*x**8*y**3*z**3
  484. +1022*v**9*y**3*z**8+3791*v**8*x**3*y**7+6906*v**6*x*y*z**10
  485. +117*v**7*x**2*y**4*z**4+6654*v**6*x**5*y**2*z**3
  486. -7302*v**10*x**8*y**3-5343*v**8*x**5*y**9*z
  487. -2244*v**9*x**3*y**8*z**9-3719*v**5*x**10*y**6*z**8
  488. +2629*x**3*y**2*z**10+8517*x**9*y**6*z**7-9551*v**5*x**6*y**6*z**2
  489. -7750*x**10*y**7*z**4-5035*v**5*x**2*y**5*z-5967*v**9*x**5*y**9*z**5
  490. -8517*v**3*x**2*y**7*z**6-2668*v**10*y**9*z**4+1630*v**5*x**5*y*z**8
  491. +9099*v**7*x**9*y**4*z**3-5358*v**9*x**5*y**6*z**2
  492. +5766*v**5*y**3*z**4-3624*v*x**4*y**10*z**10
  493. +8839*v**6*x**9*y**10*z**4+3378*x**7*y**2*z**5+7582*v**7*x*y**8*z**7
  494. -85*v*x**2*y**9*z**6-9495*v**9*x**10*y**6*z**3+1983*v**9*x**3*y
  495. -4613*v**10*x**4*y**7*z**6+5529*v**10*x*y**6
  496. +5030*v**4*x**5*y**4*z**9-9202*x**6*y**3*z**9
  497. -4988*v**2*x**2*y**10*z**4-8572*v**9*x**7*y**10*z**10
  498. +4080*v**4*x**8*z**8-382*v**9*x**9*y**2*z**2-7326);
  499. 1
  500. end;
  501. Time for test: 8212 ms, plus GC time: 351 ms