123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- REDUCE 3.4, 15-Jul-91 ...
- 1:
- (WU)
- % 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 +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 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;
- Quitting
|