REDUCE 3.4.1, 15-Jul-92 ...
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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ms plus GC time: 85 ms
Quitting