wu.log 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. REDUCE 3.4, 15-Jul-91 ...
  2. 1:
  3. (WU)
  4. % wu.tst
  5. % Russell Bradford, 8 June 90.
  6. % Some tests for the Wu algorithm
  7. % The order directives are not necessary for general use: they just
  8. % help tie things down for testing purposes.
  9. % run after loading Wu code: in "wu.red"$
  10. % test 1
  11. order x,y,a,b;
  12. wu({x^2+y^2-a,x*y-b}, {x,y});
  13. 4 2 2
  14. {{{ - Y + Y *A - B , - X*Y + B},
  15. Y}}
  16. % test 2
  17. order x,y,a,b;
  18. wu({x^2+y^2-a,x*y-b},{x,y,a,b});
  19. 2
  20. {{{B,Y, - X + A},1},
  21. 4 2 2
  22. {{ - Y + Y *A - B , - X*Y + B},
  23. Y}}
  24. % test 3
  25. order x,y,z,r;
  26. wu({x^2+y^2+z^2-r^2, x*y+z^2-1, x*y*z-x^2-y^2-z+1}, {x,y,z});
  27. 3 2 2
  28. {{{Z - Z + R - 1,
  29. 4 2 2 2 2 2 2 2
  30. - Y - Y *Z + Y *R + Z + Z*R - Z + R - 2,
  31. 2
  32. X*Y + Z - 1},
  33. Y},
  34. 7 6 5 4 2 4 3 2 2 2 2
  35. {{Z - Z - 2*Z + Z *R + Z + Z - 2*Z *R + Z + R - 1,
  36. 2 3 2 2
  37. Y *(Z - Z + R - 1),
  38. 2
  39. X*Y + Z - 1},
  40. 3 2 2
  41. Y*(Z - Z + R - 1)}}
  42. % test 4
  43. order x,y,z,r;
  44. wu({x^2+y^2+z^2-r^2, x*y+z^2-1, x*y*z-x^2-y^2-z+1}, {x,y,z,r});
  45. 3 2 2
  46. {{{Z - Z + R - 1,
  47. 4 2 2 2 2 2 2 2
  48. - Y - Y *Z + Y *R + Z + Z*R - Z + R - 2,
  49. 2
  50. X*Y + Z - 1},
  51. Y},
  52. 4 2
  53. {{R - 4*R + 3,
  54. 2
  55. Z + R - 2,
  56. Y,
  57. 2 2
  58. - X + R - 1},
  59. 1},
  60. 7 6 5 4 2 4 3 2 2 2 2
  61. {{Z - Z - 2*Z + Z *R + Z + Z - 2*Z *R + Z + R - 1,
  62. 2 3 2 2
  63. Y *(Z - Z + R - 1),
  64. 2
  65. X*Y + Z - 1},
  66. 3 2 2
  67. Y*(Z - Z + R - 1)}}
  68. % test 5
  69. order x,y,z;
  70. wu({(x-1)*(y-1)*(z-1), (x-2)*(y-2)*(z-2), (x-3)*(y-3)*(z-3)}, {x,y,z});
  71. 2
  72. {{{Z - 5*Z + 6,
  73. 2 2
  74. 2*(Y *Z - 3*Y - 4*Y*Z + 12*Y + 3*Z - 9),
  75. X*Y*Z - 3*X*Y - 3*X*Z + 9*X - 3*Y*Z + 9*Y + 9*Z - 27},
  76. 2 2
  77. 2*(Y*Z - 6*Y*Z + 9*Y - 3*Z + 18*Z - 27)},
  78. {{Z - 3,Y - 2,2*(X - 1)},2},
  79. 2
  80. {{Z - 3,2*(Y - 3*Y + 2),X*Y - 2*X - 2*Y + 4},
  81. 2*(Y - 2)},
  82. {{2*(Z - 3),2*(Y - 2),4*(X - 1)},16},
  83. 2
  84. {{2*(Z - 3),4*(Y - 3*Y + 2),2*(X*Y - 2*X - 2*Y + 4)},
  85. 16*(Y - 2)},
  86. 2
  87. {{Z - 5*Z + 6,
  88. Y*Z - 3*Y - 3*Z + 9,
  89. 2*(X*Z - 3*X - Z + 3)},
  90. 2
  91. 2*(Z - 6*Z + 9)},
  92. 3 2
  93. {{2*(Z - 6*Z + 11*Z - 6),
  94. Y*Z - 3*Y - 3*Z + 9,
  95. 2 2
  96. X*Z - 5*X*Z + 6*X - 2*Z + 10*Z - 12},
  97. 3 2
  98. 2*(Z - 8*Z + 21*Z - 18)},
  99. 3 2
  100. {{4*(Z - 6*Z + 11*Z - 6),
  101. 2 2 2 2 2 2
  102. Y *Z - 5*Y *Z + 6*Y - 5*Y*Z + 25*Y*Z - 30*Y + 6*Z - 30*Z + 36,
  103. X*Y*Z - 3*X*Y - 3*X*Z + 9*X - 3*Y*Z + 9*Y + 9*Z - 27},
  104. 3 2 3 2
  105. 4*(Y*Z - 8*Y*Z + 21*Y*Z - 18*Y - 3*Z + 24*Z - 63*Z + 54)}}
  106. % test 6
  107. order x,y,z;
  108. wu({(x-1)*(y-1)*(z-1), (x-2)*(y-2)*(z-2), (x-3)*(y-3)*(z-3)});
  109. 2
  110. {{{Z - 5*Z + 6,
  111. 2 2
  112. 2*(Y *Z - 3*Y - 4*Y*Z + 12*Y + 3*Z - 9),
  113. X*Y*Z - 3*X*Y - 3*X*Z + 9*X - 3*Y*Z + 9*Y + 9*Z - 27},
  114. 2 2
  115. 2*(Y*Z - 6*Y*Z + 9*Y - 3*Z + 18*Z - 27)},
  116. {{Z - 3,Y - 2,2*(X - 1)},2},
  117. 2
  118. {{Z - 3,2*(Y - 3*Y + 2),X*Y - 2*X - 2*Y + 4},
  119. 2*(Y - 2)},
  120. {{2*(Z - 3),2*(Y - 2),4*(X - 1)},16},
  121. 2
  122. {{2*(Z - 3),4*(Y - 3*Y + 2),2*(X*Y - 2*X - 2*Y + 4)},
  123. 16*(Y - 2)},
  124. 2
  125. {{Z - 5*Z + 6,
  126. Y*Z - 3*Y - 3*Z + 9,
  127. 2*(X*Z - 3*X - Z + 3)},
  128. 2
  129. 2*(Z - 6*Z + 9)},
  130. 3 2
  131. {{2*(Z - 6*Z + 11*Z - 6),
  132. Y*Z - 3*Y - 3*Z + 9,
  133. 2 2
  134. X*Z - 5*X*Z + 6*X - 2*Z + 10*Z - 12},
  135. 3 2
  136. 2*(Z - 8*Z + 21*Z - 18)},
  137. 3 2
  138. {{4*(Z - 6*Z + 11*Z - 6),
  139. 2 2 2 2 2 2
  140. Y *Z - 5*Y *Z + 6*Y - 5*Y*Z + 25*Y*Z - 30*Y + 6*Z - 30*Z + 36,
  141. X*Y*Z - 3*X*Y - 3*X*Z + 9*X - 3*Y*Z + 9*Y + 9*Z - 27},
  142. 3 2 3 2
  143. 4*(Y*Z - 8*Y*Z + 21*Y*Z - 18*Y - 3*Z + 24*Z - 63*Z + 54)}}
  144. % test 7
  145. order x1,x2,x3,x4;
  146. p1 := x1+x2+x3+x4;
  147. P1 := X1 + X2 + X3 + X4
  148. p2 := x1*x2+x2*x3+x3*x4+x4*x1;
  149. P2 := X1*X2 + X1*X4 + X2*X3 + X3*X4
  150. p3 := x1*x2*x3+x2*x3*x4+x3*x4*x1+x4*x1*x2;
  151. P3 := X1*X2*X3 + X1*X2*X4 + X1*X3*X4 + X2*X3*X4
  152. p4 := x1*x2*x3*x4 - 1;
  153. P4 := X1*X2*X3*X4 - 1
  154. wu({p1,p2,p3,p4}, {x1,x2,x3,x4});
  155. 4
  156. {{{X4*(X4 - 1),
  157. 2
  158. X4 *(X3 - X4),
  159. 2 2 2
  160. X4 *(X2 + 2*X2*X4 + X4 ),
  161. 2
  162. X4 *(X1 + X2 + 2*X4)},
  163. 6
  164. X4 },
  165. 4
  166. {{X4 - 1,
  167. 2
  168. X4 *(X3 - X4),
  169. 2 2
  170. 2*X4*(X2 + 2*X2*X4 + X4 ),
  171. 2
  172. X4 *(X1 + X2 + 2*X4)},
  173. 5
  174. 2*X4 },
  175. 4
  176. {{X4 - 1,
  177. X3 - X4,
  178. 2 2
  179. X2 + 2*X2*X4 + X4 ,
  180. X1 + X2 + 2*X4},
  181. 1},
  182. 4
  183. {{X4 - 1,
  184. 2 2
  185. X3 - X4 ,
  186. 2 3 3
  187. X2*X3*X4 - X2*X4 + X3*X4 - 1,
  188. 2
  189. X1*X3 - X1*X4 - X3*X4 + X4 },
  190. 2 2 2
  191. X4 *(X3 - 2*X3*X4 + X4 )},
  192. 8 4
  193. {{X4 - 2*X4 + 1,
  194. 2 2
  195. X3 - X4 ,
  196. 2 3 3
  197. X2*X3*X4 - X2*X4 + X3*X4 - 1,
  198. 4 4
  199. X1*X4 - X1 + X3*X4 - X3},
  200. 2 4 5
  201. X4 *(X3*X4 - X3 - X4 + X4)},
  202. 2 4
  203. {{X4 *(X4 - 1),
  204. 3
  205. X4 *(X3 - X4),
  206. 3 2 2
  207. X4 *(X2 + 2*X2*X4 + X4 ),
  208. 3
  209. X4 *(X1 + X2 + 2*X4)},
  210. 9
  211. X4 },
  212. 4
  213. {{X4*(X4 - 1),
  214. 3
  215. X4 *(X3 - X4),
  216. 2 2 2
  217. 2*X4 *(X2 + 2*X2*X4 + X4 ),
  218. 3
  219. X4 *(X1 + X2 + 2*X4)},
  220. 8
  221. 2*X4 },
  222. 4
  223. {{X4 - 1,
  224. X4*(X3 - X4),
  225. 2 2
  226. X4*(X2 + 2*X2*X4 + X4 ),
  227. X4*(X1 + X2 + 2*X4)},
  228. 3
  229. X4 },
  230. 4
  231. {{X4*(X4 - 1),
  232. 2 2 2
  233. X4 *(X3 - X4 ),
  234. 2 3 3
  235. X4*(X2*X3*X4 - X2*X4 + X3*X4 - 1),
  236. 2
  237. X4*(X1*X3 - X1*X4 - X3*X4 + X4 )},
  238. 6 2 2
  239. X4 *(X3 - 2*X3*X4 + X4 )},
  240. 8 4
  241. {{X4*(X4 - 2*X4 + 1),
  242. 2 2 2
  243. X4 *(X3 - X4 ),
  244. 2 3 3
  245. X4*(X2*X3*X4 - X2*X4 + X3*X4 - 1),
  246. 4 4
  247. X4*(X1*X4 - X1 + X3*X4 - X3)},
  248. 6 4 5
  249. X4 *(X3*X4 - X3 - X4 + X4)},
  250. 3 2 2 3
  251. {{X3 *X4 + X3 *X4 - X3 - X4,
  252. 2 2 2 3
  253. X2*X3 - X2*X4 + X3 *X4 - X4 ,
  254. 2 2 4 2 3 4
  255. X1*X3 *X4 - X1*X4 - X3 *X4 - X3*X4 + X3 + X4},
  256. 4 4 2 2 4
  257. X4 *(X3 - 2*X3 *X4 + X4 )}}
  258. % test 8
  259. order x,y,z;
  260. wu({z*z,y*z-1,x*z-1}, {x,y,z});
  261. {{{1},1}}
  262. end;
  263. Quitting