4 /* constants and symbols */
21 map('first, map('to_poly, [false, true, %i, %phi, minf, inf]));
22 [[false],[true],[%i],[%phi],[minf],[inf]]$
40 first(elim_allbut(first(to_poly(sqrt(a)= b)),[a,b]));
43 first(elim_allbut(first(to_poly(sqrt(a)= sqrt(b))),[a,b]));
46 first(elim_allbut(first(to_poly(a^(1/3)= b)),[a,b]));
49 first(elim_allbut(first(to_poly(a^(1/42)=b)),[a,b]));
52 first(elim_allbut(first(to_poly(a^(1/4)=b^(1/3))),[a,b]));
57 first(elim_allbut(first(to_poly(abs(a) = b)),[a,b]));
60 first(elim_allbut(first(to_poly(abs(a) = abs(b))),[a,b]));
63 first(elim_allbut(first(to_poly(abs(1-abs(1-abs(a))))),[a]));
74 to_poly((x-1)*(x-2)*(x-3));
75 [[x^3-6*x^2+11*x-6],[],[]]$
77 expand(to_poly((x-1)*(x-sqrt(2))*(x-sqrt(3)),[x]));
78 [[x^3-sqrt(3)*x^2-sqrt(2)*x^2-x^2+sqrt(2)*sqrt(3)*x+sqrt(3)*x+sqrt(2)*x-sqrt(2)*sqrt(3)],[],[]]$
80 first(first(elim_allbut(first(to_poly((x-1)*(x-sqrt(2))*(x-sqrt(3)),[x,1])),[x])));
81 (x^2-3)*(x^3-x^2-2*x+2)$
83 /* regression tests for #4043 bug in to_poly */
84 first(nicedummies(to_poly((3^(3/2)+5)^(1/3)-(3^(3/2)-5)^(1/3),[1])));
85 [%g2-%g1,%g0^3+5=%g2^3,%g0^3-5=%g1^3,3=%g0^2]$
87 factor(first(elim_allbut(first(to_poly(z-(3^(3/2)+5)^(1/3)+(3^(3/2)-5)^(1/3),[1,z])),[z])));
88 [(z^3-4)*(z^6-80*z^3-128)*(z^6-26*z^3+250)*(z^6+10*z^3-2)]$
91 nicedummies(to_poly(z-2^(1/2),[z,1]));
92 [[z-%g0,2=%g0^2],[parg(%g0)<=%pi/2,-%pi/2<parg(%g0)],[]]$
94 nicedummies(to_poly(z-107*2^(1/2),[z,1]));
95 [[z-107*%g0,2=%g0^2],[parg(%g0)<=%pi/2,-%pi/2<parg(%g0)],[]]$
97 nicedummies(to_poly(z - sqrt(2) - sqrt(3),[z,1]));
98 [[z-%g1-%g0,3=%g1^2,2=%g0^2],[parg(%g1)<=%pi/2,-%pi/2<parg(%g1),parg(%g0)<=%pi/2,-%pi/2<parg(%g0)],[]]$
100 first(nicedummies(to_poly(z - sqrt(2) - sqrt(3),[z,1])));
101 [z-%g1-%g0,3=%g1^2,2=%g0^2]$
103 /* make sure we didn't make assignments or assumptions */