Artifact 0a558a4dcc7e8d19f2aa96fe67f3a1273215285f6ae8a9e17aaf7827433450b8:
- Executable file
r36/help/switch.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: 58909) [annotate] [blame] [check-ins using] [more...]
\section{General Switches} \begin{Introduction}{SWITCHES} Switches are set on or off using the commands \nameref{on} or \nameref{off}, respectively. The default setting of the switches described in this section is \nameref{off} unless stated otherwise. \end{Introduction} \begin{Switch}{ALGINT} \index{integration} When the \name{algint} switch is on, the algebraic integration module (which must be loaded from the REDUCE library) is used for integration. \begin{Comments} Loading \name{algint} from the library automatically turns on the \name{algint} switch. An error message will be given if \name{algint} is turned on when the \name{algint} has not been loaded from the library. \end{Comments} \end{Switch} \begin{Switch}{ALLBRANCH} When \name{allbranch} is on, the operator \nameref{solve} selects all branches of solutions. When \name{allbranch} is off, it selects only the principal branches. Default is \name{on}. \begin{Examples} solve(log(sin(x+3)),x); & \begin{multilineoutput}{6cm} \{X=2*ARBINT(1)*PI - ASIN(1) - 3, X=2*ARBINT(1)*PI + ASIN(1) + PI - 3\} \end{multilineoutput}\\ off allbranch; \\ solve(log(sin(x+3)),x); & {X=ASIN(1) - 3} \end{Examples} \begin{Comments} \nameref{arbint}(1) indicates an arbitrary integer, which is given a unique identifier by REDUCE, showing that there are infinitely many solutions of this type. When \name{allbranch} is off, the single canonical solution is given. \end{Comments} \end{Switch} \begin{Switch}{ALLFAC} \index{output} The \name{allfac} switch, when on, causes REDUCE to factor out automatically common products in the output of expressions. Default is \name{on}. \begin{Examples} x + x*y**3 + x**2*cos(z); & X*(COS(Z)*X + Y^{3} + 1) \\ off allfac; \\ x + x*y**3 + x**2*cos(z); & COS(Z)*X^{2} + X*Y^{3} + X \end{Examples} \begin{Comments} The \name{allfac} switch has no effect when \name{pri} is off. Although the switch setting stays as it was, printing behavior is as if it were off. \end{Comments} \end{Switch} % \begin{Switch}{ALLPREC} % % \end{Switch} % % \begin{Switch}{ARBVARS} \index{solve} When \name{arbvars} is on, the solutions of singular or underdetermined systems of equations are presented in terms of arbitrary complex variables (see \nameref{arbcomplex}). Otherwise, the solution is parametrized in terms of some of the input variables. Default is \name{on}. \begin{Examples} solve({2x + y,4x + 2y},{x,y}); & \{\{x= - \rfrac{arbcomplex(1)}{2},y=arbcomplex(1)\}\} \\ solve({sqrt(x)+ y**3-1},{x,y}); & \{\{y=arbcomplex(2),x=y^6 - 2*y^3 + 1\}\} \\ off arbvars; \\ solve({2x + y,4x + 2y},{x,y}); & \{\{x= - \rfrac{y}{2}\}\} \\ solve({sqrt(x)+ y**3-1},{x,y}); & \{\{x=y^6 - 2*y^3 + 1\}\} \\ \end{Examples} \begin{Comments} With \name{arbvars} off, the return value \name{\{\{\}\}} means that the equations given to \nameref{solve} imply no relation among the input variables. \end{Comments} \end{Switch} \begin{Switch}{BALANCED\_MOD} \index{modular} \nameref{modular} numbers are normally produced in the range [0,...\meta{n}), where \meta{n} is the current modulus. With \name{balanced\_mod} on, the range [-\meta{n}/2,\meta{n}/2] is used instead. \begin{Examples} setmod 7; & 1 \\ on modular; \\ 4; & 4 \\ on balanced_mod; \\ 4; & -3 \end{Examples} \end{Switch} \begin{Switch}{BFSPACE} \index{output}\index{floating point} Floating point numbers are normally printed in a compact notation (either fixed point or in scientific notation if \nameref{SCIENTIFIC\_NOTATION} has been used). In some (but not all) cases, it helps comprehensibility if spaces are inserted in the number at regular intervals. The switch \name{bfspace}, if on, will cause a blank to be inserted in the number after every five characters. \begin{Examples} on rounded; \\ 1.2345678; & 1.2345678 \\ on bfspace; \\ 1.2345678; & 1.234 5678 \end{Examples} \begin{Comments} \name{bfspace} is normally off. \end{Comments} \end{Switch} \begin{Switch}{COMBINEEXPT} \index{exponent simplification} REDUCE is in general poor at surd simplification. However, when the switch \name{combineexpt} is on, the system attempts to combine exponentials whenever possible. \begin{TEX} \begin{Examples} 3^(1/2)*3^(1/3)*3^(1/6); & SQRT(3)*3^{\rfrac{1}{3}}*3^{\rfrac{1}{6}} \\ on combineexpt; \\ ws; & 1 \end{Examples} \end{TEX} \begin{INFO} {\begin{Examples} 3^(1/2)*3^(1/3)*3^(1/6); & SQRT(3)*3^{1/3}*3^{1/6} \\ on combineexpt; \\ ws; & 1 \end{Examples}} \end{INFO} \end{Switch} \begin{Switch}{COMBINELOGS} \index{logarithm} In many cases it is desirable to expand product arguments of logarithms, or collect a sum of logarithms into a single logarithm. Since these are inverse operations, it is not possible to provide rules for doing both at the same time and preserve the REDUCE concept of idempotent evaluation. As an alternative, REDUCE provides two switches \nameref{expandlogs} and \name{combinelogs} to carry out these operations. \begin{Examples} on expandlogs; \\ log(x*y); & LOG(X) + LOG(Y) \\ on combinelogs; \\ ws; & LOG(X*Y) \end{Examples} \begin{Comments} At the present time, it is possible to have both switches on at once, which could lead to infinite recursion. However, an expression is switched from one form to the other in this case. Users should not rely on this behavior, since it may change in the next release. \end{Comments} \end{Switch} \begin{Switch}{COMP} \index{compiler} When \name{comp} is on, any succeeding function definitions are compiled into a faster-running form. Default is \name{off}. \begin{Examples} \explanation{The following procedure finds Fibonacci numbers recursively. Create a new file ``refib" in your current directory with the following lines in it:} \\[6mm] \begin{multilineinput} procedure refib(n); if fixp n and n >= 0 then if n <= 1 then 1 else refib(n-1) + refib(n-2) else rederr "nonnegative integer only"; end; \end{multilineinput}\\ \explanation{Now load REDUCE and run the following:}\\ on time; & Time: 100 ms \\ in "refib"$ & Time: 0 ms \\ & REFIB \\ & Time: 260 ms \\ & Time: 20 ms \\ refib(80); & 37889062373143906 \\ & Time: 14840 ms \\ on comp; & Time: 80 ms \\ in "refib"$ & Time: 20 ms \\ & REFIB \\ & Time: 640 ms \\ refib(80); & 37889062373143906 \\ & Time: 10940 ms \end{Examples} \begin{Comments} Note that the compiled procedure runs faster. Your time messages will differ depending upon which system you have. Compiled functions remain so for the duration of the REDUCE session, and are then lost. They must be recompiled if wanted in another session. With the switch \nameref{time} on as shown above, the CPU time used in executing the command is returned in milliseconds. Be careful not to leave \name{comp} on unless you want it, as it makes the processing of procedures much slower. \end{Comments} \end{Switch} \begin{Switch}{COMPLEX} \index{complex} When the \name{complex} switch is on, full complex arithmetic is used in simplification, function evaluation, and factorization. Default is \name{off}. \begin{Examples} factorize(a**2 + b**2); & \{A^{2} + B^{2} \} \\ on complex; \\ factorize(a**2 + b**2); & \{A - I*B,A + I*B\} \\ (x**2 + y**2)/(x + i*y); & X - I*Y \\ on rounded; & *** Domain mode COMPLEX changed to COMPLEX\_FLOAT \\ sqrt(-17); & 4.12310562562*I \\ log(7*i); & 1.94591014906 + 1.57079632679*I \end{Examples} \begin{Comments} Complex floating-point can be done by turning on \nameref{rounded} in addition to \name{complex}. With \name{complex} off however, REDUCE knows that \IFTEX{$i$}{i} is the square root of \IFTEX{$-1$}{-1} but will not carry out more complicated complex operations. If you want complex denominators cleared by multiplication by their conjugates, turn on the switch \nameref{rationalize}. \end{Comments} \end{Switch} \begin{Switch}{CREF} \index{cross reference} The switch \name{cref} invokes the CREF cross-reference program that processes a set of procedure definitions to produce a summary of their entry points, undefined procedures, non-local variables and so on. The program will also check that procedures are called with a consistent number of arguments, and print a diagnostic message otherwise. The output is alphabetized on the first seven characters of each function name. To invoke the cross-reference program, \name{cref} is first turned on. This causes the program to load and the cross-referencing process to begin. After all the required definitions are loaded, turning \name{cref} off will cause a cross-reference listing to be produced. \begin{Comments} Algebraic procedures in REDUCE are treated as if they were symbolic, so that algebraic constructs will actually appear as calls to symbolic functions, such as \name{aeval}. \end{Comments} \end{Switch} \begin{Switch}{CRAMER} \index{matrix}\index{linear system}\index{solve} When the \name{cramer} switch is on, \nameref{matrix} inversion and linear equation solving (operator \nameref{solve}) is done by Cramer's rule, through exterior multiplication. Default is \name{off}. \begin{Examples} on time; & Time: 80 ms \\ off output; & Time: 100 ms \\[4mm] \begin{multilineinput} mm := mat((a,b,c,d,f),(a,a,c,f,b),(b,c,a,c,d), (c,c,a,b,f), (d,a,d,e,f)); \end{multilineinput} & Time: 300 ms \\ inverse := 1/mm; & Time: 18460 ms \\ on cramer; & Time: 80 ms \\ cramersinv := 1/mm; & Time: 9260 ms \end{Examples} \begin{Comments} Your time readings will vary depending on the REDUCE version you use. After you invert the matrix, turn on \nameref{output} and ask for one of the elements of the inverse matrix, such as \name{cramersinv(3,2)}, so that you can see the size of the expressions produced. Inversion of matrices and the solution of linear equations with dense symbolic entries in many variables is generally considerably faster with \name{cramer} on. However, inversion of numeric-valued matrices is slower. Consider the matrices you're inverting before deciding whether to turn \name{cramer} on or off. A substantial portion of the time in matrix inversion is given to formatting the results for printing. To save this time, turn \name{output} off, as shown in this example or terminate the expression with a dollar sign instead of a semicolon. The results are still available to you in the workspace associated with your prompt number, or you can assign them to an identifier for further use. \end{Comments} \end{Switch} \begin{Switch}{DEFN} \index{lisp} When the switch \name{defn} is on, the Standard Lisp equivalent of the input statement or procedure is printed, but not evaluated. Default is \name{off}. \begin{Examples} on defn; \\ 17/3; & (AEVAL (LIST 'QUOTIENT 17 3)) \\ df(sin(x),x,2); & (AEVAL (LIST 'DF (LIST 'SIN 'X) 'X 2)) \\ \begin{multilineinput} procedure coshval(a); begin scalar g; g := (exp(a) + exp(-a))/2; return g end; \end{multilineinput} & \begin{multilineoutput}{7cm} (AEVAL (PROGN (FLAG '(COSHVAL) 'OPFN) (DE COSHVAL (A) (PROG (G) (SETQ G (AEVAL (LIST 'QUOTIENT (LIST 'PLUS (LIST 'EXP A) (LIST 'EXP (LIST 'MINUS A))) 2))) (RETURN G)))) ) \end{multilineoutput} \\ coshval(1); & (AEVAL (LIST 'COSHVAL 1)) \\ off defn; \\ coshval(1); & Declare COSHVAL operator? (Y or N) \\ n \\ \begin{multilineinput} procedure coshval(a); begin scalar g; g := (exp(a) + exp(-a))/2; return g end; \end{multilineinput} & COSHVAL \\ on rounded; \\ coshval(1); & 1.54308063482 \end{Examples} \begin{Comments} The above function \name{coshval} finds the hyperbolic cosine (cosh) of its argument. When \name{defn} is on, you can see the Standard Lisp equivalent of the function, but it is not entered into the system as shown by the message \name{Declare COSHVAL operator?}. It must be reentered with \name{defn} off to be recognized. This procedure is used as an example; a more efficient procedure would eliminate the unnecessary local variable with \begin{verbatim} procedure coshval(a); (exp(a) + exp(-a))/2; \end{verbatim} \end{Comments} \end{Switch} \begin{Switch}{DEMO} \index{interactive}\index{output} The \name{demo} switch is used for interactive files, causing the system to pause after each command in the file until you type a \key{Return}. Default is \name{off}. \begin{Comments} The switch \name{demo} has no effect on top level interactive statements. Use it when you want to slow down operations in a file so you can see what is happening. You can either include the \name{on demo} command in the file, or enter it from the top level before bringing in any file. Unlike the \nameref{pause} command, \name{on demo} does not permit you to interrupt the file for questions of your own. \end{Comments} \end{Switch} \begin{Switch}{DFPRINT} \index{output}\index{derivative} When \name{dfprint} is on, expressions in the differentiation operator \nameref{df} are printed in a more ``natural'' notation, with the differentiation variables appearing as subscripts. In addition, if the switch \nameref{noarg} is on (the default), the arguments of the differentiated operator are suppressed. \begin{Examples} operator f; \\ df(f x,x); & DF(F(X),X); \\ on dfprint; \\ ws; & F_{X} \\ df(f(x,y),x,y); & F_{X}_{,}_{Y} \\ off noarg; \\ ws; & F(X,Y)_{X} \end{Examples} \end{Switch} \begin{Switch}{DIV} \index{output} When \name{div} is on, the system divides any simple factors found in the denominator of an expression into the numerator. Default is \name{off}. \begin{Examples} on div; \\ a := x**2/y**2; & A := X^{2} *Y^{-2} \\ b := a/(3*z); & B := \rfrac{1}{3}*X^{2} *Y^{-2} *Z^{-1} \\ off div; \\ a; & \rfrac{X^{2}}{Y^{2}}\\ b; & \rfrac{X^{2}}{3*Y^{2} *Z} \end{Examples} \begin{Comments} The \name{div} switch only has effect when the \nameref{pri} switch is on. When \name{pri} is off, regardless of the setting of \name{div}, the printing behavior is as if \name{div} were off. \end{Comments} \end{Switch} \begin{Switch}{ECHO} \index{output} The \name{echo} switch is normally off for top-level entry, and on when files are brought in. If \name{echo} is turned on at the top level, your input statements are echoed to the screen (thus appearing twice). Default \name{off} (but note default \name{on} for files). \begin{Comments} If you want to display certain portions of a file and not others, use the commands \name{off echo} and \name{on echo} inside the file. If you want no display of the file, use the input command \name{in} {\em filename}\name{\$} rather than using the semicolon delimiter. Be careful when you use commands within a file to generate another file. Since \name{echo} is on for files, the output file echoes input statements (unlike its behavior from the top level). You should explicitly turn off \name{echo} when writing output, and turn it back on when you're done. \end{Comments} \end{Switch} \begin{Switch}{ERRCONT} \index{error handling} When the \name{errcont} switch is on, error conditions do not stop file execution. Error messages will be printed whether \name{errcont} is on or off. Default is \name{off}. \begin{Comments} \begin{TEX} The table below shows REDUCE behavior under the settings of \name{errcont} and \name{int} : \begin{center} \begin{tabular}{|l|l|p{9.5cm}|} \hline \multicolumn{3}{|c|}{Behavior in Case of Error in Files}\\ \hline \multicolumn{1}{|c|}{errcont} & \multicolumn{1}{c|}{int} & \multicolumn{1}{c|}{Behavior when errors in files are encountered}\\ \hline off & off & Message is printed and parsing continues, but no further statements are executed; no commands from keyboard accepted except \verb|bye| or \verb|end| \\ off & on & Message is printed, and you are asked if you wish to continue. (This is the default behavior) \\ on & off & Message is printed, and file continues to execute without pause \\ on & on & Message is printed, and file continues to execute without pause\\ \hline \end{tabular} \end{center} \end{TEX} \begin{INFO} The following describes what happens when an error occurs in a file under each setting of \name{errcont} and \name{int}: Both off: Message is printed and parsing continues, but no further statements are executed; no commands from keyboard accepted except bye or end; \name{errcont} off, \name{int} on: Message is printed, and you are asked if you wish to continue. (This is the default behavior); \name{errcont} on, \name{int} off: Message is printed, and file continues to execute without pause; Both on: Message is printed, and file continues to execute without pause. \end{INFO} \end{Comments} \end{Switch} \begin{Switch}{EVALLHSEQP} \index{equation} Under normal circumstances, the right-hand-side of an \nameref{equation} is evaluated but not the left-hand-side. This also applies to any substitutions made by the \nameref{sub} operator. If both sides are to be evaluated, the switch \name{evallhseqp} should be turned on. \end{Switch} \begin{Switch}{EXP} \index{simplification} When the \name{exp} switch is on, powers and products of expressions are expanded. Default is \name{on}. \begin{Examples} (x+1)**3; & X^{3} + 3*X^{2} + 3*X + 1 \\ (a + b*i)*(c + d*i); & A*C + A*D*I + B*C*I - B*D \\ off exp; \\ (x+1)**3; & (X + 1)^{3} \\ (a + b*i)*(c + d*i); & (A + B*I)*(C + D*I) \\ length((x+1)**2/(y+1)); & 2 \end{Examples} \begin{Comments} Note that REDUCE knows that \IFTEX{$i^2 = -1$}{i^2 = -1}. When \name{exp} is off, equivalent expressions may not simplify to the same form, although zero expressions still simplify to zero. Several operators that expect a polynomial argument behave differently when \name{exp} is off, such as \nameref{length}. Be cautious about leaving \name{exp} off. \end{Comments} \end{Switch} \begin{Switch}{EXPANDLOGS} \index{logarithm} In many cases it is desirable to expand product arguments of logarithms, or collect a sum of logarithms into a single logarithm. Since these are inverse operations, it is not possible to provide rules for doing both at the same time and preserve the REDUCE concept of idempotent evaluation. As an alternative, REDUCE provides two switches \name{expandlogs} and \nameref{combinelogs} to carry out these operations. Both are off by default. \begin{Examples} on expandlogs; \\ log(x*y); & LOG(X) + LOG(Y) \\ on combinelogs; \\ ws; & LOG(X*Y) \end{Examples} \begin{Comments} At the present time, it is possible to have both switches on at once, which could lead to infinite recursion. However, an expression is switched from one form to the other in this case. Users should not rely on this behavior, since it may change in the next release. \end{Comments} \end{Switch} \begin{Switch}{EZGCD} \index{greatest common divisor}\index{polynomial} When \name{ezgcd} and \nameref{gcd} are on, greatest common divisors are computed using the EZ GCD algorithm that uses modular arithmetic (and is usually faster). Default is \name{off}. \begin{Comments} As a side effect of the gcd calculation, the expressions involved are factored, though not the heavy-duty factoring of \nameref{factorize}. The EZ GCD algorithm was introduced in a paper by J. Moses and D.Y.Y. Yun in \meta{Proceedings of the ACM}, 1973, pp. 159-166. Note that the \nameref{gcd} switch must also be on for \name{ezgcd} to have effect. \end{Comments} \end{Switch} \begin{Switch}{FACTOR} \index{output} When the \name{factor} switch is on, input expressions and results are automatically factored. \begin{Examples} on factor; \\ aa := 3*x**3*a + 6*x**2*y*a + 3*x**3*b + 6*x**2*y*b\\ + x*y*a + 2*y**2*a + x*y*b + 2*y**2*b; & AA := (A + B)*(3*X^{2} + Y)*(X + 2*Y) \\ off factor; \\ aa; & 3*A*X^{3} + 6*A*X^{2}*Y + A*X*Y + 2*A*Y^{2} + 3*B*X^{3} + 6*B*X^{2}*Y\\ + B*X*Y + 2*B*Y^{2} \\ on factor; \\ ab := x**2 - 2; & AB := X^{2} - 2 \end{Examples} \begin{Comments} REDUCE factors univariate and multivariate polynomials with integer coefficients, finding any factors that also have integer coefficients. The factoring is done by reducing multivariate problems to univariate ones with symbolic coefficients, and then solving the univariate ones modulo small primes. The results of these calculations are merged to determine the factors of the original polynomial. The factorizer normally selects evaluation points and primes using a random number generator. Thus, the detailed factoring behavior may be different each time any particular problem is tackled. When the \name{factor} switch is turned on, the \nameref{exp} switch is turned off, and when the \name{factor} switch is turned off, the \nameref{exp} switch is turned on, whether it was on previously or not. When the switch \nameref{trfac} is on, informative messages are generated at each call to the factorizer. The \nameref{trallfac} switch causes the production of a more verbose trace message. It takes precedence over \name{trfac} if they are both on. To factor a polynomial explicitly and store the results, use the operator \nameref{factorize}. \end{Comments} \end{Switch} \begin{Switch}{FAILHARD} \index{integration} When the \name{failhard} switch is on, the integration operator \nameref{int} terminates with an error message if the integral cannot be done in closed terms. Default is off. \begin{Comments} Use the \name{failhard} switch when you are dealing with complicated integrals and want to know immediately if REDUCE was unable to handle them. The integration operator sometimes returns a formal integration form that is more complicated than the original expression, when it is unable to complete the integration. \end{Comments} \end{Switch} \begin{Switch}{FORT} \index{FORTRAN} When \name{fort} is on, output is given Fortran-compatible syntax. Default is \name{off}. \begin{Examples} on fort; \\ df(sin(7*x + y),x); & ANS=7.*COS(7*X+Y) \\ on rounded; \\ b := log(sin(pi/5 + n*pi)); & B=LOG(SIN(3.14159265359*N+0.628318530718)) \end{Examples} \begin{Comments} REDUCE results can be written to a file (using \nameref{out}) and used as data by Fortran programs when \name{fort} is in effect. \name{fort} knows about correct statement length, continuation characters, defining a symbol when it is first used, and other Fortran details. The \nameref{GENTRAN} package offers many more possibilities than the \name{fort} switch. It produces Fortran (or C or Ratfor) code from REDUCE procedures or structured specifications, including facilities for producing double precision output. \end{Comments} \end{Switch} \begin{Switch}{FORTUPPER} \index{FORTRAN} When \name{fortupper} is on, any Fortran-style output appears in upper case. Default is \name{off}. \begin{Examples} on fort; \\ df(sin(7*x + y),x); & ans=7.*cos(7*x+y) \\ on fortupper; \\ df(sin(7*x + y),x); & ANS=7.*COS(7*X+Y) \\ \end{Examples} \end{Switch} \begin{Switch}{FULLPREC} \index{precision}\index{rounded} Trailing zeroes of rounded numbers to the full system precision are normally not printed. If this information is needed, for example to get a more understandable indication of the accuracy of certain data, the switch \name{fullprec} can be turned on. \begin{Examples} on rounded; \\ 1/2; & 0.5 \\ on fullprec; \\ ws; & 0.500000000000 \end{Examples} \begin{Comments} This is just an output options which neither influences the accuracy of the computation nor does it give additional information about the precision of the results. See also \nameref{scientific_notation}. \end{Comments} \end{Switch} \begin{Switch}{FULLROOTS} \index{solve}\index{polynomial} Since roots of cubic and quartic polynomials can often be very messy, a switch \name{fullroots} controls the production of results in closed form. \nameref{solve} will apply the formulas for explicit forms for degrees 3 and 4 only if \name{fullroots} is \name{on}. Otherwise the result forms are built using \nameref{root\_of}. Default is \name{off}. \end{Switch} \begin{Switch}{GC} \index{memory} With the \name{gc} switch, you can turn the garbage collection messages on or off. The form of the message depends on the particular Lisp used for the REDUCE implementation. \begin{Comments} See \nameref{reclaim} for an explanation of garbage collection. REDUCE does garbage collection when needed even if you have turned the notices off. \end{Comments} \end{Switch} \begin{Switch}{GCD} \index{greatest common divisor}\index{rational expression} When \name{gcd} is on, common factors in numerators and denominators of expressions are canceled. Default is \name{off}. \begin{Examples} \begin{multilineinput} (2*(f*h)**2 - f**2*g*h - (f*g)**2 - f*h**3 + f*h*g**2 - h**4 + g*h**3)/(f**2*h - f**2*g - f*h**2 + 2*f*g*h - f*g**2 - g*h**2 + g**2*h); \end{multilineinput} & \rfrac{F^{2}*G^{2} + F^{2}*G*H - 2*F^{2}*H^{2} - F*G^{2}*H + F*H^{3} - G*H^{3} + H^{4}} {F^{2}*G - F^{2}*H + F*G^{2} - 2*F*G*H + F*H^{2} - G^{2}*H + G*H^{2}} \\ on gcd; \\ ws; & \rfrac{F*G + 2*F*H + H^{2}}{F + G} \\ e2 := a*c + a*d + b*c + b*d; & E2 := A*C + A*D + B*C + B*D \\ off exp; \\ e2; & (A + B)*(C + D) \end{Examples} \begin{Comments} Even with \name{gcd} off, a check is automatically made for common variable and numerical products in the numerators and denominators of expression, and the appropriate cancellations made. Thus the example demonstrating the use of \name{gcd} is somewhat complicated. Note when \nameref{exp} is off, \name{gcd} has the side effect of factoring the expression. \end{Comments} \end{Switch} \begin{Switch}{HORNER} \index{output}\index{polynomial} When the \name{horner} switch is on, polynomial expressions are printed in Horner's form for faster and safer numerical evaluation. Default is \name{off}. The leading variable of the expression is selected as Horner variable. To select the Horner variable explicitly use the \nameref{korder} declaration. \begin{Examples} on horner;\\ (13p-4q)^3;& ( - 64)*q^3 + p*(624*q^2 + p*(( - 2028)*q + p*2197))\\ korder q;\\ ws;& 2197*p^3 + q*(( - 2028)*p^2 + q*(624*p + q*(-64))) \end{Examples} \end{Switch} \begin{Switch}{IFACTOR} \index{integer}\index{factorize} When the \name{ifactor} switch is on, any integer terms appearing as a result of the \nameref{factorize} command are factored themselves into primes. Default is \name{off}. If the argument of \name{factorize} is an integer, \name{ifactor} has no effect, since the integer is always factored. \begin{Examples} factorize(4*x**2 + 28*x + 48); & \{4,X + 3,X + 4\} \\ factorize(22587); & \{3,7529\} \\ on ifactor; \\ factorize(4*x**2 + 28*x + 48); & \{2,2,X + 4,X + 3\} \\ factorize(22587); & \{3,7529\} \end{Examples} \begin{Comments} Constant terms that appear within nonconstant polynomial factors are not factored. The \name{ifactor} switch affects only factoring done specifically with \nameref{factorize}, not on factoring done automatically when the \nameref{factor} switch is on. \end{Comments} \end{Switch} \begin{Switch}{INT} \index{interactive} The \name{int} switch specifies an interactive mode of operation. Default \name{on}. \begin{Comments} There is no reason to turn \name{int} off during interactive calculations, since there are no benefits to be gained. If you do have \name{int} off while inputting a file, and REDUCE finds an error, it prints the message ``Continuing with parsing only." In this state, REDUCE accepts only \nameref{end}\name{;} or \nameref{bye}\name{;} from the keyboard; everything else is ignored, even the command \name{on int}. \end{Comments} \end{Switch} \begin{Switch}{INTSTR} \index{output} If \name{intstr} (for ``internal structure'') is on, arguments of an operator are printed in a more structured form. \begin{Examples} operator f; \\ f(2x+2y); & F(2*X + 2*Y) \\ on intstr; \\ ws; & F(2*(X + Y)) \end{Examples} \end{Switch} \begin{Switch}{LCM} \index{rational expression} The \name{lcm} switch instructs REDUCE to compute the least common multiple of denominators whenever rational expressions occur. Default is \name{on}. \begin{Examples} off lcm; \\ z := 1/(x**2 - y**2) + 1/(x-y)**2; & Z := \rfrac{2*X*(X - Y)}{X^{4} - 2*X^{3}*Y + 2*X*Y^{3} - Y^{4}} \\ on lcm; \\ z; & \rfrac{2*X*(X - Y)}{X^{4} - 2*X^{3}*Y + 2*X*Y ^{3} - Y^{4}} \\ zz := 1/(x**2 - y**2) + 1/(x-y)**2; & ZZ := \rfrac{2*X}{X^{3} - X^{2}*Y - X*Y^{2} + Y^{3}} \\ on gcd; \\ z; & \rfrac{2*X}{X^{3} - X^{2}*Y - X*Y^{2} + Y^{3} } \end{Examples} \begin{Comments} Note that \name{lcm} has effect only when rational expressions are first combined. It does not examine existing structures for simplifications on display. That is shown above when \IFTEX{$z$}{z} is entered with \name{lcm} off. It remains unsimplified even after \name{lcm} is turned back on. However, a new variable containing the same expression is simplified on entry. The switch \nameref{gcd} does examine existing structures, as shown in the last example line above. Full greatest common divisor calculations become expensive if work with large rational expressions is required. A considerable savings of time can be had if a full gcd check is made only when denominators are combined, and only a partial check for numerators. This is the effect of the \name{lcm} switch. \end{Comments} \end{Switch} \begin{Switch}{LESSSPACE} \index{output} You can turn on the switch \name{lessspace} if you want fewer blank lines in your output. \end{Switch} \begin{Switch}{LIMITEDFACTORS} \index{factorize}\index{polynomial} To get limited factorization in cases where it is too expensive to use full multivariate polynomial factorization, the switch \name{limitedfactors} can be turned on. In that case, only ``inexpensive'' factoring operations, such as square-free factorization, will be used when \nameref{factorize} is called. \begin{Examples} a := (y-x)^2*(y^3+2x*y+5)*(y^2-3x*y+7)$ \\ factorize a; & \begin{multilineoutput}{7cm} \{ - X + Y, X - Y, 2*X*Y + Y^{3} + 5, 3*X*Y - Y^{2} - 7\} \end{multilineoutput} \\ on limitedfactors; \\ factorize a; & \begin{multilineoutput}{7cm} \{ - X + Y, X - Y, 6*X^{2}*Y^{2} + 3*X*Y^{4} - 2*X*Y^{3} + X*Y - Y^{5} - 7*Y^{3} - 5*Y^{2} - 35\} \end{multilineoutput} \end{Examples} \end{Switch} \begin{Switch}{LIST} The \name{list} switch causes REDUCE to print each term in any sum on separate lines. \begin{Examples} x**2*(y**2 + 2*y) + x*(y**2 + z)/(2*a); & \rfrac{X*(2*A*X*Y^{2} + 4*A*X*Y + Y^{2} + Z)}{2*A} \\ on list; \\ ws; & \begin{multilineoutput}{6cm} (X*(2*A*X*Y^{2} + 4*A*X*Y + Y^{2} + Z))/(2*A) \end{multilineoutput} \end{Examples} \end{Switch} \begin{Switch}{LISTARGS} \index{list}\index{argument}\index{operator} If an operator other than those specifically defined for lists is given a single argument that is a list, then the result of this operation will be a list in which that operator is applied to each element of the list. This process can be inhibited globally by turning on the switch \name{listargs}. \begin{Examples} log {a,b,c}; & {LOG(A),LOG(B),LOG(C)} \\ on listargs; \\ log {a,b,c}; & LOG({A,B,C}) \end{Examples} \begin{Comments} It is possible to inhibit such distribution for a specific operator by using the declaration \nameref{listargp}. In addition, if an operator has more than one argument, no such distribution occurs, so \name{listargs} has no effect. \end{Comments} \end{Switch} \begin{Switch}{MCD} \index{rational expression} When \name{mcd} is on, sums and differences of rational expressions are put on a common denominator. Default is \name{on}. \begin{Examples} a/(x+1) + b/5; & \rfrac{5*A + B*X + B}{5*(X + 1)} \\ off mcd; \\ a/(x+1) + b/5; & (X + 1)^{-1}*A + 1/5*B \\ 1/6 + 1/7; & 13/42 \end{Examples} \begin{Comments} Even with \name{mcd} off, rational expressions involving only numbers are still put over a common denominator. Turning \name{mcd} off is useful when explicit negative powers are needed, or if no greatest common divisor calculations are desired, or when differentiating complicated rational expressions. Results when \name{mcd} is off are no longer in canonical form, and expressions equivalent to zero may not simplify to 0. Some operations, such as factoring cannot be done while \name{mcd} is off. This option should therefore be used with some caution. Turning \name{mcd} off is most valuable in intermediate parts of a complicated calculation, and should be turned back on for the last stage. \end{Comments} \end{Switch} \begin{Switch}{MODULAR} \index{modular} When \name{modular} is on, polynomial coefficients are reduced by the modulus set by \nameref{setmod}. If no modulus has been set, \name{modular} has no effect. \begin{Examples} setmod 2; & 1 \\ on modular; \\ (x+y)**2; & X^{2} + Y^{2} \\ 145*x**2 + 20*x**3 + 17 + 15*x*y; & X^{2} + X*Y + 1 \end{Examples} \begin{Comments} Modular operations are only conducted on the coefficients, not the exponents. The modulus is not restricted to being prime. When the modulus is prime, division by a number not relatively prime to the modulus results in a \meta{Zero divisor} error message. When the modulus is a composite number, division by a power of the modulus results in an error message, but division by an integer which is a factor of the modulus does not. The representation of modular number can be influenced by \nameref{balanced\_mod}. \end{Comments} \end{Switch} \begin{Switch}{MSG} \index{output} When \name{msg} is off, the printing of warning messages is suppressed. Error messages are still printed. \begin{Comments} Warning messages include those about redimensioning an \nameref{array} or declaring an \nameref{operator} where one is expected. \end{Comments} \end{Switch} \begin{Switch}{MULTIPLICITIES} \index{solve} When \nameref{solve} is applied to a set of equations with multiple roots, solution multiplicities are normally stored in the global variable \nameref{root\_multiplicities} rather than the solution list. If you want the multiplicities explicitly displayed, the switch \name{multiplicities} should be turned on. In this case, \name{root_multiplicities} has no value. \begin{Examples} solve(x^2=2x-1,x); & {X=1} \\ root_multiplicities; & {2} \\ on multiplicities; \\ solve(x^2=2x-1,x); & {X=1,X=1} \\ root_multiplicities; & \end{Examples} \end{Switch} \begin{Switch}{NAT} \index{output} When \name{nat} is on, output is printed to the screen in natural form, with raised exponents. \name{nat} should be turned off when outputting expressions to a file for future input. Default is \name{on}. \begin{Examples} (x + y)**3; & X^{3} + 3*X^{2}*Y + 3*X*Y^{2} + Y^{3} \\ off nat; \\ (x + y)**3; & X**3 + 3*X**2*Y + 3*X*Y**2 + Y**3\$ \\ on fort; \\ (x + y)**3; & ANS=X**3+3.*X**2*Y+3.*X*Y**2+Y**3 \end{Examples} \begin{Comments} With \name{nat} off, a dollar sign is printed at the end of each expression. An output file written with \name{nat} off is ready to be read into REDUCE using the command \nameref{in}. \end{Comments} \end{Switch} \begin{Switch}{NERO} \index{output} When \name{nero} is on, zero assignments (such as matrix elements) are not printed. \begin{Examples} matrix a; a := mat((1,0),(0,1)); & \begin{multilineoutput}{6cm} A(1,1) := 1 A(1,2) := 0 A(2,1) := 0 A(2,2) := 1 \end{multilineoutput}\\ on nero; \\ a; & \begin{multilineoutput}{6cm} MAT(1,1) := 1 MAT(2,2) := 1 \end{multilineoutput}\\ a(1,2); & \explanationo{nothing is printed.} \\ b := 0; & \explanationo{nothing is printed.} \\ off nero; \\ b := 0; & B := 0 \end{Examples} \begin{Comments} \name{nero} is often used when dealing with large sparse matrices, to avoid being overloaded with zero assignments. \end{Comments} \end{Switch} \begin{Switch}{NOARG} \index{output}\index{derivative} When \nameref{dfprint} is on, expressions in the differentiation operator \nameref{df} are printed in a more ``natural'' notation, with the differentiation variables appearing as subscripts. When \name{noarg} is on (the default), the arguments of the differentiated operator are also suppressed. \begin{Examples} operator f; \\ df(f x,x); & DF(F(X),X); \\ on dfprint; \\ ws; & F_{X} \\ off noarg; \\ ws; & F(X)_{X} \end{Examples} \end{Switch} \begin{Switch}{NOLNR} \index{integration} When \name{nolnr} is on, the linear properties of the integration operator \nameref{int} are suppressed if the integral cannot be found in closed terms. \begin{Comments} REDUCE uses the linear properties of integration to attempt to break down an integral into manageable pieces. If an integral cannot be found in closed terms, these pieces are returned. When the \name{nolnr} switch is off, as many of the pieces as possible are integrated. When it is on, if any piece fails, the rest of them remain unevaluated. \end{Comments} \end{Switch} %\begin{Switch}{NORNDBF} % %***** To be added ***** % %\end{Switch} \begin{Switch}{NOSPLIT} \index{output} Under normal circumstances, the printing routines try to break an expression across lines at a natural point. This is a fairly expensive process. If you are not overly concerned about where the end-of-line breaks come, you can speed up the printing of expressions by turning off the switch \name{nosplit}. This switch is normally on. \end{Switch} \begin{Switch}{NUMVAL} \index{rounded} With \nameref{rounded} on, elementary functions with numerical arguments will return a numerical answer where appropriate. If you wish to inhibit this evaluation, \name{numval} should be turned off. It is normally on. \begin{Examples} on rounded; \\ cos 3.4; & - 0.966798192579 \\ off numval; \\ cos 3.4; & COS(3.4) \end{Examples} \end{Switch} \begin{Switch}{OUTPUT} \index{output} When \name{output} is off, no output is printed from any REDUCE calculation. The calculations have their usual effects other than printing. Default is \name{on}. \begin{Comments} Turn output \name{off} if you do not wish to see output when executing large files, or to save the time REDUCE spends formatting large expressions for display. Results are still available with \nameref{ws}, or in their assigned variables. \end{Comments} \end{Switch} \begin{Switch}{OVERVIEW} \index{factorize} When \name{overview} is on, the amount of detail reported by the factorizer switches \nameref{trfac} and \nameref{trallfac} is reduced. \end{Switch} \begin{Switch}{PERIOD} \index{output}\index{integer} When \name{period} is on, periods are added after integers in Fortran-compatible output (when \nameref{fort} is on). There is no effect when \name{fort} is off. Default is \name{on}. \end{Switch} \begin{Switch}{PRECISE} \index{simplification}\index{square root} When the \name{precise} switch is on, simplification of roots of even powers returns absolute values, a more precise answer mathematically. Default is \name{on}. \begin{Examples} sqrt(x**2); & X \\ (x**2)**(1/4); & SQRT(X) \\ on precise; \\ sqrt(x**2); & ABS(X) \\ (x**2)**(1/4); & SQRT(ABS(X)) \end{Examples} \begin{Comments} In many types of mathematical work, simplification of powers and surds can proceed by the fastest means of simplifying the exponents arithmetically. When it is important to you that the positive root be returned, turn \name{precise} on. One situation where this is important is when graphing square-root expressions such as \IFTEX{$\sqrt{x^2+y^2}$}{sqrt(x^2+y^2)} to avoid a spike caused by REDUCE simplifying \IFTEX{$\sqrt{y^2}$}{sqrt(y^2)} to \IFTEX{$y$}{y} when \IFTEX{$x$}{x} is zero. \end{Comments} \end{Switch} \begin{Switch}{PRET} \index{output} When \name{pret} is on, input is printed in standard REDUCE format and then evaluated. \begin{Examples} on pret; \\ (x+1)^3; & \begin{multilineoutput}{6cm} (x + 1)**3; X^{3} + 3*X^{2} + 3*X + 1 \end{multilineoutput} \\ \begin{multilineinput} procedure fac(n); if not (fixp(n) and n>=0) then rederr "Choose nonneg. integer only" else for i := 0:n-1 product i+1; \end{multilineinput} & \begin{multilineoutput}{8cm} procedure fac n; if not (fixp n and n>=0) then rederr "Choose nonneg. integer only" else for i := 0:n - 1 product i + 1; FAC \end{multilineoutput}\\ fac 5; & \begin{multilineoutput}{6cm} fac 5; 120 \end{multilineoutput} \end{Examples} \begin{Comments} Note that all input is converted to lower case except strings (which keep the same case) all operators with a single argument have had the parentheses removed, and all infix operators have had a space added on each side. In addition, syntactical constructs like \name{if}\ldots\name{then}\ldots\name{else} are printed in a standard format. \end{Comments} \end{Switch} \begin{Switch}{PRI} \index{output} When \name{pri} is on, the declarations \nameref{order} and \nameref{factor} can be used, and the switches \nameref{allfac}, \nameref{div}, \nameref{rat}, and \nameref{revpri} take effect when they are on. Default is \name{on}. \begin{Comments} Printing of expressions is faster with \name{pri} off. The expressions are then returned in one standard form, without any of the display options that can be used to feature or display various parts of the expression. You can also gain insight into REDUCE's representation of expressions with \name{pri} off. \end{Comments} \end{Switch} \begin{Switch}{RAISE} \index{input}\index{character} When \name{raise} is on, lower case letters are automatically converted to upper case on input. \name{raise} is normally on. \begin{Comments} This conversion affects the internal representation of the letter, and is independent of the case with which a letter is printed, which is normally lower case. \end{Comments} \end{Switch} \begin{Switch}{RAT} \index{output} When the \name{rat} switch is on, and kernels have been selected to display with the \nameref{factor} declaration, the denominator is printed with each term rather than one common denominator at the end of an expression. \begin{Examples} (x+1)/x + x**2/sin y; & \rfrac{SIN(Y)*X + SIN(Y) + X^{3}}{SIN(Y)*X} \ \ factor x; \\ (x+1)/x + x**2/sin y; & \rfrac{X^{3} + X*SIN(Y) + SIN(Y)}{X*SIN(Y)} \ \ on rat; \\ (x+1)/x + x**2/sin y; & \rfrac{X^{2}}{SIN(Y)} + 1 + X^{-1} \end{Examples} \begin{Comments} The \name{rat} switch only has effect when the \nameref{pri} switch is on. When \name{pri} is off, regardless of the setting of \name{rat}, the printing behavior is as if \name{rat} were off. \name{rat} only has effect upon the display of expressions, not their internal form. \end{Comments} \end{Switch} \begin{Switch}{RATARG} \index{rational expression}\index{polynomial} When \name{ratarg} is on, rational expressions can be given to operators such as \nameref{coeff} and \nameref{lterm} that normally require polynomials in one of their arguments. When \name{ratarg} is off, rational expressions cause an error message. \begin{Examples} aa := x/y**2 + 1/x + y/x**2; & AA := \rfrac{X^{3} + X*Y^{2} + Y^{3}}{X^{2}*Y^{2}} \\ coeff(aa,x); & ***** \rfrac{X^{3} + X*Y^{2} + Y^{3}}{X^{2}*Y^{2}} invalid as POLYNOMIAL\\ on ratarg; \\ coeff(aa,x); & \{\rfrac{Y}{X^{2}},\rfrac{1}{X^{2}},0,\rfrac{1}{X^{2}*Y^{2}}\} \end{Examples} \end{Switch} \begin{Switch}{RATIONAL} \index{rational expression}\index{polynomial} When \name{rational} is on, polynomial expressions with rational coefficients are produced. \begin{Examples} x/2 + 3*y/4; & \rfrac{2*X + 3*Y}{4} \\ (x**2 + 5*x + 17)/2; & \rfrac{X^{2} + 5*X + 17}{2} \\ on rational; \\ x/2 + 3y/4; & \rfrac{1}{2}*(X + \rfrac{3}{2}*Y) \\ (x**2 + 5*x + 17)/2; & \rfrac{1}{2}*(X^{2} + 5*X + 17) \end{Examples} \begin{Comments} By using \name{rational}, polynomial expressions with rational coefficients can be used in some commands that expect polynomials. With \name{rational} off, such a polynomial becomes a rational expression, with denominator the least common multiple of the denominators of the rational number coefficients. % The \nameref{factorize} command does not accept % polynomials with rational coefficients. \end{Comments} \end{Switch} \begin{Switch}{RATIONALIZE} \index{rational expression}\index{simplification}\index{complex} When the \name{rationalize} switch is on, denominators of rational expressions that contain complex numbers or root expressions are simplified by multiplication by their conjugates. \begin{Examples} qq := (1+sqrt(3))/(sqrt(3)-7); & QQ := \rfrac{SQRT(3) + 1}{SQRT(3) - 7} \\ on rationalize; \\ qq; & \rfrac{- 4*SQRT(3) - 5}{23} \\ 2/(4 + 6**(1/3)); & \rfrac{6^{2/3} - 4*6^{1/3} + 16}{35} \\ (i-1)/(i+3); & \rfrac{2*I - 1}{5} \\ off rationalize; \\ (i-1)/(i+3); & \rfrac{I - 1}{I + 3} \end{Examples} \end{Switch} \begin{Switch}{RATPRI} \index{output}\index{rational expression} When the \name{ratpri} switch is on, rational expressions and fractions are printed as two lines separated by a fraction bar, rather than in a linear style. Default is \name{on}. \begin{Examples} 3/17; & \rfrac{3}{17} \\ 2/b + 3/y; & \rfrac{3*B + 2*Y}{B*Y} \\ off ratpri; \\ 3/17; & 3/17 \\ 2/b + 3/y; & (3*B + 2*Y)/(B*Y) \end{Examples} \end{Switch} \begin{Switch}{REVPRI} \index{output} When the \name{revpri} switch is on, terms are printed in reverse order from the normal printing order. \begin{Examples} x**5 + x**2 + 18 + sqrt(y); & SQRT(Y) + X^{5} + X^{2} + 18 \\ a + b + c + w; & A + B + C + W \\ on revpri; \\ x**5 + x**2 + 18 + sqrt(y); & 17 + X^{2} + X^{5} + SQRT(Y) \\ a + b + c + w; & W + C + B + A \end{Examples} \begin{Comments} Turn \name{revpri} on when you want to display a polynomial in ascending rather than descending order. \end{Comments} \end{Switch} \begin{Switch}{RLISP88} \index{lisp} Rlisp '88 is a superset of the Rlisp that has been traditionally used for the support of REDUCE. It is fully documented in the book Marti, J.B., ``{RLISP} '88: An Evolutionary Approach to Program Design and Reuse'', World Scientific, Singapore (1993). It supports different looping constructs from the traditional Rlisp, and treats ``-'' as a letter unless separated by spaces. Turning on the switch \name{rlisp88} converts to Rlisp '88 parsing conventions in symbolic mode, and enables the use of Rlisp '88 extensions. Turning off the switch reverts to the traditional Rlisp and the previous mode ( (\nameref{symbolic} or \nameref{algebraic}) in force before \name{rlisp88} was turned on. \end{Switch} \begin{Switch}{ROUNDALL} \index{rounded}\index{rational expression}\index{floating point} In \nameref{rounded} mode, rational numbers are normally converted to a floating point representation. If \name{roundall} is off, this conversion does not occur. \name{roundall} is normally \name{on}. \begin{Examples} on rounded; \\ 1/2; & 0.5 \\ off roundall; \\ 1/2; \rfrac{1}{2} \end{Examples} \end{Switch} \begin{Switch}{ROUNDBF} When \nameref{rounded} is on, the normal defaults cause underflows to be converted to zero. If you really want the small number that results in such cases, \name{roundbf} can be turned on. \begin{Examples} on rounded; \\ exp(-100000.1^2); & 0 \\ on roundbf; \\ exp(-100000.1^2); & 1.18441281937E-4342953505 \end{Examples} \begin{Comments} If a polynomial is input in \nameref{rounded} mode at the default precision into any \nameref{roots} function, and it is not possible to represent any of the coefficients of the polynomial precisely in the system floating point representation, the switch \name{roundbf} will be automatically turned on. All rounded computation will use the internal bigfloat representation until the user subsequently turns \name{roundbf} off. (A message is output to indicate that this condition is in effect.) \end{Comments} \end{Switch} \begin{Switch}{ROUNDED} \index{floating point} When \name{rounded} is on, floating-point arithmetic is enabled, with precision initially at a system default value, which is usually 12 digits. The precise number can be found by the command \nameref{precision}(0). \begin{Examples} pi; & PI \\ 35/217; & \rfrac{5}{31} \\ on rounded; \\ pi; & 3.14159265359 \\ 35/217; & 0.161 \\ sqrt(3); & 1.73205080756 \end{Examples} \begin{Comments} If more than the default number of decimal places are required, use the \nameref{precision} command to set the required number. \end{Comments} \end{Switch} \begin{Switch}{SAVESTRUCTR} \index{STRUCTR OPERATOR} When \name{savestructr} is on, results of the \nameref{structr} command are returned as a list whose first element is the representation for the expression and the remaining elements are equations showing the relationships of the generated variables. \begin{Examples} off exp; \\ structr((x+y)^3 + sin(x)^2); & \begin{multilineoutput}{6cm} ANS3 where ANS3 := ANS1^{3} + ANS2^{2} ANS2 := SIN(X) ANS1 := X + Y \end{multilineoutput}\\ ans3; & ANS3 \\ on savestructr; \\ structr((x+y)^{3} + sin(x)^{2}); & {ANS3,ANS3=ANS1^{3} + ANS2^{2},ANS2=SIN(X),ANS1=X + Y} \\ ans3 where rest ws; & (X + Y)^{3} + SIN(X)^{2} \end{Examples} \begin{Comments} In normal operation, \nameref{structr} is only a display command. With \name{savestructr} on, you can access the various parts of the expression produced by \name{structr}. The generic system names use the stem \name{ANS}. You can change this to your own stem by the command \nameref{varname}. REDUCE adds integers to this stem to make unique identifiers. \end{Comments} \end{Switch} \begin{Switch}{SOLVESINGULAR} \index{solve} When \name{solvesingular} is on, singular or underdetermined systems of linear equations are solved, using arbitrary real, complex or integer variables in the answer. Default is \name{on}. \begin{Examples} solve({2x + y,4x + 2y},{x,y}); & \{\{X= - \rfrac{ARBCOMPLEX(1)}{2},Y=ARBCOMPLEX(1)\}\} \\ solve({7x + 15y - z,x - y - z},{x,y,z}); & \begin{multilineoutput}{6cm} \{\{X=\rfrac{8*ARBCOMPLEX(3)}{11} Y= - \rfrac{3*ARBCOMPLEX(3)}{11} Z=ARBCOMPLEX(3)\}\} \end{multilineoutput}\\ off solvesingular; \\ solve({2x + y,4x + 2y},{x,y}); & ***** SOLVE given singular equations \\ solve({7x + 15y - z,x - y - z},{x,y,z}); & ***** SOLVE given singular equations \end{Examples} \begin{Comments} The integer following the identifier \nameref{arbcomplex} above is assigned by the system, and serves to identify the variable uniquely. It has no other significance. \end{Comments} \end{Switch} \begin{Switch}{TIME} \index{time} When \name{time} is on, the system time used in executing each REDUCE statement is printed after the answer is printed. \begin{Examples} on time; & Time: 4940 ms \\ df(sin(x**2 + y),y); & \begin{multilineoutput}{6cm} COS(X + Y^{2}) Time: 180 ms \end{multilineoutput}\\ solve(x**2 - 6*y,x); & \begin{multilineoutput}{6cm} \{X= - SQRT(Y)*SQRT(6), X=SQRT(Y)*SQRT(6)\} Time: 320 ms \end{multilineoutput} \end{Examples} \begin{Comments} When \name{time} is first turned on, the time since the beginning of the REDUCE session is printed. After that, the time used in computation, (usually in milliseconds, though this is system dependent) is printed after the results of each command. Idle time or time spent typing in commands is not counted. If \name{time} is turned off, the first reading after it is turned on again gives the time elapsed since it was turned off. The time printed is CPU or wall clock time, depending on the system. \end{Comments} \end{Switch} \begin{Switch}{TRALLFAC} \index{factorize} When \name{trallfac} is on, a more detailed trace of factorizer calls is generated. \begin{Comments} The \name{trallfac} switch takes precedence over \nameref{trfac} if they are both on. \name{trfac} gives a factorization trace with less detail in it. When the \nameref{factor} switch is on also, all input polynomials are sent to the factorizer automatically and trace information is generated. The \nameref{out} command saves the results of the factoring, but not the trace. % You need to use the \name{dribble} command to save the trace text to a file. \end{Comments} \end{Switch} \begin{Switch}{TRFAC} \index{factorize} When \name{trfac} is on, a narrative trace of any calls to the factorizer is generated. Default is \name{off}. \begin{Comments} When the switch \nameref{factor} is on, and \name{trfac} is on, every input polynomial is sent to the factorizer, and a trace generated. With \name{factor} off, only polynomials that are explicitly factored with the command \nameref{factorize} generate trace information. % Use the \name{dribble} or \name{logfile} command to save the trace text to % a file. The \nameref{out} command saves the results of the factoring, but not the trace. The \nameref{trallfac} switch gives trace information to a greater level of detail. \end{Comments} \end{Switch} \begin{Switch}{TRIGFORM} \index{solve}\index{polynomial} When \nameref{fullroots} is on, \nameref{solve} will compute the roots of a cubic or quartic polynomial is closed form. When \name{trigform} is on, the roots will be expressed by trigonometric forms. Otherwise nested surds are used. Default is \name{on}. \end{Switch} \begin{Switch}{TRINT} \index{integration} When \name{trint} is on, a narrative tracing various steps in the integration process is produced. \begin{Comments} %Use the \name{dribble} or \name{logfile} command to save this text to a file. The \nameref{out} command saves the results of the integration, but not the trace. \end{Comments} \end{Switch} \begin{Switch}{TRNONLNR} \index{solve} When \name{trnonlnr} is on, a narrative tracing various steps in the process for solving non-linear equations is produced. \begin{Comments} \name{trnonlnr} can only be used after the solve package has been loaded (e.g., by an explicit call of \nameref{load\_package}). The \nameref{out} command saves the results of the equation solving, but not the trace. \end{Comments} \end{Switch} \begin{Switch}{VAROPT} \index{solve} When \name{varopt} is on, the sequence of variables is optimized by \nameref{solve} with respect to execution speed. Otherwise, the sequence given in the call to \nameref{solve} is preserved. Default is \name{on}. In combination with the switch \nameref{arbvars}, \name{varopt} can be used to control variable elimination. \begin{Examples} off arbvars; \\ solve({x+2z,x-3y},{x,y,z}); & \{\{y=\rfrac{x}{3},z= - \rfrac{x}{2}\}\} \\ solve({x*y=1,z=x},{x,y,z}); & \{\{z=x,y=\rfrac{1}{x}\}\} \\ off varopt; \\ solve({x+2z,x-3y},{x,y,z}); & \{\{x= - 2*z,y= - \rfrac{2*z}{3}\}\} \\ solve({x*y=1,z=x},{x,y,z}); & \{\{y=\rfrac{1}{z},x=z\}\} \\ \end{Examples} \end{Switch}