1% Test file for i_solve and r_solve operators.
2% Author: F.J.Wright@Maths.QMW.ac.uk
3% Version 1.051, 16 Jan 1995
4
5i_solve((x - 10)*(x + 20)*(x - 30)*(x + 40)*(x - 50));
6
7
8{x=-20,x=-40,x=50,x=30,x=10}
9
10% {x=-20,x=-40,x=50,x=30,x=10}
11
12i_solve(x^4 - 1, x);
13
14
15{x=1,x=-1}
16
17% {x=1,x=-1}
18
19i_solve(x^4 + 1);
20
21
22{}
23
24% {}
25
26r_solve((x^2 - 1)*(x^2 - 9));
27
28
29{x=1,x=-3,x=3,x=-1}
30
31% {x=1,x=-3,x=3,x=-1}
32
33r_solve(9x^2 - 1);
34
35
36    1      - 1
37{x=---,x=------}
38    3      3
39
40%     1      - 1
41% {x=---,x=------}
42%     3      3
43
44r_solve(9x^2 - 4, x);
45
46
47     - 2     2
48{x=------,x=---}
49     3       3
50
51%      - 2     2
52% {x=------,x=---}
53%      3       3
54
55r_solve(9x^2 + 16, x);
56
57
58{}
59
60% {}
61
62r_solve((9x^2 - 16)*(x^2 - 9), x);
63
64
65     - 4              4
66{x=------,x=3,x=-3,x=---}
67     3                3
68
69%      - 4              4
70% {x=------,x=3,x=-3,x=---}
71%      3                3
72
73% First two examples from Loos' paper:
74% ===================================
75r_solve(6x^4 - 11x^3 - x^2 - 4);
76
77
78     - 2
79{x=------,x=2}
80     3
81
82%      - 2
83% {x=------,x=2}
84%      3
85
86r_solve(2x^3 + 12x^2 + 13x + 15);
87
88
89{x=-5}
90
91% {x=-5}
92
93% Remaining four CORRECTED examples from Loos' paper:
94% ==================================================
95r_solve(2x^4 - 4x^3 + 3x^2 - 5x - 2);
96
97
98{x=2}
99
100% {x=2}
101
102r_solve(6x^5 + 11x^4 - x^3 + 5x - 6);
103
104
105     - 3     2
106{x=------,x=---}
107     2       3
108
109%      - 3     2
110% {x=------,x=---}
111%      2       3
112
113r_solve(x^5 - 5x^4 + 2x^3 - 25x^2 + 21x + 270);
114
115
116{x=3,x=5,x=-2}
117
118% {x=3,x=5,x=-2}
119
120r_solve(2x^6 + x^5 - 9x^4 - 6x^3 - 5x^2 - 7x + 6);
121
122
123    1
124{x=---,x=-2}
125    2
126
127%     1
128% {x=---,x=-2}
129%     2
130
131% Degenerate equations:
132% ====================
133i_solve 0;
134
135
136{}
137
138% {}
139
140i_solve(0, x);
141
142
143{x=arbint(1)}
144
145% {x=arbint(1)}
146
147r_solve(a = a, x);
148
149
150{x=arbrat(2)}
151
152% {x=arbrat(2)}
153
154r_solve(x^2 - 1, y);
155
156
157{}
158
159% {}
160
161% Test of options and multiplicity:
162% ================================
163i_solve(x^4 - 1, x, noeqs);
164
165
166{1,-1}
167
168% {1,-1}
169
170i_solve((x^4 - 1)^3, x);
171
172
173{x=1,x=-1}
174
175% {x=1,x=-1}
176root_multiplicities;
177
178
179{3,3}
180
181% {3,3}
182
183on multiplicities;
184
185
186i_solve((x^4 - 1)^3, x);
187
188
189{x=1,x=1,x=1,x=-1,x=-1,x=-1}
190
191% {x=1,x=1,x=1,x=-1,x=-1,x=-1}
192root_multiplicities;
193
194
195{}
196
197% {}
198
199i_solve((x^4 - 1)^3, x, separate);
200
201
202{x=1,x=-1}
203
204% {x=1,x=-1}
205root_multiplicities;
206
207
208{3,3}
209
210% {3,3}
211off multiplicities;
212
213
214
215i_solve((x^4 - 1)^3, x, multiplicities);
216
217
218{x=1,x=1,x=1,x=-1,x=-1,x=-1}
219
220% {x=1,x=1,x=1,x=-1,x=-1,x=-1}
221root_multiplicities;
222
223
224{}
225
226% {}
227
228i_solve((x^4 - 1)^3, x, expand, noeqs);
229
230
231{1,1,1,-1,-1,-1}
232
233% {1,1,1,-1,-1,-1}
234root_multiplicities;
235
236
237{}
238
239% {}
240
241i_solve((x^4 - 1)^3, x, together);
242
243
244{{x=1,3},{x=-1,3}}
245
246% {{x=1,3},{x=-1,3}}
247root_multiplicities;
248
249
250{}
251
252% {}
253
254i_solve((x^4 - 1)^3, x, together, noeqs);
255
256
257{{1,3},{-1,3}}
258
259% {{1,3},{-1,3}}
260root_multiplicities;
261
262
263{}
264
265% {}
266
267i_solve((x^4 - 1)^3, x, nomul);
268
269
270{x=-1,x=1}
271
272% {x=-1,x=1}
273root_multiplicities;
274
275
276{}
277
278% {}
279
280% Test of error handling:
281% ======================
282on errcont;
283
284
285r_solve();
286
287
288***** r/i_solve called with no equations
289
290% ***** r/i_solve called with no equations
291
292r_solve(x^2 - a, x);
293
294
295              2
296*****  - a + x  invalid as univariate polynomial over Z
297
298%               2
299% *****  - a + x  invalid as univariate polynomial over Z
300
301r_solve(x^2 - 1, x, foo);
302
303
304***** foo invalid as optional r/i_solve argument
305
306% ***** foo invalid as optional r/i_solve argument
307
308r_solve({x^2 - 1}, x);
309
310
311        2
312***** {x  - 1} invalid as univariate polynomial over Z
313
314%         2
315% ***** {x  - 1} invalid as univariate polynomial over Z
316
317on complex;
318
319
320i_solve((x-1)*(x-i), x);
321
322
323                    2
324*****  - i*x + i + x  - x invalid as univariate polynomial over Z
325
326%                     2
327% *****  - i*x + i + x  - x invalid as univariate polynomial over Z
328
329end$
330
331Tested on x86_64-pc-windows CSL
332Time (counter 1): 0 ms
333
334End of Lisp run after 0.00+0.04 seconds
335real 0.21
336user 0.00
337sys 0.06
338