Artifact 6fcc00e27f742ee6af23a4499f48d293936ee6340cc5d72d8789ffaa072d590d:
- Executable file
r37/doc/manual/oper2.tex
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 9629) [annotate] [blame] [check-ins using] [more...]
- Executable file
r38/doc/manual/oper2.tex
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 9629) [annotate] [blame] [check-ins using]
- Executable file
r38/lisp/csl/r38.doc/oper2.tex
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 9629) [annotate] [blame] [check-ins using]
\section{Even and Odd Operators}\index{Even operator}\index{Odd operator} An operator can be declared to be {\em even\/} or {\em odd\/} in its first argument by the declarations {\tt EVEN}\ttindex{EVEN} and {\tt ODD}\ttindex{ODD} respectively. Expressions involving an operator declared in this manner are transformed if the first argument contains a minus sign. Any other arguments are not affected. In addition, if say {\tt F} is declared odd, then {\tt f(0)} is replaced by zero unless {\tt F} is also declared {\em non zero\/} by the declaration {\tt NONZERO}\ttindex{NONZERO}. For example, the declarations \begin{verbatim} even f1; odd f2; \end{verbatim} mean that \begin{verbatim} f1(-a) -> F1(A) f2(-a) -> -F2(A) f1(-a,-b) -> F1(A,-B) f2(0) -> 0. \end{verbatim} To inhibit the last transformation, say {\tt nonzero f2;}. \section{Linear Operators}\index{Linear operator} An operator can be declared to be linear in its first argument over powers of its second argument. If an operator {\tt F} is so declared, {\tt F} of any sum is broken up into sums of {\tt F}s, and any factors that are not powers of the variable are taken outside. This means that {\tt F} must have (at least) two arguments. In addition, the second argument must be an identifier (or more generally a kernel), not an expression. {\it Example:} If {\tt F} were declared linear, then \begin{verbatim} 5 f(a*x^5+b*x+c,x) -> F(X ,X)*A + F(X,X)*B + F(1,X)*C \end{verbatim} More precisely, not only will the variable and its powers remain within the scope of the {\tt F} operator, but so will any variable and its powers that had been declared to {\tt DEPEND} on the prescribed variable; and so would any expression that contains that variable or a dependent variable on any level, e.g. {\tt cos(sin(x))}. To declare operators {\tt F} and {\tt G} to be linear operators, use:\ttindex{LINEAR} \begin{verbatim} linear f,g; \end{verbatim} The analysis is done of the first argument with respect to the second; any other arguments are ignored. It uses the following rules of evaluation: \begin{quote} \begin{tabbing} {\tt f(0) -> 0} \\ {\tt f(-y,x) -> -F(Y,X)} \\ {\tt f(y+z,x) -> F(Y,X)+F(Z,X)} \\ {\tt f(y*z,x) -> Z*F(Y,X)} \hspace{0.5in}\= if Z does not depend on X \\ {\tt f(y/z,x) -> F(Y,X)/Z} \> if Z does not depend on X \end{tabbing} \end{quote} To summarize, {\tt Y} ``depends'' on the indeterminate {\tt X} in the above if either of the following hold: \begin{enumerate} \item {\tt Y} is an expression that contains {\tt X} at any level as a variable, e.g.: {\tt cos(sin(x))} \item Any variable in the expression {\tt Y} has been declared dependent on {\tt X} by use of the declaration {\tt DEPEND}. \end{enumerate} The use of such linear operators\index{Linear operator} can be seen in the paper Fox, J.A. and A. C. Hearn, ``Analytic Computation of Some Integrals in Fourth Order Quantum Electrodynamics'' Journ. Comp. Phys. 14 (1974) 301-317, which contains a complete listing of a program for definite integration\index{Integration} of some expressions that arise in fourth order quantum electrodynamics. \section{Non-Commuting Operators}\index{Non-commuting operator} An operator can be declared to be non-commutative under multiplication by the declaration {\tt NONCOM}.\ttindex{NONCOM} {\it Example:} After the declaration \\ {\tt noncom u,v;}\\ the expressions {\tt u(x)*u(y)-u(y)*u(x)} and {\tt u(x)*v(y)-v(y)*u(x)} will remain unchanged on simplification, and in particular will not simplify to zero. Note that it is the operator ({\tt U} and {\tt V} in the above example) and not the variable that has the non-commutative property. The {\tt LET}\ttindex{LET} statement may be used to introduce rules of evaluation for such operators. In particular, the boolean operator {\tt ORDP}\ttindex{ORDP} is useful for introducing an ordering on such expressions. {\it Example:} The rule \begin{verbatim} for all x,y such that x neq y and ordp(x,y) let u(x)*u(y)= u(y)*u(x)+comm(x,y); \end{verbatim} would introduce the commutator of {\tt u(x)} and {\tt u(y)} for all {\tt X} and {\tt Y}. Note that since {\tt ordp(x,x)} is {\em true}, the equality check is necessary in the degenerate case to avoid a circular loop in the rule. \section{Symmetric and Antisymmetric Operators} An operator can be declared to be symmetric with respect to its arguments by the declaration {\tt SYMMETRIC}.\ttindex{SYMMETRIC} For example \begin{verbatim} symmetric u,v; \end{verbatim} means that any expression involving the top level operators {\tt U} or {\tt V} will have its arguments reordered to conform to the internal order used by {\REDUCE}. The user can change this order for kernels by the command {\tt KORDER}. For example, {\tt u(x,v(1,2))} would become {\tt u(v(2,1),x)}, since numbers are ordered in decreasing order, and expressions are ordered in decreasing order of complexity. Similarly the declaration {\tt ANTISYMMETRIC}\ttindex{ANTISYMMETRIC} declares an operator antisymmetric. For example, \begin{verbatim} antisymmetric l,m; \end{verbatim} means that any expression involving the top level operators {\tt L} or {\tt M} will have its arguments reordered to conform to the internal order of the system, and the sign of the expression changed if there are an odd number of argument interchanges necessary to bring about the new order. For example, {\tt l(x,m(1,2))} would become {\tt -l(-m(2,1),x)} since one interchange occurs with each operator. An expression like {\tt l(x,x)} would also be replaced by 0. \section{Declaring New Prefix Operators} The user may add new prefix\index{Prefix} operators to the system by using the declaration {\tt OPERATOR}. For example: \begin{verbatim} operator h,g1,arctan; \end{verbatim} adds the prefix operators {\tt H}, {\tt G1} and {\tt ARCTAN} to the system. This allows symbols like {\tt h(w), h(x,y,z), g1(p+q), arctan(u/v)} to be used in expressions, but no meaning or properties of the operator are implied. The same operator symbol can be used equally well as a 0-, 1-, 2-, 3-, etc.-place operator. To give a meaning to an operator symbol, or express some of its properties, {\tt LET}\ttindex{LET} statements can be used, or the operator can be given a definition as a procedure. If the user forgets to declare an identifier as an operator, the system will prompt the user to do so in interactive mode, or do it automatically in non-interactive mode. A diagnostic message will also be printed if an identifier is declared {\tt OPERATOR} more than once. Operators once declared are global in scope, and so can then be referenced anywhere in the program. In other words, a declaration within a block (or a procedure) does not limit the scope of the operator to that block, nor does the operator go away on exiting the block (use {\tt CLEAR} instead for this purpose). \section{Declaring New Infix Operators} Users can add new infix operators by using the declarations {\tt INFIX}\ttindex{INFIX} and {\tt PRECEDENCE}.\ttindex{PRECEDENCE} For example, \begin{verbatim} infix mm; precedence mm,-; \end{verbatim} The declaration {\tt infix mm;} would allow one to use the symbol {\tt MM} as an infix operator: \begin{quote} \hspace{0.2in} {\tt a mm b} \hspace{0.3in} instead of \hspace{0.3in} {\tt mm(a,b)}. \end{quote} The declaration {\tt precedence mm,-;} says that {\tt MM} should be inserted into the infix operator precedence list just {\em after\/} the $-$ operator. This gives it higher precedence than $-$ and lower precedence than * . Thus \begin{quote} \hspace{0.2in}{\tt a - b mm c - d}\hspace{.3in} means \hspace{.3in} {\tt a - (b mm c) - d}, \end{quote} while \begin{quote} \hspace{0.2in}{\tt a * b mm c * d}\hspace{.3in} means \hspace{.3in} {\tt (a * b) mm (c * d)}. \end{quote} Both infix and prefix\index{Prefix} operators have no transformation properties unless {\tt LET}\ttindex{LET} statements or procedure declarations are used to assign a meaning. We should note here that infix operators so defined are always binary: \begin{quote} \hspace{0.2in}{\tt a mm b mm c}\hspace{.3in} means \hspace{.3in} {\tt (a mm b) mm c}. \end{quote} \section{Creating/Removing Variable Dependency} There are several facilities in {\REDUCE}, such as the differentiation \index{Differentiation} operator and the linear operator\index{Linear operator} facility, that can utilize knowledge of the dependency between various variables, or kernels. Such dependency may be expressed by the command {\tt DEPEND}.\ttindex{DEPEND} This takes an arbitrary number of arguments and sets up a dependency of the first argument on the remaining arguments. For example, \begin{verbatim} depend x,y,z; \end{verbatim} says that {\tt X} is dependent on both {\tt Y} and {\tt Z}. \begin{verbatim} depend z,cos(x),y; \end{verbatim} says that {\tt Z} is dependent on {\tt COS(X)} and {\tt Y}. Dependencies introduced by {\tt DEPEND} can be removed by {\tt NODEPEND}. \ttindex{NODEPEND} The arguments of this are the same as for {\tt DEPEND}. For example, given the above dependencies, \begin{verbatim} nodepend z,cos(x); \end{verbatim} says that {\tt Z} is no longer dependent on {\tt COS(X)}, although it remains dependent on {\tt Y}.