1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
2 /***************************************************************************
4 *** Copyright (c) 1984 by William Schelter,University of Texas *****
5 *** All rights reserved *****
6 ***************************************************************************/
8 /* PRODUCED USING TOPS 20 AS GUIDE AND CHECKED ON 3600
9 This and the rtest*.mac files can be run using the command
10 Batch("cl-maxima-source:maxima;rtest1.mac",test); and a
11 log file will be written recording the items which the testing
12 function does not find the same as those answers listed in this file.
13 The test is based on manual.demo, with the answers obtained from
14 tops 20 macsyma, and checked on the 3600 with cl-maxima.
15 Although we have tried to put sufficient kills in, to eliminate
16 errors caused by previous definitions, you may get some additional
17 errors if you rerun the tests, or run some out of order. */
19 (?fmakunbound(f),kill(functions,values,arrays));
33 ev(g(2*y+z,-0.5),y:7);
34 3*(z+14)+1.22984884706593$
35 h(n):=sum(i*x^i,i,0,n);
36 h(n):=sum(i*x^i,i,0,n)$
39 t[n](x):=ratexpand(2*x*t[n-1](x)-t[n-2](x));
40 t[n](x):=ratexpand(2*x*t[n-1](x)-t[n-2](x))$
47 g[n](x):=sum(ev(x),i,n,n+2);
48 g[n](x):=sum(ev(x),i,n,n+2)$
49 h(n,x):=sum(ev(x),i,n,n+2);
50 h(n,x):=sum(ev(x),i,n,n+2)$
55 p[n](x):=ratsimp(1/(2^n*n!)*diff((x^2-1)^n,x,n));
56 p[n](x):=ratsimp(1/(2^n*n!)*diff((x^2-1)^n,x,n))$
57 q(n,x):=ratsimp(1/(2^n*n!)*diff((x^2-1)^n,x,n));
58 q(n,x):=ratsimp(1/(2^n*n!)*diff((x^2-1)^n,x,n))$
60 lambda([x],(3*x^2-1)/2)$
69 g(fun,a,b):=print(fun," applied to ",a," and ",b," is ",fun(a,b));
70 g(fun,a,b):=print(fun," applied to ",a," and ",b," is ",fun(a,b))$
71 g(f[2,1],sin(%pi),2*c);
74 /* tests for ibase and obase; a recent accretion. dunno where else to put this stuff. */
76 [integerp (2.), floatnump (2.)];
83 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
97 [symbolp (23401), numberp (23401)];
100 [symbolp (\10432), numberp (\10432)];
103 [10.25, 10.25d0, 10.25e0, 10.25f0, 10.25s0] - 1010 - 1/100;
104 ''(float ([0, 0, 0, 0, 0]));
106 [99.25, 99.25d0, 99.25e0, 99.25f0, 99.25s0] - 1100011 - 1/100;
107 ''(float ([0, 0, 0, 0, 0]));
113 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
119 ''(8.^3 + 8.^2 + 8. + 1);
124 [symbolp (8765), numberp (8765)];
127 [symbolp (\5678), numberp (\5678)];
130 [10.25, 10.25d0, 10.25e0, 10.25f0, 10.25s0] - 12 - 1/4;
131 ''(float ([0, 0, 0, 0, 0]));
133 [99.25, 99.25d0, 99.25e0, 99.25f0, 99.25s0] - 143 - 1/4;
134 ''(float ([0, 0, 0, 0, 0]));
140 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
146 ''(16.^5 + 16.^4 + 16.^3 + 16.^2 + 16. + 1);
149 ''(9*16.^2 + 9*16. + 9);
154 [symbolp (a000), numberp (a000)];
157 [symbolp (0a000), numberp (0a000)];
163 [symbolp (\0a000), numberp (\0a000)];
166 [is (abc = 0abc), is (0abc = \0abc), is (\0abc = abc)];
167 [false, false, false];
169 a000 + a000 + 0a000 + 0a000 + \0a000 + \0a000;
170 2*a000 + 2*\0a000 + 14000;
172 [10.25, 10.25d0, 10.25e0, 10.25f0, 10.25s0] - 0a - 1/4;
173 ''(float ([0, 0, 0, 0, 0]));
175 [99.25, 99.25d0, 99.25e0, 99.25f0, 99.25s0] - 63 - 1/4;
176 ''(float ([0, 0, 0, 0, 0]));
188 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
194 ''(36.^3 + 36.^2 + 36. + 1);
197 ''(9*36.^3 + 9*36.^2 + 9*36. + 9);
202 [symbolp (xyz), numberp (xyz)];
205 [symbolp (0xyz), numberp (0xyz)];
209 ''(33.*36.^2 + 34.*36. + 35.);
214 [symbolp (\0xyz), numberp (\0xyz)];
217 [is (xyz = 0xyz), is (0xyz = \0xyz), is (\0xyz = xyz)];
218 [false, false, false];
221 ''(33.*36.^2 + 34.*36. + 35.);
226 xyz + 0xyz + \0xyz + xyz + 0xyz + \0xyz + xyz + 0xyz + \0xyz;
227 3*xyz + 3*\0xyz + ''(3*(33.*36.^2 + 34.*36. + 35.));
229 [10.25, 10.25d0, 10.25e0, 10.25f0, 10.25s0] - 0a - 1/4;
230 ''(float ([0, 0, 0, 0, 0]));
232 [99.25, 99.25d0, 99.25e0, 99.25f0, 99.25s0] - 02r - 1/4;
233 ''(float ([0, 0, 0, 0, 0]));
242 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
271 (string (255), is (%% = "0FF" or %% = "0ff"));
274 (string (-255), is (%% = "-0FF" or %% = "-0ff"));
280 (string (10 * 16^3), is (%% = "0A000" or %% = "0a000"));
283 (string (10*16^3 + 11*16^2 + 12*16 + 13), is (%% = "0ABCD" or %% = "0abcd"));
289 string (8*36^3 + 8*36^2 + 8*36 + 8);
292 (string (8*36^3 + 9*36^2 + 10*36 + 11), is (%% = "89AB" or %% = "89ab"));
295 (string (35*36^3 + 35*36^2 + 35*36 + 35), is (%% = "0ZZZZ" or %% = "0zzzz"));
298 (string (-(35*36^3 + 35*36^2 + 35*36 + 35)), is (%% = "-0ZZZZ" or %% = "-0zzzz"));
301 (string (34*36^3 + 35*36^2 + 8*36 + 7), is (%% = "0YZ87" or %% = "0yz87"));
304 [ibase, obase] : [10., 10.];
308 ''(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1);
319 (load (file_search (test_readbase_lisp, file_search_tests)),
320 test_readbase_lisp ());
321 [1., 2., 3., 4., 10., 20., 30., 40.];
326 (?autof (test_readbase_lisp_autoload, file_search (test_readbase_lisp_autoload, file_search_tests)),
327 test_readbase_lisp_autoload ());
328 [2., 3., 5., 7., 11., 13., 17., 19.];
333 (load (file_search (test_readbase_maxima, file_search_tests)),
334 test_readbase_maxima ());
335 [4., 3., 2., 1., 40., 30., 20., 10.];
340 (batch (file_search (test_readbase_maxima, file_search_tests)),
341 test_readbase_maxima ());
342 [4., 3., 2., 1., 40., 30., 20., 10.];
347 (auto_mexpr (test_readbase_maxima_autoload, file_search (test_readbase_maxima_autoload, file_search_tests)),
348 test_readbase_maxima_autoload ());
349 [19., 17., 13., 11., 7., 5., 3., 2.];
357 /* SF bug report # 2992398 "sort doesn't give error for invalid comparison"
360 errcatch (sort([c, a, b], "<"));
363 errcatch (sort([1, 2, 3], lambda([a, b], 'sdf)));
369 sort ([1, 2, 3], "<");
372 sort ([1, 2, 3], lambda ([a, b], sin(a) < sin(b)));
375 /* some tests for todd_coxeter; dunno where else to put them
376 * adapted from comments in src/todd-coxeter.lisp
379 /* this one seems to run indefinitely or at least a very long time */
381 todd_coxeter([x^^3,y.x.y^^-1 . x^^-1],[]);
385 todd_coxeter([a^^8,b^^7,a.b.a.b,(a^^-1 . b)^^3],[a^^2, a^^-1 . b]);
389 p(i,j) :=concat(x,i).concat(x,j),
390 symet(n):=create_list(if (j - i) = 1 then (p(i,j))^^3 else
391 if (not i = j) then (p(i,j))^^2 else p(i,i) , j,1,n-1,i,1,j),
395 /* comment says todd_coxeter(symet(n)) == n! */
397 todd_coxeter (symet (1));
400 todd_coxeter (symet (2));
403 todd_coxeter (symet (3));
406 todd_coxeter (symet (4));
409 todd_coxeter (symet (5));
412 /* SF bug #2695: 'kill' kills built-in properties of operator after user-defined property */
414 (kill (a, b), string (a*b));
417 (put ("*", 'bar, 'foo), kill (all), string (a*b));
420 /* reported to mailing list 2015-01-05: "order of operands is changed due to source information" */
422 block([simp:false], ?cons(?list('?mplus,'?foo, '?bar),?cdr(1+5+3)), string(%%));