2 * Functions and Variables for opsubst::
5 @node Functions and Variables for opsubst, , Package opsubst, Package opsubst
6 @section Functions and Variables for opsubst
9 @deffn {Function} opsubst @
10 @fname{opsubst} (@var{f},@var{g},@var{e}) @
11 @fname{opsubst} (@var{g}=@var{f},@var{e}) @
12 @fname{opsubst} ([@var{g1}=@var{f1},@var{g2}=@var{f2},..., @var{gn}=@var{fn}],@var{e})
13 The function @code{opsubst} is similar to the function @code{subst}, except that
14 @code{opsubst} only makes substitutions for the operators in an expression. In general,
15 When @var{f} is an operator in the expression @var{e}, substitute @var{g}
16 for @var{f} in the expression @var{e}.
18 To determine the operator, @code{opsubst} sets @code{inflag} to true. This means
19 @code{opsubst} substitutes for the internal, not the displayed, operator
24 (%i1) load ("opsubst")$
26 (%i2) opsubst(f,g,g(g(x)));
28 (%i3) opsubst(f,g,g(g));
30 (%i4) opsubst(f,g[x],g[x](z));
32 (%i5) opsubst(g[x],f, f(z));
35 (%i6) opsubst(tan, sin, sin(sin));
37 (%i7) opsubst([f=g,g=h],f(x));
41 Internally, Maxima does not use the unary negation,
42 division, or the subtraction operators; thus:
44 (%i8) opsubst("+","-",a-b);
46 (%i9) opsubst("f","-",-a);
48 (%i10) opsubst("^^","/",a/b);
54 The internal representation of -a*b is *(-1,a,b); thus
56 (%i11) opsubst("[","*", -a*b);
60 When either operator isn't a Maxima symbol, generally some other function
63 (%i12) opsubst(a+b,f, f(x));
65 Improper name or value in functional position:
67 -- an error. Quitting. To debug this try debugmode(true);
70 However, subscripted operators are allowed:
72 (%i13) opsubst(g[5],f, f(x));
77 To use this function write first @code{load("opsubst")}.
79 @opencatbox{Categories:}
80 @category{Expressions}
81 @category{Share packages}
82 @category{Package opsubst}