1 The functions LINSIMP and DECLARE_LINEAR_OPERATOR provide
2 the user with the capability of simplifying expressions that contain
3 operators that are linear in one or more arguments. It is possible
4 to accomplish something quite similar using the standard MACSYMA
5 function DECLARE, but there is no simple way to extend this to operators
6 that have more than one argument. The example below illustrates the
7 capabilities that are built into MACSYMA:
9 (C1) DECLARE(F,LINEAR);
21 (C5) DECLARE(B,CONSTANT);
28 Notice that constant factors are extracted from the argument of F. This
29 will often be what is needed, but not always. Operators that have more
30 than one argument are treated differently. A complete description is given
31 in MACDOC;UPDATE >, in a note describing new features of MACSYMA #261.
33 LINSIMP and DECLARE_LINEAR_OPERATOR fill these minor gaps in
34 MACSYMA's understanding of linear operators. DECLARE_LINEAR_OPERATOR is
35 used to set up the information necessary for appropriate simplifications
36 to be carried out, and LINSIMP is used to execute those simplifications.
37 The desired simplification rules are not applied automatically, which is
38 a disadvantage of this method relative to MACSYMA's built in capability.
39 To obtain automatic simplification, one might use DECLIN in conjunction
40 with TELLSIMP or TELLSIMPAFTER.
42 LINSIMP(exp, operator1, operator2, ... ) simplifies exp with respect to
43 the linearity properties of operator1, then operator2, and so on.
44 Any terms belonging to the same sum that can be combined together
45 under the same operator are combined, and any factors that can be
46 extracted from any of these operators are extracted. If any of the
47 operators in the argument list of LINSIMP have not been declared
48 linear using the function DECLARE_LINEAR_OPERATOR, an error will re-
51 DECLARE_LINEAR_OPERATOR(operator, linear-arguments, separation-predicate)
52 sets up the linearity property of "operator", which must be an atomic
53 symbol. The second argument of DECLARE_LINEAR_OPERATOR, linear-arguments,
54 is a list of one or more elements the entries of which denote the spe-
55 cific arguments of "operator" that participate in the linearity property.
56 "operator" is considered to be a linear function of these specific argu-
57 ments, taken together. For example, let F be linear in its first three
60 F(2*A, 2*B, 2*C, D, E) = 2*F(A, B, C, D, E)
62 The third argument of DECLARE_LINEAR_OPERATOR is the separation predicate.
63 It must be a function of one argument which returns TRUE if its argument
64 is not meant to be extracted from "operator", and FALSE if its argument
65 is meant to be extracted. Thus, for example, the built in separation
66 predicate used by MACSYMA for this purpose could be defined as
68 NOT_CONSTANTP(EXP):=NOT CONSTANTP(EXP)$
70 With such a definition, the declaration necessary to mimic MACSYMA's
71 built-in capability would be, for the function H of one argument,
73 DECLARE_LINEAR_OPERATOR(H, [1], NOT_CONSTANTP)$
75 Subsequent use of LINSIMP would then produce forms similar to those pro-
76 duced by MACSYMA if H had been DECLAREd LINEAR.