-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtest_great.mac
93 lines (70 loc) · 2.13 KB
/
rtest_great.mac
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
/* Some tests taken from #4383 great not transitive (so simplifya not idempotent) */
(kill(all), 0);
0$
(L : [2/3, -1/8,%i, %pi, inf, und, minf, a,b,-a,-b, a[1], z[a], rat(x), rat(a+b), exp(x),exp(-x),1/a,1/b,-1/a, -1/b,a/b, %pi,
x^2, x^%pi, %pi^x, 2^(2/3),sqrt(exp(z)),exp(z),cos(x),tan(x),sin(x), diff(x),
a+b,c/d, cos(z), box(a,42), box(-a,42),true, false, a*b, a+b+c,a=b, a>b,f(a,b,a),
'diff(f,x), 'integrate(g(x),x), [],[false], [[]],a.b, a^^7, b^^z],0);
0$
(F(L) := block([a,b,c,p1,p2,p3,p4,p5,p6,ok,fail : []],
for a in L do (
for b in L do (
for c in L do (
p1 : sort([a,b,c]),
p2 : sort([c,a,b]),
p3 : sort([b,c,a]),
p4 : sort([b,a,c]),
p5 : sort([c,b,a]),
p6 : sort([a,c,b]),
ok : is(p1=p2) and is(p2=p3) and is(p3=p4) and is(p5=p6),
if not ok then push([a,b,c], fail)))),
length(fail)),0);
0$
F(L);
0$
F(append(L, map('exp,L)));
0$
(domain : complex, declare(z,complex),0);
0$
(L : [2/3, -1/8,%i, %pi, inf, und, minf, a,b,-a,-b, a[1], z[a], rat(x), rat(a+b), exp(x),exp(-x),1/a,1/b,-1/a, -1/b,a/b, %pi,
x^2, x^%pi, %pi^x, 2^(2/3),sqrt(exp(z)),exp(z),cos(x),tan(x),sin(x), diff(x),
a+b,c/d, cos(z), box(a,42), box(-a,42),true, false, a*b, a+b+c,a=b, a>b,f(a,b,a),
'diff(f,x), 'integrate(g(x),x), [],[false], [[]],a.b, a^^7, b^^z],0);
0$
F(L);
0$
F(append(L, map('exp,L)));
0$
F(append(L, map('log,L)));
0$
F(append(L, map('log, map('log,L))));
0$
F(append(L, map(lambda([q],-1/q^%pi),L)));
0$
/* #4383 great not transitive (so simplifya not idempotent) */
exp(z) + sqrt(exp(z)) + exp(z);
2*exp(z) + sqrt(exp(z))$
is(orderlessp(exp(z),sqrt(exp(z))) # orderlessp(sqrt(exp(z)),exp(z)));
true$
is((a^(b*d))^f(c)/(b*f(c)) = expand((a^(b*d))^f(c)/(b*f(c)),0,0));
true$
(bad: '[
[f(b),a^(b*c),b],
[a^(b*c),b,f(b)],
[b,f(b),a^(b*c)]
],0);
0$
block([ok : true],
for i in bad do (
ok : ok and sort(i) = sort(reverse(i))),
ok);
true$
/* Did we make a mess? Let's clean it up!*/
(remvalue(L),remfun(F),remvalue(bad),0);
0$
values;
[]$
(reset(domain), forget(z,'complex),0);
0$
contexts;
[initial, global]$