1	The functions LINSIMP and DECLARE_LINEAR_OPERATOR provide
2the user with the capability of simplifying expressions that contain
3operators that are linear in one or more arguments.  It is possible
4to accomplish something quite similar using the standard MACSYMA
5function DECLARE, but there is no simple way to extend this to operators
6that have more than one argument.  The example below illustrates the
7capabilities that are built into MACSYMA:
8
9(C1) DECLARE(F,LINEAR);
10(D1) 				     DONE
11
12(C2) F(2*A);
13(D2) 				    2 F(A)
14
15(C3) F(2);
16(D3) 				    2 F(1)
17
18(C4) F(A*B);
19(D4) 				    F(A B)
20
21(C5) DECLARE(B,CONSTANT);
22(D5) 				     DONE
23
24(C6) F(A*B);
25(D6) 				    B F(A)
26
27
28Notice that constant factors are extracted from the argument of F.  This
29will often be what is needed, but not always.  Operators that have more
30than one argument are treated differently.  A complete description is given
31in MACDOC;UPDATE >, in a note describing new features of MACSYMA #261.
32
33	LINSIMP and DECLARE_LINEAR_OPERATOR fill these minor gaps in
34MACSYMA's understanding of linear operators.  DECLARE_LINEAR_OPERATOR is
35used to set up the information necessary for appropriate simplifications
36to be carried out, and LINSIMP is used to execute those simplifications.
37The desired simplification rules are not applied automatically, which is
38a disadvantage of this method relative to MACSYMA's built in capability.
39To obtain automatic simplification, one might use DECLIN in conjunction
40with TELLSIMP or TELLSIMPAFTER.
41
42LINSIMP(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-
49    sult.
50
51DECLARE_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
58    arguments.  Then:
59
60		F(2*A, 2*B, 2*C, D, E)  =  2*F(A, B, C, D, E)
61
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
67
68		NOT_CONSTANTP(EXP):=NOT CONSTANTP(EXP)$
69
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,
72
73		DECLARE_LINEAR_OPERATOR(H, [1], NOT_CONSTANTP)$
74
75    Subsequent use of LINSIMP would then produce forms similar to those pro-
76    duced by MACSYMA if H had been DECLAREd LINEAR.
77