Update AUTHORS file using admin/list_authors.pl.
[maxima/cygwin.git] / tests / rtest_algebraic.mac
blob460ab5ff2d0185f819716a67e912bc64ec12cd53
1 (kill(all), algebraic : true, 0);
2 0$
4 ratsimp([2 / sqrt(2), -2/sqrt(2), 1 / (1 + sqrt(2)), -1/(1 + sqrt(2)), 1/(sqrt(2) - 1), -1/(sqrt(2) -1)]);
5 [sqrt(2),  -sqrt(2), sqrt(2) - 1, 1 - sqrt(2), sqrt(2) + 1,  -1 - sqrt(2)]$
7 ratsimp([1/(sqrt(5) - sqrt(2)), 1/(sqrt(5) + sqrt(2))]);
8 [((sqrt(5) + sqrt(2))/3), ((sqrt(5) - sqrt(2))/3)]$
10 ratsimp(1/(5^(1/3) - 2^(1/3)));
11 ((5^(2/3) + 2^(1/3) * 5^(1/3) + 2^(2/3))/3)$
13 ratsimp(-1/(5^(2/3) + 2^(2/3)));
14 ((2^(2/3) * 5^(2/3) - 5 * 5^(1/3) - 2 * 2^(1/3))/29)$
16 (eq : 4*z^2-2*z-1,0);
19 (sol : solve(eq,z),0);
22 map(lambda([s], ratsimp(subst(s,eq))), sol);
23 [0,0]$
25 (eq : 4*z^4-2*z^2-1,0);
28 (sol : solve(eq,z),0);
31 map(lambda([s], ratsimp(subst(s,eq))), sol);
32 [0,0,0,0]$
34 (eq : 4*z^3-2*z^2-1,0);
37 (sol : solve(eq,z),0);
40 map(lambda([s], ratsimp(subst(s,eq))), sol);
41 [0,0,0]$
43 (eq : 4*z^3-2*z^2-sqrt(42),0);
46 (sol : solve(eq,z),0);
49 map(lambda([s], ratsimp(subst(s,eq))), sol);
50 [0,0,0]$
52 (eq : 4*z^3 + (12 + %pi * %i) *z^2-sqrt(42),0);
55 (sol : solve(eq,z),0);
58 map(lambda([s], ratsimp(subst(s,eq))), sol);
59 [0,0,0]$
61 (eq : 4*z^4 + z - 1,0);
64 (sol : solve(eq,z),0);
67 /* This needs some extra help -- I don't consider this to be a bug. */
69 map(lambda([s], ratsimp(radcan(subst(s,eq)))), sol);
70 [0,0,0,0]$
72 /* By the way, cos(%pi/32) is a root of this polynomial.*/
74 (eq : 32768*x^16-131072*x^14+212992*x^12-180224*x^10+84480*x^8-21504*x^6+2688*x^4-128*x^2+1,0);
77 (sol : solve(eq,x),0);
80 map(lambda([s], rectform(ratsimp(subst(s,eq)))), sol);
81 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]$
83 /* By the way, cos(%pi/60) is a root of this polynomial. 
84 Also, cos(%pi/60) = sqrt(sqrt(15)+sqrt(2)*sqrt(5-sqrt(5))+sqrt(3)+8)/4 */
86 (eq : 65536*z^16-262144*z^14+430080*z^12-372736*z^10+182784*z^8-50176*z^6+7040*z^4-384*z^2+1,0);
89 (sol : solve(eq,z),0);
92 map(lambda([s], rectform(ratsimp(subst(s,eq)))), sol);
93 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]$
95 ratsimp((1 + %i)/(1 - %i));
96 %i$
98 ratsimp(1/(7 + %i * 7));
99  - ((%i - 1)/14)$
101 (tellrat(x,x^2+5*x+1),0);
104 ratsimp([0,1,x,x^2,x^3]);
105 [0,1,x,-5*x-1,24*x+5]$
107 ratsimp([0,1,1/x,1/x^2,1/x^3]);
108 [0, 1,  - x - 5, 5 * x + 24,  - 24 * x - 115]$
110 ratsimp(a + b * x + c * x^2 + d * x^3);
111 (24*d-5*c+b)*x+5*d-c+a$
113 ratsimp((a + b * x + c * x^2 + d * x^3) * ratsimp(1/(a + b * x + c * x^2 + d * x^3)));
116 ratsimp([%i, minf, inf, infinity]);
117 [%i, minf, inf, infinity]$
119 ratsimp(makelist(%i^k,k,-8,8));
120 [1,%i,-1,-%i,1,%i,-1,-%i,1,%i,-1,-%i,1,%i,-1,-%i,1]$
122 ratsimp([1/(x+1), 1/(x -1), 1/(x - 1)^2]);
123 [((x + 4)/3),  -((x + 6)/7), ((x + 5)/7)]$
125 ratsimp(cos(x^2));
126 cos(5*x+1)$
128 ratsimp(matrix([1,x],[x^2,x^3]));
129 matrix([1,x],[-5*x-1, 24 * x + 5])$
131 (untellrat(x),0);
134 ratsimp([1,x,x^2,x^3]);
135 [1,x,x^2,x^3]$
137 ratsimp([1,1/x,1/x^2,1/x^3]);
138 [1,1/x,1/x^2,1/x^3]$
140 (reset(algebraic), remvalue(eq, sol),0);