1 @c -----------------------------------------------------------------------------
2 @c File : opsubst.de.texi
3 @c License : GNU General Public License (GPL)
5 @c Original : obsubst.texi revision 28.11.2007
7 @c Revision : 20.08.2011
9 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
10 @c -----------------------------------------------------------------------------
13 * Functions and Variables for opsubst::
16 @c -----------------------------------------------------------------------------
17 @node Functions and Variables for opsubst, , opsubst, opsubst
18 @section Functions and Variables for opsubst
19 @c -----------------------------------------------------------------------------
21 @c -----------------------------------------------------------------------------
22 @anchor{function_opsubst}
23 @deffn {Function} opsubst (@var{f}, @var{g}, @var{e})
24 @deffnx {Function} opsubst (@var{g} = @var{f}, @var{e})
25 @deffnx {Function} opsubst ([@var{g1} = @var{f1}, @var{g2} = @var{f2}, @dots{}, @var{gn} = @var{fn}], @var{e})
27 The function @code{opsubst} is similar to the function @code{subst}, except that
28 @code{opsubst} only makes substitutions for the operators in an expression. In
29 general, when @var{f} is an operator in the expression @var{e}, substitute
30 @var{g} for @var{f} in the expression @var{e}.
32 To determine the operator, @code{opsubst} sets @code{inflag} to true. This
33 means @code{opsubst} substitutes for the internal, not the displayed, operator
36 To use this function write first @code{load("opsubst")}.
41 (%i1) load("opsubst")$
43 (%i2) opsubst(f, g, g(g(x)));
45 (%i3) opsubst(f, g, g(g));
47 (%i4) opsubst(f, g[x], g[x](z));
49 (%i5) opsubst(g[x], f, f(z));
52 (%i6) opsubst(tan, sin, sin(sin));
54 (%i7) opsubst([f=g, g=h], f(x));
58 Internally, Maxima does not use the unary negation, division, or the subtraction
62 (%i8) opsubst("+", "-", a-b);
64 (%i9) opsubst("f", "-", -a);
66 (%i10) opsubst("^^", "/", a/b);
72 The internal representation of @code{-a*b} is @code{*(-1,a,b)}; thus
75 (%i11) opsubst("[", "*", -a*b);
79 When either operator isn't a Maxima symbol, generally some other function
83 (%i12) opsubst(a+b, f, f(x));
85 Improper name or value in functional position:
87 -- an error. Quitting. To debug this try debugmode(true);
90 However, subscripted operators are allowed:
93 (%i13) opsubst(g[5], f, f(x));
99 @c --- End of file opsubst.de.texi ---------------------------------------------