-
Notifications
You must be signed in to change notification settings - Fork 15
/
newcomparison_test.sj
186 lines (146 loc) · 3.5 KB
/
newcomparison_test.sj
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
ClearAll(a,b,c,d,x)
T 1 == 1
T !(1 != 1)
T !(1 > 1)
T !(1 < 1)
T 1 >= 1
T 1 <= 1
T 1 == 1.0
T 1 < 2
T 2 > 1
T !( 1 > 2)
T !( 2 < 1)
T !( 2 == 1)
T 2 != 1
T 2 >= 1
T 1 <= 2
T !( 1 >= 2 )
T !( 2 <= 1 )
T 1 < 2 < 3
T 3 > 2 > 1
T !( 3 < 2 < 1)
T 1 < 2 < 3 < 4
T 1 < 2.0 < 3 < 4.0
T (1 < 2 < b) == (2 < b)
T ((1 < 2 < b < c == c < 4 < 10)) == ((2 < b) && (b < c) && (c < 4))
# FIXME: do we want this ?
# T ( (a < c/d) != True )
ClearAll(b,c)
# 1 < x < 1 --> 1 < x && x < 1). FIXME. this should return false.
# This, at least, works.
T Apply(List, 1 < 2 < b < c == c < 4 < 10) == [2 < b,b < c,c < 4]
# Agrees with Mma
T (1 < x > 1) == ( 1 < x && (x > 1) )
## FIXME: for older method
# T Apply(List, b>2) == [b,>,2]
# T Apply(List, 2>b) == [2,>,b]
# T Apply(List, a < b) == List(a, < , b)
# T Apply(List, a <= b) == List(a, <= , b)
# T Apply(List, a >= b) == List(a, >= , b)
# T Apply(List, a < 1) == List(a, < , 1)
# T Apply(List, a == 1) == List(a, == , 1)
# T Apply(List, f(a) < 1) == List(f(a), < , 1)
# T Apply(List, f(a) < 1.0) == List(f(a), < , 1.0)
T (a == a ) == True
T (a != a) == False
## FIXME: reinstate this ?
# T (a <= a) == True
# T (a >= a) == True
T (a < 1) == (a < 1)
## FIXME: reimplement this. we used maybe_N
# T Sqrt(2) > 0
# T -Sqrt(2) < 0
# T 3 < Pi < 4
# T 2 < E < 3
# T 0 < EulerGamma < 1
#### Infinity
## FIXME: reimpement this.
# T 1 != Infinity
# T Not(1 == Infinity)
# T 1.0 != Infinity
# T Not(1.0 == Infinity)
#### Not
T Not(a != a) == True
T Not(a == a) == False
## Mma evaluates this to true with FullSimplify but not Simplify
## FullSimplify(b >= b)
T Head(b >= b) == GreaterEqual
T Head(b <= b) == LessEqual
T Head(b < b) == Less
T Head(b > b) == Greater
T b == b
T Not(b != b)
## Mma does evaluates these immediately
T Not(a < b) == (a >= b)
T Not(a >= b) == (a < b)
T Not(a > b) == (a <= b)
T Not(a <= b) == (a > b)
T Not(a == b) == (a != b)
T Not(a != b) == (a == b)
## This is not distributed automatically
T Head(Not( (a == b) && ( c == d))) == Not
T Head(Not(3)) == Not
#### Or
T Or() == False
T Or(1) == 1
T Or(True) == True
T Or(True,False) == True
T Or(False,False) == False
T Or(True,True) == True
T Or(False,True) == True
T Or(True,False,False) == True
# Test flatten with Or
T Args(a || b || c || d ) == [a,b,c,d]
#### And
T And() == True
T And(1) == 1
T And(True) == True
T And(False,True) == False
T And(True,False) == False
T And(True,True) == True
T And(False,False) == False
T And(True,True,True) == True
# Test flatten with And
T Args(a && b && c && d ) == [a,b,c,d]
ClearAll(a,b,c,d,f,x)
#### Refine
# This belongs elsewhere
ClearAll(aaa)
Assume(aaa,Positive)
T Refine(Abs(aaa)) == aaa
ClearAll(aaa,a)
### String
T Head(f(x) == "cat") == Equal
### SameQ
T SameQ(a,a)
T Not(SameQ(a,b))
T Not(SameQ(3,3.0))
T SameQ(3,3)
T SameQ("cat", "cat")
### Equal
T Equal() == True
T Equal(3,3)
T Equal(3,3.0)
T Head(Equal(x,y)) == Equal
T Equal(x,x)
#T Equal(2,bf"2") # probably want to get rid of bf and bi
T Equal(2,big"2")
#T Equal(2.0,bf"2")
T Equal(2.0,big"2")
T Not(Unequal(3,3))
T Not(Unequal(3,3.0))
T Not(Unequal(y,y))
T Head(Unequal(x,y)) == Unequal
T (Undefined == 3) === Undefined
T (3 == Undefined) === Undefined
T (Undefined == a) === Undefined
T (a == Undefined) === Undefined
T (a + b == Undefined) === Undefined
T ( Undefined == a + b) === Undefined
T (Undefined != 3) === Undefined
T (3 != Undefined) === Undefined
T (Undefined != a) === Undefined
T (a != Undefined) === Undefined
T (a + b != Undefined) === Undefined
ClearAll(f,x)
Apply(ClearAll,UserSyms())