Rename *ll* and *ul* to ll and ul in defint
[maxima.git] / share / to_poly_solve / rtest_to_poly.mac
blobb72044251a43947069f4f3822590dc0174e2caa6
1 (load(to_poly),0);
2 0$
4 /* constants and symbols */
6 to_poly(42);
7 [[42],[],[]]$
9 to_poly(42.01);
10 [[4201],[],[]]$
12 to_poly(42.01b0);
13 [[4201],[],[]]$
15 to_poly(8/3);
16 [[8],[],[]]$
18 to_poly(%pi);
19 [[%pi],[],[]]$
21 map('first, map('to_poly, [false, true, %i, %phi, minf, inf]));
22 [[false],[true],[%i],[%phi],[minf],[inf]]$
24 to_poly(x);
25 [[x],[],[]]$
27 to_poly(x,[x]);
28 [[x],[],[]]$
30 to_poly(x,[x,y,z]);
31 [[x],[],[]]$
33 to_poly(x,[a,b,c]);
34 [[x],[],[]]$
36 to_poly(sqrt(5),[]);
37 [[sqrt(5)],[],[]]$
39 /* powers */
40 first(elim_allbut(first(to_poly(sqrt(a)= b)),[a,b]));
41 [b^2-a]$
43 first(elim_allbut(first(to_poly(sqrt(a)= sqrt(b))),[a,b]));
44 [b-a]$
46 first(elim_allbut(first(to_poly(a^(1/3)= b)),[a,b]));
47 [b^3-a]$
49 first(elim_allbut(first(to_poly(a^(1/42)=b)),[a,b]));
50 [b^42-a]$
52 first(elim_allbut(first(to_poly(a^(1/4)=b^(1/3))),[a,b]));
53 [b^4-a^3]$
55 /* abs */
57 first(elim_allbut(first(to_poly(abs(a) = b)),[a,b]));
58 [b^2 - a^2]$
60 first(elim_allbut(first(to_poly(abs(a) = abs(b))),[a,b]));
61 [b^2 - a^2]$
63 first(elim_allbut(first(to_poly(abs(1-abs(1-abs(a))))),[a]));
64 [a*(a^2-4)]$
66 /* polynomials */
68 to_poly(-x);
69 [[-x],[],[]]$
71 to_poly(4.3-x);
72 [[43-10*x],[],[]]$
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)]$
90 /* more tests*/
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 */
104 [values,facts()];
105 [[],[]]$