123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- Tue Apr 15 00:36:13 2008 run on win32
- % wu.tst
- % Russell Bradford, 8 June 90.
- % Some tests for the Wu algorithm
- % The order directives are not necessary for general use: they just
- % help tie things down for testing purposes.
- % run after loading Wu code: in "wu.red"$
- % test 1
- order x,y,a,b;
- wu({x^2+y^2-a,x*y-b}, {x,y});
- 4 2 2
- {{{ - y + y *a - b , - x*y + b},
- y}}
- % test 2
- order x,y,a,b;
- wu({x^2+y^2-a,x*y-b},{x,y,a,b});
- 2
- {{{b,y, - x + a},1},
- 4 2 2
- {{ - y + y *a - b , - x*y + b},
- y}}
- % test 3
- order x,y,z,r;
- 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});
- 3 2 2
- {{{z - z + r - 1,
- 4 2 2 2 2 2 2 2
- - y - y *z + y *r + z + z*r - z + r - 2,
- 2
- x*y + z - 1},
- y},
- 7 6 5 4 2 4 3 2 2 2 2
- {{z - z - 2*z + z *r + z + z - 2*z *r + z + r - 1,
- 2 3 2 2
- y *(z - z + r - 1),
- 2
- x*y + z - 1},
- 3 2 2
- y*(z - z + r - 1)}}
- % test 4
- order x,y,z,r;
- 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});
- 3 2 2
- {{{z - z + r - 1,
- 4 2 2 2 2 2 2 2
- - y - y *z + y *r + z + z*r - z + r - 2,
- 2
- x*y + z - 1},
- y},
- 4 2
- {{r - 4*r + 3,
- 2
- z + r - 2,
- y,
- 2 2
- - x + r - 1},
- 1},
- 7 6 5 4 2 4 3 2 2 2 2
- {{z - z - 2*z + z *r + z + z - 2*z *r + z + r - 1,
- 2 3 2 2
- y *(z - z + r - 1),
- 2
- x*y + z - 1},
- 3 2 2
- y*(z - z + r - 1)}}
- % test 5
- order x,y,z;
- wu({(x-1)*(y-1)*(z-1), (x-2)*(y-2)*(z-2), (x-3)*(y-3)*(z-3)}, {x,y,z});
- 2
- {{{z - 5*z + 6,
- 2 2
- 2*(y *z - 3*y - 4*y*z + 12*y + 3*z - 9),
- x*y*z - 3*x*y - 3*x*z + 9*x - 3*y*z + 9*y + 9*z - 27},
- 2 2
- 2*(y*z - 6*y*z + 9*y - 3*z + 18*z - 27)},
- {{z - 3,y - 2,2*(x - 1)},2},
- 2
- {{z - 3,2*(y - 3*y + 2),x*y - 2*x - 2*y + 4},
- 2*(y - 2)},
- {{2*(z - 3),2*(y - 2),4*(x - 1)},16},
- 2
- {{2*(z - 3),4*(y - 3*y + 2),2*(x*y - 2*x - 2*y + 4)},
- 16*(y - 2)},
- 2
- {{z - 5*z + 6,
- y*z - 3*y - 3*z + 9,
- 2*(x*z - 3*x - z + 3)},
- 2
- 2*(z - 6*z + 9)},
- 3 2
- {{2*(z - 6*z + 11*z - 6),
- y*z - 3*y - 3*z + 9,
- 2 2
- x*z - 5*x*z + 6*x - 2*z + 10*z - 12},
- 3 2
- 2*(z - 8*z + 21*z - 18)},
- 3 2
- {{4*(z - 6*z + 11*z - 6),
- 2 2 2 2 2 2
- y *z - 5*y *z + 6*y - 5*y*z + 25*y*z - 30*y + 6*z - 30*z + 36,
- x*y*z - 3*x*y - 3*x*z + 9*x - 3*y*z + 9*y + 9*z - 27},
- 3 2 3 2
- 4*(y*z - 8*y*z + 21*y*z - 18*y - 3*z + 24*z - 63*z + 54)}}
- % test 6
- order x,y,z;
- wu({(x-1)*(y-1)*(z-1), (x-2)*(y-2)*(z-2), (x-3)*(y-3)*(z-3)});
- 2
- {{{z - 5*z + 6,
- 2 2
- 2*(y *z - 3*y - 4*y*z + 12*y + 3*z - 9),
- x*y*z - 3*x*y - 3*x*z + 9*x - 3*y*z + 9*y + 9*z - 27},
- 2 2
- 2*(y*z - 6*y*z + 9*y - 3*z + 18*z - 27)},
- {{z - 3,y - 2,2*(x - 1)},2},
- 2
- {{z - 3,2*(y - 3*y + 2),x*y - 2*x - 2*y + 4},
- 2*(y - 2)},
- {{2*(z - 3),2*(y - 2),4*(x - 1)},16},
- 2
- {{2*(z - 3),4*(y - 3*y + 2),2*(x*y - 2*x - 2*y + 4)},
- 16*(y - 2)},
- 2
- {{z - 5*z + 6,
- y*z - 3*y - 3*z + 9,
- 2*(x*z - 3*x - z + 3)},
- 2
- 2*(z - 6*z + 9)},
- 3 2
- {{2*(z - 6*z + 11*z - 6),
- y*z - 3*y - 3*z + 9,
- 2 2
- x*z - 5*x*z + 6*x - 2*z + 10*z - 12},
- 3 2
- 2*(z - 8*z + 21*z - 18)},
- 3 2
- {{4*(z - 6*z + 11*z - 6),
- 2 2 2 2 2 2
- y *z - 5*y *z + 6*y - 5*y*z + 25*y*z - 30*y + 6*z - 30*z + 36,
- x*y*z - 3*x*y - 3*x*z + 9*x - 3*y*z + 9*y + 9*z - 27},
- 3 2 3 2
- 4*(y*z - 8*y*z + 21*y*z - 18*y - 3*z + 24*z - 63*z + 54)}}
- % test 7
- order x1,x2,x3,x4;
- p1 := x1+x2+x3+x4;
- p1 := x1 + x2 + x3 + x4
- p2 := x1*x2+x2*x3+x3*x4+x4*x1;
- p2 := x1*x2 + x1*x4 + x2*x3 + x3*x4
- p3 := x1*x2*x3+x2*x3*x4+x3*x4*x1+x4*x1*x2;
- p3 := x1*x2*x3 + x1*x2*x4 + x1*x3*x4 + x2*x3*x4
- p4 := x1*x2*x3*x4 - 1;
- p4 := x1*x2*x3*x4 - 1
- wu({p1,p2,p3,p4}, {x1,x2,x3,x4});
- 4
- {{{x4*(x4 - 1),
- 2
- x4 *(x3 - x4),
- 2 2 2
- x4 *(x2 + 2*x2*x4 + x4 ),
- 2
- x4 *(x1 + x2 + 2*x4)},
- 6
- x4 },
- 4
- {{x4 - 1,
- 2
- x4 *(x3 - x4),
- 2 2
- 2*x4*(x2 + 2*x2*x4 + x4 ),
- 2
- x4 *(x1 + x2 + 2*x4)},
- 5
- 2*x4 },
- 4
- {{x4 - 1,
- x3 - x4,
- 2 2
- x2 + 2*x2*x4 + x4 ,
- x1 + x2 + 2*x4},
- 1},
- 4
- {{x4 - 1,
- 2 2
- x3 - x4 ,
- 2 3 3
- x2*x3*x4 - x2*x4 + x3*x4 - 1,
- 2
- x1*x3 - x1*x4 - x3*x4 + x4 },
- 2 2 2
- x4 *(x3 - 2*x3*x4 + x4 )},
- 8 4
- {{x4 - 2*x4 + 1,
- 2 2
- x3 - x4 ,
- 2 3 3
- x2*x3*x4 - x2*x4 + x3*x4 - 1,
- 4 4
- x1*x4 - x1 + x3*x4 - x3},
- 2 4 5
- x4 *(x3*x4 - x3 - x4 + x4)},
- 2 4
- {{x4 *(x4 - 1),
- 3
- x4 *(x3 - x4),
- 3 2 2
- x4 *(x2 + 2*x2*x4 + x4 ),
- 3
- x4 *(x1 + x2 + 2*x4)},
- 9
- x4 },
- 4
- {{x4*(x4 - 1),
- 3
- x4 *(x3 - x4),
- 2 2 2
- 2*x4 *(x2 + 2*x2*x4 + x4 ),
- 3
- x4 *(x1 + x2 + 2*x4)},
- 8
- 2*x4 },
- 4
- {{x4 - 1,
- x4*(x3 - x4),
- 2 2
- x4*(x2 + 2*x2*x4 + x4 ),
- x4*(x1 + x2 + 2*x4)},
- 3
- x4 },
- 4
- {{x4*(x4 - 1),
- 2 2 2
- x4 *(x3 - x4 ),
- 2 3 3
- x4*(x2*x3*x4 - x2*x4 + x3*x4 - 1),
- 2
- x4*(x1*x3 - x1*x4 - x3*x4 + x4 )},
- 6 2 2
- x4 *(x3 - 2*x3*x4 + x4 )},
- 8 4
- {{x4*(x4 - 2*x4 + 1),
- 2 2 2
- x4 *(x3 - x4 ),
- 2 3 3
- x4*(x2*x3*x4 - x2*x4 + x3*x4 - 1),
- 4 4
- x4*(x1*x4 - x1 + x3*x4 - x3)},
- 6 4 5
- x4 *(x3*x4 - x3 - x4 + x4)},
- 3 2 2 3
- {{x3 *x4 + x3 *x4 - x3 - x4,
- 2 2 2 3
- x2*x3 - x2*x4 + x3 *x4 - x4 ,
- 2 2 4 2 3 4
- x1*x3 *x4 - x1*x4 - x3 *x4 - x3*x4 + x3 + x4},
- 4 4 2 2 4
- x4 *(x3 - 2*x3 *x4 + x4 )}}
- % test 8
- order x,y,z;
- wu({z*z,y*z-1,x*z-1}, {x,y,z});
- {{{1},1}}
- end;
- Time for test: 74 ms
|