summaryrefslogtreecommitdiff
path: root/modules/polynomials/tests/unit_tests/polelm.dia.ref
blob: 2d421fc59c10f3b63d6f1f704312ed814216ad43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) ????-2008 - INRIA
//
//  This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
//poly (coeff)
v=[1 2 3];nam='s';job='c';p=1+2*%s+3*%s^2;
if poly(v,'s','c')<>p then bugmes();quit;end
if poly(v+0,'s','c')<>p then bugmes();quit;end
if poly(v,nam,'c')<>p then bugmes();quit;end
if poly(v+0,nam,'c')<>p then bugmes();quit;end
if poly(v,'s',job)<>p then bugmes();quit;end
if poly(v+0,'s',job)<>p then bugmes();quit;end
if poly(v,nam,job)<>p then bugmes();quit;end
if poly(v+0,nam,job)<>p then bugmes();quit;end
v=[1+%i 2 3];p=1+%i+2*%s+3*%s^2;
if poly(v,'s','c')<>p then bugmes();quit;end
if poly(v+0,'s','c')<>p then bugmes();quit;end
if poly(v,nam,'c')<>p then bugmes();quit;end
if poly(v+0,nam,'c')<>p then bugmes();quit;end
if poly(v,'s',job)<>p then bugmes();quit;end
if poly(v+0,'s',job)<>p then bugmes();quit;end
if poly(v,nam,job)<>p then bugmes();quit;end
if poly(v+0,nam,job)<>p then bugmes();quit;end
//poly (roots)
v=[1 2 3];nam='s';job='r';p=-6+11*%s-6*%s^2+%s^3;
if poly(v,'s','r')<>p then bugmes();quit;end
if poly(v+0,'s','r')<>p then bugmes();quit;end
if poly(v,nam,'r')<>p then bugmes();quit;end
if poly(v+0,nam,'r')<>p then bugmes();quit;end
if poly(v,'s',job)<>p then bugmes();quit;end
if poly(v+0,'s',job)<>p then bugmes();quit;end
if poly(v,nam,job)<>p then bugmes();quit;end
if poly(v+0,nam,job)<>p then bugmes();quit;end
v=[1+%i 2 3];p=-6-%i*6+(11+%i*5)*%s+(-6-%i)*%s^2+%s^3;
if poly(v,'s','r')<>p then bugmes();quit;end
if poly(v+0,'s','r')<>p then bugmes();quit;end
if poly(v,nam,'r')<>p then bugmes();quit;end
if poly(v+0,nam,'r')<>p then bugmes();quit;end
if poly(v,'s',job)<>p then bugmes();quit;end
if poly(v+0,'s',job)<>p then bugmes();quit;end
if poly(v,nam,job)<>p then bugmes();quit;end
if poly(v+0,nam,job)<>p then bugmes();quit;end
v=[];p=poly(1,'s','c');
if poly(v,'s','r')<>p then bugmes();quit;end
if poly([],'s','r')<>p then bugmes();quit;end
if poly(v,nam,'r')<>p then bugmes();quit;end
if poly([],nam,'r')<>p then bugmes();quit;end
if poly(v,'s',job)<>p then bugmes();quit;end
if poly([],'s',job)<>p then bugmes();quit;end
if poly(v,nam,job)<>p then bugmes();quit;end
if poly([],nam,job)<>p then bugmes();quit;end
//poly (caracteristic)
nam='s';a=[1 2;3 4];p=-2-5*%s+%s^2;
if norm(coeff(poly(a,'s')-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a+0,'s')-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a,nam)-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a+0,nam)-p))>100*%eps then bugmes();quit;end
a=[1+%i 2;3 4];p=-2+%i*4+(-5-%i)*%s+%s^2 ;
if norm(coeff(poly(a,'s')-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a+0,'s')-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a,nam)-p))>100*%eps then bugmes();quit;end
if norm(coeff(poly(a+0,nam)-p))>100*%eps then bugmes();quit;end
a=[];p=poly(1,'s','c');
if poly(a,'s')<>p then bugmes();quit;end
if poly([],'s')<>p then bugmes();quit;end
if poly(a,nam)<>p then bugmes();quit;end
if poly([],nam)<>p then bugmes();quit;end
//degree
v=[1 2 3];d=[0 0 0];
if or(degree(v)<>d) then bugmes();quit;end
if or(degree(v+0)<>d) then bugmes();quit;end
v=[-2-5*%s+%s^2;-6+11*%s-6*%s^2+%s^3];d=[2;3];
if or(degree(v)<>d) then bugmes();quit;end
if or(degree(v+0)<>d) then bugmes();quit;end
v=[];d=[];
if or(degree(v)<>d) then bugmes();quit;end
if or(degree([])<>d) then bugmes();quit;end
//coeff
p=[1+2*%s;%s^3];c=[1 2 0 0;0 0 0 1];sel=[0 1 1];
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff(p+0)<>c) then bugmes();quit;end
if or(coeff(p,sel)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p+0,sel)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p,sel+0)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c(:,sel+1)) then bugmes();quit;end
sel=5;
if or(coeff(p,sel+0)<>zeros(size(p,1),1)) then bugmes();quit;end
p=[1+2*%s, %s^3];c=[1 0 2 0 0 0 0 1];
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff(p+0)<>c) then bugmes();quit;end
sel=[0 0];c=[1 0 1 0];
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,sel+0)<>c) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c) then bugmes();quit;end
p=[1+%i+2*%s;%s^3];c=[1+%i 2 0 0;0 0 0 1];sel=[0 1 1];
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff(p+0)<>c) then bugmes();quit;end
if or(coeff(p,sel)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p+0,sel)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p,sel+0)<>c(:,sel+1)) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c(:,sel+1)) then bugmes();quit;end
sel=5;
if or(coeff(p,sel+0)<>zeros(size(p,1),1)) then bugmes();quit;end
p=[1+2*%s, %s^3];c=[1 0 2 0 0 0 0 1];
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff(p+0)<>c) then bugmes();quit;end
sel=[0 0];c=[1 0 1 0];
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,sel+0)<>c) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c) then bugmes();quit;end
p=[1 2;3 4];sel=0;c=p;
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff(p+0)<>c) then bugmes();quit;end
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,sel+0)<>c) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c) then bugmes();quit;end
p=[1 2;3 4];sel=[0 0];c=[p p];
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,sel+0)<>c) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c) then bugmes();quit;end
p=[1 2;3 4];sel=[0 1];c=[p 0*p];
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,sel+0)<>c) then bugmes();quit;end
if or(coeff(p+0,sel+0)<>c) then bugmes();quit;end
p=[1 2;3 4];sel=[];c=[];
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff(p+0,sel)<>c) then bugmes();quit;end
if or(coeff(p,[])<>c) then bugmes();quit;end
if or(coeff(p+0,[])<>c) then bugmes();quit;end
p=[],sel=0,c=[];
 p  =
 
     []
 sel  =
 
    0.  
if or(coeff(p)<>c) then bugmes();quit;end
if or(coeff([])<>c) then bugmes();quit;end
if or(coeff(p,sel)<>c) then bugmes();quit;end
if or(coeff([],sel)<>c) then bugmes();quit;end
//sum 
a=[1+%s 2;-3 4;5 -6];
if sum(a)<>3+%s then bugmes();quit;end
if sum(a+0)<>3+%s then bugmes();quit;end
if or(sum(a,1)<>[3+%s 0]) then bugmes();quit;end
if or(sum(a+0,1)<>[3+%s 0]) then bugmes();quit;end
n=1;
if or(sum(a,n)<>[3+%s 0]) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s 0]) then bugmes();quit;end
if or(sum(a,'r')<>[3+%s 0]) then bugmes();quit;end
if or(sum(a+0,'r')<>[3+%s 0]) then bugmes();quit;end
n='r';
if or(sum(a,n)<>[3+%s 0]) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s 0]) then bugmes();quit;end
if or(sum(a,2)<>[3+%s;1;-1]) then bugmes();quit;end
if or(sum(a+0,2)<>[3+%s;1;-1]) then bugmes();quit;end
n=2;
if or(sum(a,n)<>[3+%s;1;-1]) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s;1;-1]) then bugmes();quit;end
if or(sum(a,'c')<>[3+%s;1;-1]) then bugmes();quit;end
if or(sum(a+0,'c')<>[3+%s;1;-1]) then bugmes();quit;end
n='c';
if or(sum(a,n)<>[3+%s;1;-1]) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s;1;-1]) then bugmes();quit;end
a=[1+%s 2;-3 4;5 -6]+0*%i;
if or(sum(a)<>3+%s+0*%i) then bugmes();quit;end
if or(sum(a+0)<>3+%s+0*%i) then bugmes();quit;end
if or(sum(a,1)<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a+0,1)<>[3+%s 0]+0*%i) then bugmes();quit;end
n=1;
if or(sum(a,n)<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a,'r')<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a+0,'r')<>[3+%s 0]+0*%i) then bugmes();quit;end
n='r';
if or(sum(a,n)<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s 0]+0*%i) then bugmes();quit;end
if or(sum(a,2)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
if or(sum(a+0,2)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
n=2;
if or(sum(a,n)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
if or(sum(a,'c')<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
if or(sum(a+0,'c')<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
n='c';
if or(sum(a,n)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
if or(sum(a+0,n)<>[3+%s;1;-1]+0*%i) then bugmes();quit;end
//prod
a=[1+%s 2;-3 4;5 -6];
if prod(a)<>720+720*%s then bugmes();quit;end
if prod(a+0)<>720+720*%s then bugmes();quit;end
if or(prod(a,1)<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a+0,1)<>[-15-15*%s,-48]) then bugmes();quit;end
n=1;
if or(prod(a,n)<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a+0,n)<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a,'r')<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a+0,'r')<>[-15-15*%s,-48]) then bugmes();quit;end
n='r';
if or(prod(a,n)<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a+0,n)<>[-15-15*%s,-48]) then bugmes();quit;end
if or(prod(a,2)<>[2+2*%s;-12;-30]) then bugmes();quit;end
if or(prod(a+0,2)<>[2+2*%s;-12;-30]) then bugmes();quit;end
n=2;
if or(prod(a,n)<>[2+2*%s;-12;-30]) then bugmes();quit;end
if or(prod(a+0,n)<>[2+2*%s;-12;-30]) then bugmes();quit;end
if or(prod(a,'c')<>[2+2*%s;-12;-30]) then bugmes();quit;end
if or(prod(a+0,'c')<>[2+2*%s;-12;-30]) then bugmes();quit;end
n='c';
if or(prod(a,n)<>[2+2*%s;-12;-30]) then bugmes();quit;end
if or(prod(a+0,n)<>[2+2*%s;-12;-30]) then bugmes();quit;end
a=[1+%s 2;-3 4;5 -6]+0*%i;
if or(prod(a)<>720+720*%s+0*%i) then bugmes();quit;end
if or(prod(a+0)<>720+720*%s+0*%i) then bugmes();quit;end
if or(prod(a,1)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a+0,1)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
n=1;
if or(prod(a,n)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a+0,n)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a,'r')<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a+0,'r')<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
n='r';
if or(prod(a,n)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a+0,n)<>[-15-15*%s,-48]+0*%i) then bugmes();quit;end
if or(prod(a,2)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
if or(prod(a+0,2)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
n=2;
if or(prod(a,n)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
if or(prod(a+0,n)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
if or(prod(a,'c')<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
if or(prod(a+0,'c')<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
n='c';
if or(prod(a,n)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
if or(prod(a+0,n)<>[2+2*%s;-12;-30]+0*%i) then bugmes();quit;end
//diag
a=[1+%s 2 3];
if or(diag(a+0)<>[1+%s 0 0;0 2 0;0 0 3]) then bugmes();quit;end
if or(diag(a)<>[1+%s 0 0;0 2 0;0 0 3]) then bugmes();quit;end
if or(diag([1+%s %i 2])<>[1+%s 0 0;0 %i 0;0 0 2]) then bugmes();quit;end
a=[1+%s %i 2 ];
if or(diag(a)<>[1+%s 0 0;0 %i 0;0 0 2]) then bugmes();quit;end
a=[1+%s 2 3 4;5 6 7 8];un=poly(1,'s','c');
if or(diag(a)<>[1+%s;6]) then bugmes();quit;end
if or(diag(a+0)<>[1+%s;6]) then bugmes();quit;end
if or(diag(a,1)<>[2*un;7]) then bugmes();quit;end
if or(diag(a+0,1)<>[2*un;7]) then bugmes();quit;end
if or(diag(a,-1)<>[5*un]) then bugmes();quit;end
if or(diag(a+0,-1)<>[5*un]) then bugmes();quit;end
if diag(a,4)<>[] then bugmes();quit;end
a(1,1)=%i+%s;
if or(diag(a)<>[%i+%s;6]) then bugmes();quit;end
if or(diag(a+0)<>[%i+%s;6]) then bugmes();quit;end
if or(diag(a,1)<>[2*un;7]) then bugmes();quit;end
if or(diag(a+0,1)<>[2*un;7]) then bugmes();quit;end
if or(diag(a,-1)<>[5*un]) then bugmes();quit;end
if or(diag(a+0,-1)<>[5*un]) then bugmes();quit;end
if diag(a,4)<>[] then bugmes();quit;end
//triu
a=[1+%s 2 3 4;5 6 7 8];un=poly(1,'s','c');
if or(triu(a)<>[1+%s 2 3 4;0 6 7 8]) then bugmes();quit;end
if or(triu(a+0)<>[1+%s 2 3 4;0 6 7 8]) then bugmes();quit;end
if or(triu(a,1)<>[0 2*un 3 4;0 0 7 8]) then bugmes();quit;end
if or(triu(a+0,1)<>[0 2*un 3 4;0 0 7 8]) then bugmes();quit;end
if or(triu(a,-1)<>a) then bugmes();quit;end
if or(triu(a+0,-1)<>a) then bugmes();quit;end
if or(triu(a,4)<>0*a) then bugmes();quit;end
a(1,1)=%i+%s;
if or(triu(a)<>[%i+%s 2 3 4;0 6 7 8]) then bugmes();quit;end
if or(triu(a+0)<>[%i+%s 2 3 4;0 6 7 8]) then bugmes();quit;end
if or(triu(a,1)<>[0 2*un 3 4;0 0 7 8]) then bugmes();quit;end
if or(triu(a+0,1)<>[0 2*un 3 4;0 0 7 8]) then bugmes();quit;end
if or(triu(a,-1)<>a) then bugmes();quit;end
if or(triu(a+0,-1)<>a) then bugmes();quit;end
if or(triu(a,4)<>0*a) then bugmes();quit;end
//tril
a=[1+%s 2 3 4;5 6 7 8];
if or(tril(a)<>[1+%s 0 0 0;5 6 0 0]) then bugmes();quit;end
if or(tril(a+0)<>[1+%s 0 0 0;5 6 0 0]) then bugmes();quit;end
if or(tril(a,1)<>[1+%s 2 0 0;5 6  7 0]) then bugmes();quit;end
if or(tril(a+0,1)<>[1+%s 2 0 0;5 6  7 0]) then bugmes();quit;end
if or(tril(a,4)<>a) then bugmes();quit;end
if or(tril(a+0,4)<>a) then bugmes();quit;end
if or(tril(a,-3)<>0*a) then bugmes();quit;end
a(1,1)=%i+%s;
if or(tril(a)<>[%i+%s 0 0 0;5 6 0 0]) then bugmes();quit;end
if or(tril(a+0)<>[%i+%s 0 0 0;5 6 0 0]) then bugmes();quit;end
if or(tril(a,1)<>[%i+%s 2 0 0;5 6  7 0]) then bugmes();quit;end
if or(tril(a+0,1)<>[%i+%s 2 0 0;5 6  7 0]) then bugmes();quit;end
if or(tril(a,4)<>a) then bugmes();quit;end
if or(tril(a+0,4)<>a) then bugmes();quit;end
if or(tril(a,-3)<>0*a) then bugmes();quit;end
//simp_mode
a=%t
 a  =
 
  T  
simp_mode(%t);
if simp_mode()<>%t then bugmes();quit;end
simp_mode(a);
if simp_mode()<>%t then bugmes();quit;end
[n,d]=simp(%s,%s);if n<>poly(1,'s','c')|d<>poly(1,'s','c') then bugmes();quit;end
a=%f
 a  =
 
  F  
simp_mode(%f);
if simp_mode()<>%f then bugmes();quit;end
simp_mode(a);
if simp_mode()<>%f then bugmes();quit;end
[n,d]=simp(%s,%s);if n<>%s|d<>%s then bugmes();quit;end
//varn
a=1+%s;
if varn(a)<>'s' then bugmes();quit;end
if varn(a+0)<>'s' then bugmes();quit;end
if varn(a,'z')<>1+%z then bugmes();quit;end
if varn(a+0,'z')<>1+%z then bugmes();quit;end
nam='z';
if varn(a,nam)<>1+%z then bugmes();quit;end
if varn(a+0,nam)<>1+%z then bugmes();quit;end
a=[];
if varn(a,nam)<>[] then bugmes();quit;end
if varn([],nam)<>[] then bugmes();quit;end
//clean
a=[1 1.d-12 1.d-5 2d8+%s];un=poly(1,'s','c')
 un  =
 
    1   
b=[1 0 1.d-5 2d8+%s];
if or(clean(a)<>b) then bugmes();quit;end
if or(clean(a+0)<>b) then bugmes();quit;end
epsa=1.d-10;
if or(clean(a,epsa)<>b) then bugmes();quit;end
if or(clean(a+0,epsa)<>b) then bugmes();quit;end
if or(clean(a,epsa+0)<>b) then bugmes();quit;end
if or(clean(a+0,epsa+0)<>b) then bugmes();quit;end
epsr=1.d-4;b=[1 0 1.d-5 2d8*un];
if or(clean(a,epsa,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr+0)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr+0)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa+0,epsr+0)<>b) then bugmes();quit;end
a=[1+%i 1.d-12 1.d-5 2d8+%s];
b=[1+%i 0 1.d-5 2d8+%s];
if or(clean(a)<>b) then bugmes();quit;end
if or(clean(a+0)<>b) then bugmes();quit;end
epsa=1.d-10;
if or(clean(a,epsa)<>b) then bugmes();quit;end
if or(clean(a+0,epsa)<>b) then bugmes();quit;end
if or(clean(a,epsa+0)<>b) then bugmes();quit;end
if or(clean(a+0,epsa+0)<>b) then bugmes();quit;end
epsr=1.d-5;b=[1+%i 0 1.d-5 poly([2d8,0],'s','c')];
if or(clean(a,epsa,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr+0)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa,epsr+0)<>b) then bugmes();quit;end
if or(clean(a,epsa+0,epsr)<>b) then bugmes();quit;end
if or(clean(a+0,epsa+0,epsr+0)<>b) then bugmes();quit;end
//simp
simp_mode(%t);
p=[];
[n,d]=simp(p,p);if n<>[]|p<>[] then bugmes();quit;end
[n,d]=simp([],[]);if n<>[]|p<>[] then bugmes();quit;end
un=poly(1,'s','c');p=%s;
[n,d]=simp(p,p);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p+0,p);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p,p+0);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p+0,p+0);if n<>un|d<>un then bugmes();quit;end
un=1;
[n,d]=simp(p,un);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p,1);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p+0,un);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p+0,1);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(un,p);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(1,p);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(un,p+0);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(1,p+0);if n<>un|d<>p then bugmes();quit;end
p=1+%s^10;un=poly(1,'s','c')
 un  =
 
    1   
[n,d]=simp(p,p);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p+0,p);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p,p+0);if n<>un|d<>un then bugmes();quit;end
[n,d]=simp(p+0,p+0);if n<>un|d<>un then bugmes();quit;end
un=1;
[n,d]=simp(p,un);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p,1);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p+0,un);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(p+0,1);if n<>p|d<>1 then bugmes();quit;end
[n,d]=simp(un,p);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(1,p);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(un,p+0);if n<>un|d<>p then bugmes();quit;end
[n,d]=simp(1,p+0);if n<>un|d<>p then bugmes();quit;end
un=poly(1,'s','c');p=%s;
h=rlist(p,p,[]);un=rlist(poly(1,'s','c'),poly(1,'s','c'),[]);
if simp(h)<>un then bugmes();quit;end
if simp(rlist(p,p,[]))<>un then bugmes();quit;end
h=rlist(p,1,[]);
if simp(h)<>h then bugmes();quit;end
if simp(rlist(p,1,[]))<>h then bugmes();quit;end
h=rlist(1,p,[]);
if simp(h)<>h then bugmes();quit;end
if simp(rlist(1,p,[]))<>h then bugmes();quit;end
p=1+%s^10;
h=rlist(p,p,[]);un=rlist(poly(1,'s','c'),poly(1,'s','c'),[]);
if simp(h)<>un then bugmes();quit;end
if simp(rlist(p,p,[]))<>un then bugmes();quit;end
h=rlist(p,1,[]);
if simp(h)<>h then bugmes();quit;end
if simp(rlist(p,1,[]))<>h then bugmes();quit;end
h=rlist(1,p,[]);
if simp(h)<>h then bugmes();quit;end
if simp(rlist(1,p,[]))<>h then bugmes();quit;end
//pdiv
p=[];
[n,d]=pdiv(p,p);if n<>[]|p<>[] then bugmes();quit;end
[n,d]=pdiv([],[]);if n<>[]|p<>[] then bugmes();quit;end
if pdiv(p,p)<>[] then bugmes();quit;end
if pdiv([],[])<>[] then bugmes();quit;end
p1=%s;p2=p1;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
p1=%s;p2=1;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
p1=1;p2=%s;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
p1=%s+%i;p2=p1;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
p1=%s;p2=1+%i;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
p1=1+%i;p2=%s;
[r,q]=pdiv(p1,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if p2*q+r<>p1 then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if p2*q+r<>p1 then bugmes();quit;end
//
p1=%s;p2=p1;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
p1=%s;p2=1;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
p1=1;p2=%s;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
p1=%s+%i;p2=p1;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
p1=%s;p2=1+%i;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
p1=1+%i;p2=%s;
[r,q]=pdiv(p1,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
[r,q]=pdiv(p1+0,p2+0);if pdiv(p1,p2)<>q then bugmes();quit;end
//bezout
p1=%s;p2=p1;
[p,U]=bezout(p1,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
p1=%s;p2=1;
[p,U]=bezout(p1,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
p1=1;p2=%s;
[p,U]=bezout(p1,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
p1=1;p2=1;
[p,U]=bezout(p1,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
[p,U]=bezout(p1+0,p2+0);if norm(coeff([p1 p2]*U-[p 0]))>10*%eps  then bugmes();quit;end
//sfact
p=(%s-1/2)*(2-%s);
w=sfact(p); if norm(coeff(w*numer(horner(w,1/%s))-p))>10*%eps  then bugmes();quit;end
w=sfact(p+0);if norm(coeff(w*numer(horner(w,1/%s))-p))>10*%eps  then bugmes();quit;end
F1=[%z-1/2,%z+1/2,%z^2+2;1,%z,-%z;%z^3+2*%z,%z,1/2-%z];
P=F1*gtild(F1,'d');
F=sfact(P);if norm(coeff(P-F*gtild(F,'d')))>100*%eps  then bugmes();quit;end
F=sfact(P+0);if norm(coeff(P-F*gtild(F,'d')))>100*%eps  then bugmes();quit;end