1 /* Original version of this file copyright 1999 by Michael Wester,
2 * and retrieved from http://www.math.unm.edu/~wester/demos/Operators/problems.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 /* ---------- Operators ---------- */
22 /* (f + 2 g)(y) => e^y + 2 y^2 */
24 /* (f o g)(y) => e^(y^2) */
27 /* Linear differential operator */
28 L: (diffop(x) - 1) . (diffop(x) + 2);
29 /* => f'' + f' - 2 f */
32 remove(f, dependency)$
33 /* => g''(y) + g'(y) - 2 g(y) */
34 subst(x = y, L)(g(y));
35 /* => 2 A [(1 + z) cos(z^2) - (1 + 2 z^2) sin(z^2)] */
36 subst(x = z, L)(A * sin(z^2));
37 /* Truncated Taylor series operator */
39 sum(subst(x = a, (diffop(x)^^k)(f(x)))/k! * (x - a)^k, k, 0, 2));
40 /* => f(a) + f'(a) (x - a) + f''(a) (x - a)^2/2 */
42 /* => g(b) + g'(b) (y - b) + g''(b) (y - b)^2/2 */
44 /* => sin(c) + cos(c) (z - c) - sin(c) (z - c)^2/2 */
47 /* Define the binary infix operator ~ so that x ~ y => sqrt(x^2 + y^2) */
49 "~"(x, y):= sqrt(x^2 + y^2)$
51 /* Make it associative: 3 ~ 4 ~ 12 => 13 */
53 /* Define the matchfix pair of operators | and | so that | x | => abs(x) */