1 /* Original version of this file copyright 1999 by Michael Wester,
2 * and retrieved from http://www.math.unm.edu/~wester/demos/MathvsCS/match.macsyma
5 * Released under the terms of the GNU General Public License, version 2,
6 * per message dated 2007-06-03 from Michael Wester to Robert Dodier
7 * (contained in the file wester-gpl-permission-message.txt).
9 * See: "A Critique of the Mathematical Abilities of CA Systems"
10 * by Michael Wester, pp 25--60 in
11 * "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
12 * and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
14 /* ----------[ M a c s y m a ]---------- */
15 /* ---------- Initialization ---------- */
18 /* ---------- Mathematics vs Computer Science ---------- */
19 /* Just how well are pattern matches between mathematically equivalent forms
21 matchdeclare(x, true)$
22 defmatch(match, exp(x), x)$
25 defmatch(match, %e^x, x)$
28 defmatch(match, sqrt(x), x)$
31 defmatch(match, x^(1/2), x)$
34 defmatch(match, %i*x, x)$
37 match((-1)^(1/2)*y, y);
38 defmatch(match, sqrt(-1)*x, x)$
41 match((-1)^(1/2)*y, y);
42 defmatch(match, (-1)^(1/2)*x, x)$
45 match((-1)^(1/2)*y, y);