fix core tests
[scilab.git] / scilab / modules / core / tests / unit_tests / display.dia.ref
1 //<-- CLI SHELL MODE -->
2 // =============================================================================
3 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 // Copyright (C) ????-2008 - INRIA
5 //
6 //  This file is distributed under the same license as the Scilab package.
7 // =============================================================================
8 format("v",10)
9 //display of numbers
10 x=2.6533333
11  x  = 
12    2.6533333
13 x=[2.6533333 -0.0002]
14  x  = 
15    2.6533333  -0.0002
16 x'
17  ans  =
18    2.6533333
19   -0.0002   
20 x=[]
21  x  = 
22     []
23 //display of polynomials
24 z=poly(0,"z")
25  z  = 
26   z
27 num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
28 z-0.0243497
29 (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)* ...
30 z-0.0243497
31 (((1)*z )*z )*z+1
32 0]
33  num  = 
34   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
35   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
36   1 +z³                                                            
37   0                                                                
38 den = [ ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
39 ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
40 ((1)*z )*z
41 1]
42  den  = 
43   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴
44   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴
45   z²                                               
46   1                                                
47 num',den'
48  ans  =
49          column 1
50   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
51          column 2
52   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
53          column 3 to 4
54   1 +z³  0
55  ans  =
56          column 1
57   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴
58          column 2 to 4
59   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴  z²  1
60 [num;den]
61  ans  =
62   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
63   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
64   1 +z³                                                            
65   0                                                                
66   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴                
67   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴                
68   z²                                                               
69   1                                                                
70 [num den]
71  ans  =
72          column 1
73   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
74   -0.0243497 +0.2911572z -1.2916784z² +2.6887936z³ -2.6533333z⁴ +z⁵
75   1 +z³                                                            
76   0                                                                
77          column 2
78   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴
79   0.0113508 -0.168281z +0.8067352z² -1.536926z³ +z⁴
80   z²                                               
81   1                                                
82 //display of polynomials
83 z=poly(0,"z")
84  z  = 
85   z
86 n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1];
87 n2=[n n*n;n*n n**4];d2=[n*n n**4;n n*n];den=d2(1,:);num=n2(2,:);
88 p=poly(rand(5,1),"z");q=poly(rand(6,1),"z");
89 p1=[p,0.1+2.35*z-5.05*z**3];q1=[q,2.56+0.03*z-10.01*z*z+z**5];
90 d3=[1+z**10 z**15];
91 //display of rationals
92 r=num./den
93  r  = 
94          
95    1  1  
96    -  -  
97    1  1  
98 r'
99  ans  =
100       
101    1  
102    -  
103    1  
104       
105    1  
106    -  
107    1  
108 rlist(d,n)
109  ans  =
110               
111    1 +2z +z²  
112    ---------  
113      1 +z     
114 rlist(n,d)
115  ans  =
116               
117      1 +z     
118    ---------  
119    1 +2z +z²  
120 rlist(d2,n2)
121  ans  =
122                                    
123    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
124    ---------  -------------------  
125      1 +z          1 +2z +z²       
126                                    
127      1 +z          1 +2z +z²       
128    ---------  -------------------  
129    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
130 rlist(n2,d2)
131  ans  =
132                                    
133      1 +z          1 +2z +z²       
134    ---------  -------------------  
135    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
136                                    
137    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
138    ---------  -------------------  
139      1 +z          1 +2z +z²       
140 rlist(den,num)
141  ans  =
142                                    
143    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
144    ---------  -------------------  
145    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
146 rlist(num,den)
147  ans  =
148                                    
149    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
150    ---------  -------------------  
151    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
152 rlist(p1,q1)
153  ans  =
154  
155          column 1
156  
157                                                                       
158    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
159    -----------------------------------------------------------------  
160      0.0123314 -0.2684985z +1.5393672z² -4.0114366z³ +5.4004179z⁴     
161       -3.6713072z⁵ +z⁶                                                
162  
163          column 2
164  
165                              
166       0.1 +2.35z -5.05z³     
167    ------------------------  
168    2.56 +0.03z -10.01z² +z⁵  
169                              
170 rlist(q1,p1)
171  ans  =
172  
173          column 1
174  
175                                                                       
176      0.0123314 -0.2684985z +1.5393672z² -4.0114366z³ +5.4004179z⁴     
177       -3.6713072z⁵ +z⁶                                                
178    -----------------------------------------------------------------  
179    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
180  
181          column 2
182  
183                              
184    2.56 +0.03z -10.01z² +z⁵  
185    ------------------------  
186       0.1 +2.35z -5.05z³     
187                              
188 rlist(p,q)
189  ans  =
190                                                                       
191    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
192    -----------------------------------------------------------------  
193      0.0123314 -0.2684985z +1.5393672z² -4.0114366z³ +5.4004179z⁴     
194       -3.6713072z⁵ +z⁶                                                
195 rlist(q,p)
196  ans  =
197                                                                       
198      0.0123314 -0.2684985z +1.5393672z² -4.0114366z³ +5.4004179z⁴     
199       -3.6713072z⁵ +z⁶                                                
200    -----------------------------------------------------------------  
201    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
202 rlist(p,z)
203  ans  =
204                                                                       
205    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
206    -----------------------------------------------------------------  
207                                    z                                  
208 rlist(z,p)
209  ans  =
210                                                                       
211                                    z                                  
212    -----------------------------------------------------------------  
213    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
214 rlist(d1,n1)
215  ans  =
216                                                                    
217    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
218    ---------  -------------------  ---------  -------------------  
219      1 +z          1 +2z +z²         1 +z          1 +2z +z²       
220 rlist(n1,d1)
221  ans  =
222                                                                    
223      1 +z          1 +2z +z²         1 +z          1 +2z +z²       
224    ---------  -------------------  ---------  -------------------  
225    1 +2z +z²  1 +4z +6z² +4z³ +z⁴  1 +2z +z²  1 +4z +6z² +4z³ +z⁴  
226 //display of strings
227 digits="abcdefghijklmnopqrstuvwxyz"
228  digits  = 
229   "abcdefghijklmnopqrstuvwxyz"
230 numbers="1234567890"
231  numbers  = 
232   "1234567890"
233 majuscules="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
234  majuscules  = 
235   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
236 symbols=",./;''[] \ =-!\$%^&*()_+~:""[]| @"
237  symbols  = 
238   ",./;'[] \ =-!\$%^&*()_+~:"[]| @"
239 [numbers;digits]
240  ans  =
241   "1234567890"                
242   "abcdefghijklmnopqrstuvwxyz"
243 [numbers digits;digits numbers]
244  ans  =
245   "1234567890"                  "abcdefghijklmnopqrstuvwxyz"
246   "abcdefghijklmnopqrstuvwxyz"  "1234567890"                
247 [numbers digits+digits+digits]
248  ans  =
249          column 1
250   "1234567890"
251          column 2
252   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
253 ans';
254 [ans ans]
255  ans  =
256          column 1
257   "1234567890"                                                         
258   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
259          column 2
260   "1234567890"                                                         
261   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
262 ""
263  ans  =
264   ""
265 oldlines = lines();
266 lines(0,50);
267 digits="abcdefghijklmnopqrstuvwxyz";
268 d = digits+digits+digits;
269 n = "1234567890";
270 // scalar
271 n
272  n  = 
273   "1234567890"
274 n+n+n+n+n
275  ans  =
276   "12345678901234567890123456789012345678901234567890"
277 d
278  d  = 
279   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
280 d+d+d+d
281  ans  =
282   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
283 // column vector
284 [n; n; n; n; n]
285  ans  =
286   "1234567890"
287   "1234567890"
288   "1234567890"
289   "1234567890"
290   "1234567890"
291 [d; d; d; d; d]
292  ans  =
293   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
294   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
295   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
296   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
297   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
298 [n+n; n+n; n+n]
299  ans  =
300   "12345678901234567890"
301   "12345678901234567890"
302   "12345678901234567890"
303 [n+n; n+n+n; n+n]
304  ans  =
305   "12345678901234567890"          
306   "123456789012345678901234567890"
307   "12345678901234567890"          
308 [n+n; d+d; n+n]
309  ans  =
310   "12345678901234567890"                         
311   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
312   "12345678901234567890"                         
313 [d; d]
314  ans  =
315   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
316   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
317 [d; n]
318  ans  =
319   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
320   "1234567890"                                   
321 [n; d]
322  ans  =
323   "1234567890"                                   
324   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
325 [n; n]
326  ans  =
327   "1234567890"
328   "1234567890"
329 // row vector
330 [n n n n n]
331  ans  =
332          column 1 to 3
333   "1234567890"  "1234567890"  "1234567890"
334          column 4 to 5
335   "1234567890"  "1234567890"
336 [d d d d d]
337  ans  =
338          column 1
339   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
340          column 2
341   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
342          column 3
343   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
344          column 4
345   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
346          column 5
347   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
348 [n+n n+n n+n]
349  ans  =
350          column 1 to 2
351   "12345678901234567890"  "12345678901234567890"
352          column 3
353   "12345678901234567890"
354 [n+n n+n+n n+n]
355  ans  =
356          column 1
357   "12345678901234567890"
358          column 2
359   "123456789012345678901234567890"
360          column 3
361   "12345678901234567890"
362 [d d]
363  ans  =
364          column 1
365   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
366          column 2
367   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
368 [d n]
369  ans  =
370          column 1
371   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
372          column 2
373   "1234567890"
374 [n d]
375  ans  =
376          column 1
377   "1234567890"
378          column 2
379   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
380 [n n]
381  ans  =
382   "1234567890"  "1234567890"
383 // matrix
384 nd = [n d];
385 dn = [d n];
386 [nd nd]
387  ans  =
388          column 1
389   "1234567890"
390          column 2
391   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
392          column 3
393   "1234567890"
394          column 4
395   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
396 [nd; nd]
397  ans  =
398          column 1
399   "1234567890"
400   "1234567890"
401          column 2
402   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
403   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
404 [nd' nd']
405  ans  =
406          column 1
407   "1234567890"                                   
408   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
409          column 2
410   "1234567890"                                   
411   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
412 [nd'; nd']
413  ans  =
414   "1234567890"                                   
415   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
416   "1234567890"                                   
417   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
418 [dn dn]
419  ans  =
420          column 1
421   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
422          column 2
423   "1234567890"
424          column 3
425   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
426          column 4
427   "1234567890"
428 [dn; dn]
429  ans  =
430          column 1
431   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
432   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
433          column 2
434   "1234567890"
435   "1234567890"
436 [dn' dn']
437  ans  =
438          column 1
439   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
440   "1234567890"                                   
441          column 2
442   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
443   "1234567890"                                   
444 [dn'; dn']
445  ans  =
446   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
447   "1234567890"                                   
448   "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
449   "1234567890"                                   
450 lines(oldlines);
451 // display of list
452 list()
453  ans  =
454      ()
455 list(1,2,3)
456  ans  =
457        ans(1)
458    1.
459        ans(2)
460    2.
461        ans(3)
462    3.
463 list(list(1,list()),2)
464  ans  =
465        ans(1)
466               ans(1)(1)
467    1.
468               ans(1)(2)
469      ()
470        ans(2)
471    2.
472 list(rlist(q,p),1.23)
473  ans  =
474        ans(1)
475                                                                       
476      0.0123314 -0.2684985z +1.5393672z² -4.0114366z³ +5.4004179z⁴     
477       -3.6713072z⁵ +z⁶                                                
478    -----------------------------------------------------------------  
479    -0.0000078 +0.0351988z -0.3720034z² +1.3432153z³ -1.9632981z⁴ +z⁵  
480        ans(2)
481    1.23
482 // overloading of display
483 1:$
484  ans  =
485  1:1:$
486 list(1,1:$)
487  ans  =
488        ans(1)
489    1.
490        ans(2)
491  1:1:$
492 list(list(1:$))
493  ans  =
494        ans(1)
495               ans(1)(1)
496  1:1:$
497 list(list(1,$),list())
498  ans  =
499        ans(1)
500               ans(1)(1)
501    1.
502               ans(1)(2)
503   $
504        ans(2)
505      ()
506 // Tlist overloaded display
507 TL=tlist("x",1,2)
508  TL  = 
509        TL(1)
510   "x"
511        TL(2)
512    1.
513        TL(3)
514    2.
515 deff("%x_p(x)","disp(''Mydisplay'',x(2),x(3))")
516 TL
517  TL  = 
518   "Mydisplay"
519    1.
520    2.
521 list(TL)
522  ans  =
523        ans(1)
524   "Mydisplay"
525    1.
526    2.
527 list(list(TL))
528  ans  =
529        ans(1)
530               ans(1)(1)
531   "Mydisplay"
532    1.
533    2.
534 TL=tlist("x",1:$,2)
535  TL  = 
536   "Mydisplay"
537  1:1:$
538    2.
539 list(TL)
540  ans  =
541        ans(1)
542   "Mydisplay"
543  1:1:$
544    2.
545 list(list(TL))
546  ans  =
547        ans(1)
548               ans(1)(1)
549   "Mydisplay"
550  1:1:$
551    2.
552 TL(2)=TL
553  TL  = 
554   "Mydisplay"
555   "Mydisplay"
556  1:1:$
557    2.
558    2.
559 // boolean
560 %t
561  ans  =
562   T
563 %f
564  ans  =
565   F
566 b=[%t %t %t]
567  b  = 
568   T T T
569 ~b
570  ans  =
571   F F F
572 bp=b'
573  bp  = 
574   T
575   T
576   T
577 ~bp
578  ans  =
579   F
580   F
581   F
582 bb=[b; b; b]
583  bb  = 
584   T T T
585   T T T
586   T T T
587  
588 ~bb
589  ans  =
590   F F F
591   F F F
592   F F F
593