1 | test_pattern = ->
|
2 | run_test [
|
3 |
|
4 | "pattern(dot(transpose(a_),a_), cov(a_))",
|
5 | "dot(transpose(a_),a_)->cov(a_)",
|
6 |
|
7 | "pattern(dot(a_,transpose(a_)), cov(a_))",
|
8 | "dot(a_,transpose(a_))->cov(a_)",
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | "simplify(1 + eig(dot(transpose(A+B),B+transpose(transpose(A)))))",
|
14 | "1+eig(cov(A+B))",
|
15 |
|
16 | "simplify(1 + eig(dot(x*transpose(transpose(A)), transpose(x*A))))",
|
17 | "1+eig(cov(transpose(A)*transpose(x)))",
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | "simplify(1 + eig(dot(x*transpose(transpose(A)), transpose(A*x))))",
|
23 | "1+eig(cov(transpose(A)*transpose(x)))",
|
24 |
|
25 | "simplify(1 + eig(dot(x*Aᵀᵀ, (A*x)ᵀ)))",
|
26 | "1+eig(cov(transpose(A)*transpose(x)))",
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | "clearpatterns()",
|
32 | "",
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | "simplify(integral(1/(X-A)/sqrt(X^2-A^2),X)+sqrt(X^2-A^2)/A/(X-A))",
|
39 | "0",
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | "pattern(dot(transpose(a_),a_), cov(a_))",
|
46 | "dot(transpose(a_),a_)->cov(a_)",
|
47 |
|
48 | "simplify(integral(1/(X-A)/sqrt(X^2-A^2),X)+sqrt(X^2-A^2)/A/(X-A))",
|
49 | "0",
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | "simplify(eig(dot(transpose(A+B),B+transpose(transpose(A)))))",
|
56 | "eig(cov(A+B))",
|
57 |
|
58 | "simplify(eig(dot(x*transpose(transpose(A)), transpose(A*x))))",
|
59 | "eig(cov(transpose(A)*transpose(x)))",
|
60 |
|
61 | "simplify(eig(dot(x*transpose(transpose(A)), transpose(x*A))))",
|
62 | "eig(cov(transpose(A)*transpose(x)))",
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | "pattern(dot(a_,transpose(a_)), cov(a_))",
|
69 | "dot(a_,transpose(a_))->cov(a_)",
|
70 |
|
71 | "simplify(eig(dot(transpose(A+B),B+transpose(transpose(A)))))",
|
72 | "eig(cov(A+B))",
|
73 |
|
74 | "simplify(eig(dot(x*transpose(transpose(A)), transpose(x*A))))",
|
75 | "eig(cov(transpose(A)*transpose(x)))",
|
76 |
|
77 | "simplify(eig(dot(x*transpose(transpose(A)), transpose(A*x))))",
|
78 | "eig(cov(transpose(A)*transpose(x)))",
|
79 |
|
80 | "clearpatterns()",
|
81 | "",
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | "simplify(eig(dot(transpose(A+B),B+transpose(transpose(A)))))",
|
89 | "eig(inner(transpose(A),A)+inner(transpose(A),B)+inner(transpose(B),A)+inner(transpose(B),B))",
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | "pattern(dot(transpose(a_),a_), cov(a_), not(number(a_)))",
|
96 | "dot(transpose(a_),a_)->cov(a_)",
|
97 |
|
98 | "pattern(dot(transpose(a_),a_), cov(a_), number(a_),a_>0 )",
|
99 | "dot(transpose(a_),a_)->cov(a_)",
|
100 |
|
101 | "simplify(eig(dot(transpose(3),transpose(transpose(3)))))",
|
102 | "eig(9)",
|
103 |
|
104 | "simplify(eig(dot(transpose(-3),transpose(transpose(-3)))))",
|
105 | "eig(9)",
|
106 |
|
107 | "simplify(eig(dot(transpose(-x),transpose(transpose(-x)))))",
|
108 | "eig(cov(-x))",
|
109 |
|
110 | "clearpatterns()",
|
111 | "",
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | "pattern(something(a_,b_),b_*somethingElse(a_))",
|
119 | "something(a_,b_)->b_*somethingElse(a_)",
|
120 |
|
121 | "simplify(something(x,y))",
|
122 | "somethingElse(x)*y",
|
123 |
|
124 | "clearpatterns()",
|
125 | "",
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | "pattern(something(a_,b_),b_*somethingElse(a_))",
|
133 | "something(a_,b_)->b_*somethingElse(a_)",
|
134 |
|
135 | "indirection(h,k) = something(h,k)",
|
136 | "",
|
137 |
|
138 | "simplify(indirection(x,y))",
|
139 | "somethingElse(x)*y",
|
140 |
|
141 | "clearpatterns()",
|
142 | "",
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 | "pattern(dot(a_,transpose(a_)), cov(a_))",
|
149 | "dot(a_,transpose(a_))->cov(a_)",
|
150 |
|
151 | "simplify(1 + eig(dot(transpose(A)+transpose(B),B+transpose(transpose(A)))))",
|
152 | "1+eig(inner(transpose(A),A)+inner(transpose(A),B)+inner(transpose(B),A)+inner(transpose(B),B))",
|
153 |
|
154 |
|
155 | "simplify(1 + eig(dot(transpose(A)+transpose(B),B+transpose(transpose(A)))))",
|
156 | "1+eig(inner(transpose(A),A)+inner(transpose(A),B)+inner(transpose(B),A)+inner(transpose(B),B))",
|
157 |
|
158 | "clearpatterns()",
|
159 | "",
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | "pattern(dot(transpose(a_),a_), cov(a_))",
|
166 | "dot(transpose(a_),a_)->cov(a_)",
|
167 |
|
168 |
|
169 |
|
170 | "simplify(1 + eig(dot(abs(k),transpose(abs(k)))))",
|
171 | "1+eig(cov(transpose(abs(k))))",
|
172 |
|
173 |
|
174 |
|
175 | "simplify(1 + eig(dot(b(2),transpose(b(2)))))",
|
176 | "1+eig(cov(transpose(b(2))))",
|
177 |
|
178 | "clearpatterns()",
|
179 | "",
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | "pattern(a_ + b_, dot(cov(b_),cov(a_)))",
|
185 | "a_+b_->dot(cov(b_),cov(a_))",
|
186 |
|
187 | "simplify(something + somethingelse)",
|
188 | "inner(cov(somethingelse),cov(something))",
|
189 |
|
190 | "clearpatterns()",
|
191 | "",
|
192 |
|
193 |
|
194 |
|
195 | "pattern(aFunction(a_), anotherFunction(a_))",
|
196 | "aFunction(a_)->anotherFunction(a_)",
|
197 |
|
198 | "simplify(aFunction(someArg))",
|
199 | "anotherFunction(someArg)",
|
200 |
|
201 | "clearpatterns()",
|
202 | "",
|
203 |
|
204 |
|
205 |
|
206 | "pattern(aFunction(a_), anotherFunction(a_))",
|
207 | "aFunction(a_)->anotherFunction(a_)",
|
208 |
|
209 | "simplify(1 + aFunction(someArg))",
|
210 | "1+anotherFunction(someArg)",
|
211 |
|
212 | "clearpatterns()",
|
213 | "",
|
214 |
|
215 |
|
216 |
|
217 | "pattern(aFunction(a_), anotherFunction(a_))",
|
218 | "aFunction(a_)->anotherFunction(a_)",
|
219 |
|
220 | "simplify(aFunction(someArg)+aFunction(someOtherArg))",
|
221 | "anotherFunction(someArg)+anotherFunction(someOtherArg)",
|
222 |
|
223 | "clearpatterns()",
|
224 | "",
|
225 |
|
226 |
|
227 |
|
228 | "pattern(aFunction(a_), anotherFunction(a_))",
|
229 | "aFunction(a_)->anotherFunction(a_)",
|
230 |
|
231 | "simplify( a + aFunction(someArg) + b + aFunction(someOtherArg))",
|
232 | "a+b+anotherFunction(someArg)+anotherFunction(someOtherArg)",
|
233 |
|
234 | "clearpatterns()",
|
235 | "",
|
236 |
|
237 |
|
238 |
|
239 | "pattern(aFunction(a_), anotherFunction(a_))",
|
240 | "aFunction(a_)->anotherFunction(a_)",
|
241 |
|
242 | "simplify(aFunction(aFunction(someOtherArg)))",
|
243 | "anotherFunction(anotherFunction(someOtherArg))",
|
244 |
|
245 | "clearpatterns()",
|
246 | "",
|
247 |
|
248 |
|
249 |
|
250 | "pattern(aFunction(a_), anotherFunction(a_))",
|
251 | "aFunction(a_)->anotherFunction(a_)",
|
252 |
|
253 | "pattern(aFunction(a_), anotherFunctionBBBB(a_))",
|
254 | "aFunction(a_)->anotherFunctionBBBB(a_)",
|
255 |
|
256 | "simplify(aFunction(aFunction(someOtherArg)))",
|
257 | "anotherFunctionBBBB(anotherFunctionBBBB(someOtherArg))",
|
258 |
|
259 | "clearpatterns()",
|
260 | "",
|
261 |
|
262 |
|
263 |
|
264 | "pattern(aFunction(a_), anotherFunctionBBBB(a_))",
|
265 | "aFunction(a_)->anotherFunctionBBBB(a_)",
|
266 |
|
267 | "pattern(aFunction(a_), anotherFunction(a_))",
|
268 | "aFunction(a_)->anotherFunction(a_)",
|
269 |
|
270 | "simplify(aFunction(aFunction(someOtherArg)))",
|
271 | "anotherFunction(anotherFunction(someOtherArg))",
|
272 |
|
273 | "clearpatterns()",
|
274 | "",
|
275 |
|
276 |
|
277 |
|
278 | "pattern(aFunction(a_), anotherFunction(a_))",
|
279 | "aFunction(a_)->anotherFunction(a_)",
|
280 |
|
281 | "pattern(anotherFunction(a_), YETanotherFunction(a_))",
|
282 | "anotherFunction(a_)->YETanotherFunction(a_)",
|
283 |
|
284 | "simplify(aFunction(aFunction(someOtherArg)))",
|
285 | "YETanotherFunction(YETanotherFunction(someOtherArg))",
|
286 |
|
287 | "clearpatterns()",
|
288 | "",
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 | "pattern(anotherFunction(a_), YETanotherFunction(a_))",
|
295 | "anotherFunction(a_)->YETanotherFunction(a_)",
|
296 |
|
297 | "pattern(aFunction(a_), anotherFunction(a_))",
|
298 | "aFunction(a_)->anotherFunction(a_)",
|
299 |
|
300 | "simplify(aFunction(aFunction(someOtherArg)))",
|
301 | "YETanotherFunction(YETanotherFunction(someOtherArg))",
|
302 |
|
303 | "clearpatterns()",
|
304 | "",
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 | "pattern(fact(0), 1)",
|
311 | "fact(0)->1",
|
312 |
|
313 |
|
314 |
|
315 | "pattern(fact(a_), a_*fact(a_-1), not(a_ == 0))",
|
316 | "fact(a_)->a_*fact(a_-1)",
|
317 |
|
318 | "simplify(fact(3))",
|
319 | "6",
|
320 |
|
321 | "clearpatterns()",
|
322 | "",
|
323 |
|
324 |
|
325 |
|
326 | "pattern(f(a_,b_),f(b_,a_))",
|
327 | "f(a_,b_)->f(b_,a_)",
|
328 |
|
329 |
|
330 |
|
331 | "simplify(f(1,2))",
|
332 | "Stop: maximum application of single transformation rule exceeded: f(a_,b_)(f(b_,a_))",
|
333 |
|
334 | "clearpatterns()",
|
335 | "",
|
336 |
|
337 |
|
338 |
|
339 | "pattern(a_ + a_ ,42 * a_)",
|
340 | "a_+a_->42*a_",
|
341 |
|
342 | "pattern(a_ + a_ ,21 * a_)",
|
343 | "a_+a_->21*a_",
|
344 |
|
345 | "simplify(x+x)",
|
346 | "21*x",
|
347 |
|
348 | "clearpatterns()",
|
349 | "",
|
350 |
|
351 |
|
352 |
|
353 | "pattern(f(a_,b_))",
|
354 | "Stop: pattern needs at least a template and a transformed version",
|
355 |
|
356 |
|
357 |
|
358 | "pattern()",
|
359 | "Stop: pattern needs at least a template and a transformed version",
|
360 |
|
361 |
|
362 |
|
363 | "pattern(f(a_,b_), f(a_,b_))",
|
364 | "Stop: recursive pattern",
|
365 |
|
366 |
|
367 | ]
|