COSH INDEX

COSH _ _ _ _ _ _ _ _ _ _ _ _ operator

The cosh operator returns the hyperbolic cosine of its argument. The derivative of cosh and some simple transformations are known to the system.

### syntax:

cosh(<expression>) or cosh <simple\_expression>

<expression> may be any scalar REDUCE expression, not an array, matrix or vector expression. <simple\_expression> must be a single identifier or begin with a prefix operator name.

### examples:

```

cosh b;

COSH(B)

cosh(0);

1

df(cosh(x*y),x);

SINH(X*Y)*Y

int(cosh(x),x);

SINH(X)

```

You may attach further functionality by defining its inverse (see acosh). A numeric value is not returned by cosh unless the switch rounded is on and its argument evaluates to a number. INDEX

COT _ _ _ _ _ _ _ _ _ _ _ _ operator

cot represents the cotangent of its argument. It takes an arbitrary scalar expression as its argument. The derivative of acot and some simple properties are known to the system.

### syntax:

cot(<expression>) or cot <simple\_expression>

<expression> may be any scalar REDUCE expression. <simple\_expression > must be a single identifier or begin with a prefix operator name.

### examples:

```
cot(a)*tan(a);

COT(A)*TAN(A))

cot(1);

COT(1)

df(cot(2*x),x);

2
- 2*(COT(2*X)   + 1)

```

Numerical values of expressions involving cot may be foun d by turning on the switch rounded. INDEX

COTH _ _ _ _ _ _ _ _ _ _ _ _ operator

The coth operator returns the hyperbolic cotangent of its argument. The derivative of coth and some simple transformations are known to the system.

### syntax:

coth(<expression>) or coth <simple\_expression>

<expression> may be any scalar REDUCE expression. <simple\_expression > must be a single identifier or begin with a prefix operator name.

### examples:

```
df(coth(x*y),x);

2
- Y*(COTH(X*Y)   - 1)

coth acoth z;

Z

```

You can write let statements and procedures to add further functionality to coth if you wish. Numerical values of expressions involving coth may also be found by turning on the switch rounded. INDEX

CSC _ _ _ _ _ _ _ _ _ _ _ _ operator

The csc operator returns the cosecant of its argument. The derivative of csc and some simple transformations are known to the system.

### syntax:

csc(<expression>) or csc <simple\_expression>

<expression> may be any scalar REDUCE expression. <simple\_expression > must be a single identifier or begin with a prefix operator name.

### examples:

```

csc(q)*sin(q);

CSC(Q)*SIN(Q)

df(csc(x*y),x);

-COT(X*Y)*CSC(X*Y)*Y

```

You can write let statements and procedures to add further functionality to csc if you wish. Numerical values of expressions involving csc may also be found by turning on the switch rounded. INDEX

CSCH _ _ _ _ _ _ _ _ _ _ _ _ operator

The cosh operator returns the hyperbolic cosecant of its argument. The derivative of csch and some simple transformations are known to the system.

### syntax:

csch(<expression>) or csch <simple\_expression>

<expression> may be any scalar REDUCE expression, not an array, matrix or vector expression. <simple\_expression> must be a single identifier or begin with a prefix operator name.

### examples:

```

csch b;

CSCH(B)

csch(0);

0

df(csch(x*y),x);

- COTH(X*Y)*CSCH(X*Y)*Y

int(csch(x),x);

INT(CSCH(X),X)

```

A numeric value is not returned by csch unless the switch rounded is on and its argument evaluates to a number. INDEX

ERF _ _ _ _ _ _ _ _ _ _ _ _ operator

The erf operator represents the error function, defined by

erf(x) = (2/sqrt(pi))*int(e^(-x^2),x)

A limited number of its properties are known to the system, including the fact that it is an odd function. Its derivative is known, and from this, some integrals may be computed. However, a complete integration procedure for this operator is not currently included.

### examples:

```
erf(0);

0

erf(-a);

- ERF(A)

df(erf(x**2),x);

4*SQRT(PI)*X
------------
4
X
E  *PI

int(erf(x),x);

2
X
E  *ERF(X)*PI*X + SQRT(PI)
---------------------------
2
X
E  *PI

``` INDEX

EXP _ _ _ _ _ _ _ _ _ _ _ _ operator

The exp operator returns e raised to the power of its argument .

### syntax:

exp(<expression>) or exp <simple\_expression>

<expression> can be any valid REDUCE scalar expression. <simple\_expression> must be a single identifier or begin with a prefix operator.

### examples:

```
exp(sin(x));

SIN X
E

exp(11);

11
E

on rounded;

exp sin(pi/3);

2.37744267524

```

Numeric values are returned only when rounded is on. The single letter e with the exponential operator ^ or ** may be substituted for exp without change of function. INDEX

SEC _ _ _ _ _ _ _ _ _ _ _ _ operator

The sec operator returns the secant of its argument.

### syntax:

sec(<expression>) or sec <simple\_expression>

<expression> is any valid scalar REDUCE expression, <simple\_expression> is a single identifier or begins with a prefix operator name.

### examples:

```

sec abc;

SEC(ABC)

sec(pi);

-1

sec 4;

SEC(4)

on rounded;

sec(4);

- 1.52988565647

sec log 5;

- 25.8852966005

```

secreturns a numeric value only if rounded is on. Then the secant is calculated to the current degree of floating point precision. INDEX

SECH _ _ _ _ _ _ _ _ _ _ _ _ operator

The sech operator returns the hyperbolic secant of its argument.

### syntax:

sech(<expression>) or sech <simple\_expression>

<expression> is any valid scalar REDUCE expression, <simple\_expression> is a single identifier or begins with a prefix operator name.

### examples:

```
sech abc;

SECH(ABC)

sech(0);

1

sech 4;

SECH(4)

on rounded;

sech(4);

0.0366189934737

sech log 5;

0.384615384615

```

sechreturns a numeric value only if rounded is on. Then the expression is calculated to the current degree of floating point precision. INDEX

SIN _ _ _ _ _ _ _ _ _ _ _ _ operator

The sin operator returns the sine of its argument.

### syntax:

sin(<expression>) or sin <simple\_expression>

<expression> is any valid scalar REDUCE expression, <simple\_expression> is a single identifier or begins with a prefix operator name.

### examples:

```
sin aa;

SIN(AA)

sin(pi/2);

1

on rounded;

sin 3;

0.14112000806

sin(pi/2);

1.0

```

sinreturns a numeric value only if rounded is on . Then the sine is calculated to the current degree of floating point precision. The argument in this case is assumed to be in radians. INDEX

SINH _ _ _ _ _ _ _ _ _ _ _ _ operator

The sinh operator returns the hyperbolic sine of its argument. The derivative of sinh and some simple transformations are known to the system.

### syntax:

sinh(<expression>) or sinh <simple\_expression>

<expression> may be any scalar REDUCE expression, not an array, matrix or vector expression. <simple\_expression> must be a single identifier or begin with a prefix operator name.

### examples:

```

sinh b;

SINH(B)

sinh(0);

0

df(sinh(x**2),x);

2
2*COSH(X )*X

int(sinh(4*x),x);

COSH(4*X)
---------
4

on rounded;

sinh 4;

27.2899171971

```

You may attach further functionality by defining its inverse (see asinh). A numeric value is not returned by sinh unless the switch rounded is on and its argument evaluates to a number. INDEX

TAN _ _ _ _ _ _ _ _ _ _ _ _ operator

The tan operator returns the tangent of its argument.

### syntax:

tan(<expression>) or tan <simple\_expression>

<expression> is any valid scalar REDUCE expression, <simple\_expression> is a single identifier or begins with a prefix operator name.

### examples:

```
tan a;

TAN(A)

tan(pi/5);

PI
TAN(--)
5

on rounded;
tan(pi/5);

0.726542528005

```

tanreturns a numeric value only if rounded is on . Then the tangent is calculated to the current degree of floating point accuracy.

When rounded is on, no check is made to see if the argument of tan is a multiple of pi/2, for which the tangent goes to positive or negative infinity. (Of course, since REDUCE uses a fixed-point representation of pi/2, it produces a large but not infinite number.) You need to make a check for multiples of pi/2 in any program you use that might possibly ask for the tangent of such a quantity. INDEX

TANH _ _ _ _ _ _ _ _ _ _ _ _ operator

The tanh operator returns the hyperbolic tangent of its argument. The derivative of tanh and some simple transformations are known to the system.

### syntax:

tanh(<expression>) or tanh <simple\_expression>

<expression> may be any scalar REDUCE expression, not an array, matrix or vector expression. <simple\_expression> must be a single identifier or begin with a prefix operator name.

### examples:

```
tanh b;

TANH(B)

tanh(0);

0

df(tanh(x*y),x);

2
Y*( - TANH(X*Y)  + 1)

int(tanh(x),x);

2*X
LOG(E    + 1) - X

on rounded; tanh 2;

0.964027580076

```

You may attach further functionality by defining its inverse (see atanh). A numeric value is not returned by tanh unless the switch rounded is on and its argument evaluates to a number. INDEX

Elementary Functions

• ACOS operator

• ACOSH operator

• ACOT operator

• ACOTH operator

• ACSC operator

• ACSCH operator

• ASEC operator

• ASECH operator

• ASIN operator

• ASINH operator

• ATAN operator

• ATANH operator

• ATAN2 operator

• COS operator

• COSH operator

• COT operator

• COTH operator

• CSC operator

• CSCH operator

• ERF operator

• EXP operator

• SEC operator

• SECH operator

• SIN operator

• SINH operator

• TAN operator

• TANH operator

• SWITCHES INDEX

SWITCHES _ _ _ _ _ _ _ _ _ _ _ _ introduction

Switches are set on or off using the commands on or off, respectively. The default setting of the switches described in this section is off unless stated otherwise. INDEX

ALGINT _ _ _ _ _ _ _ _ _ _ _ _ switch

When the algint switch is on, the algebraic integration module (which must be loaded from the REDUCE library) is used for integration.

Loading algint from the library automatically turns on the algint switch. An error message will be given if algint is turned on when the algint has not been loaded from the library. INDEX

ALLBRANCH _ _ _ _ _ _ _ _ _ _ _ _ switch

When allbranch is on, the operator solve selects all branches of solutions. When allbranch is off, it selects only the principal branches. Default is on.

### examples:

```

solve(log(sin(x+3)),x);

{X=2*ARBINT(1)*PI - ASIN(1) - 3,
X=2*ARBINT(1)*PI + ASIN(1) + PI - 3}

off allbranch;

solve(log(sin(x+3)),x);

X=ASIN(1) - 3

```

arbint(1) indicates an arbitrary integer, whi ch is given a unique identifier by REDUCE, showing that there are infinitely many solutions of this type. When allbranch is off, the single canonical solution is given. INDEX

ALLFAC _ _ _ _ _ _ _ _ _ _ _ _ switch

The allfac switch, when on, causes REDUCE to factor out automatically common products in the output of expressions. Default is on.

### examples:

```
x + x*y**3 + x**2*cos(z);

3
X*(COS(Z)*X + Y   + 1)

off allfac;

x + x*y**3 + x**2*cos(z);

2      3
COS(Z)*X  + X*Y   + X

```

The allfac switch has no effect when pri is off. Although the switch setting stays as it was, printing behavior is as if it were off. INDEX

ARBVARS _ _ _ _ _ _ _ _ _ _ _ _ switch

When arbvars is on, the solutions of singular or underdetermined systems of equations are presented in terms of arbitrary complex variables (see arbcomplex). Otherwise, the solution is param etrized in terms of some of the input variables. Default is on.

### examples:

```
solve({2x + y,4x + 2y},{x,y});

arbcomplex(1)
{{x= - -------------,y=arbcomplex(1)}}
2

solve({sqrt(x)+ y**3-1},{x,y});

6       3
{{y=arbcomplex(2),x=y   - 2*y   + 1}}

off arbvars;

solve({2x + y,4x + 2y},{x,y});

y
{{x= - -}}
2

solve({sqrt(x)+ y**3-1},{x,y});

6       3
{{x=y   - 2*y   + 1}}

```

With arbvars off, the return value {{}} means th at the equations given to solve imply no relation among the input variables. INDEX

BALANCED\_MOD _ _ _ _ _ _ _ _ _ _ _ _ switch

modularnumbers are normally produced in the r ange [0,...<n>), where <n> is the current modulus. With balanced_mod on, the range [-<n>/2,<n>/2], or more precisely [-floor((<n>-1)/2), ceiling((<n>-1)/2)], is used instead.

### examples:

```
setmod 7;

1

on modular;

4;

4

on balanced_mod;

4;

-3

``` INDEX

BFSPACE _ _ _ _ _ _ _ _ _ _ _ _ switch

Floating point numbers are normally printed in a compact notation (either fixed point or in scientific notation if 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 bfspace, if on, will cause a blank to be inserted in the number after every five characters.

### examples:

```
on rounded;

1.2345678;

1.2345678

on bfspace;

1.2345678;

1.234 5678

```

bfspaceis normally off. INDEX

COMBINEEXPT _ _ _ _ _ _ _ _ _ _ _ _ switch

REDUCE is in general poor at surd simplification. However, when the switch combineexpt is on, the system attempts to combine exponentials whenever possible.

### examples:

```
3^(1/2)*3^(1/3)*3^(1/6);

1/3  1/6
SQRT(3)*3   *3

on combineexpt;

ws;

1

``` INDEX

COMBINELOGS _ _ _ _ _ _ _ _ _ _ _ _ switch

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 expandlogs and combinelogs to carry out these operations.

### examples:

```
on expandlogs;

log(x*y);

LOG(X) + LOG(Y)

on combinelogs;

ws;

LOG(X*Y)

```

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. INDEX

COMP _ _ _ _ _ _ _ _ _ _ _ _ switch

When comp is on, any succeeding function definitions are compiled into a faster-running form. Default is off.

### examples:

The following procedure finds Fibonacci numbers recurs ively. Create a new file ``refib" in your current directory with the following lines in it:

```

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;

```

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

```

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 time on as shown above, the CPU time used in executing the command is returned in milliseconds. Be careful not to leave comp on unless you want it, as it makes the processing of procedures much slower. INDEX

COMPLEX _ _ _ _ _ _ _ _ _ _ _ _ switch

When the complex switch is on, full complex arithmetic is used in simplification, function evaluation, and factorization. Default is off.

### examples:

```

factorize(a**2 + b**2);

2     2
{{A   + B ,1}}

on complex;

factorize(a**2 + b**2);

{{A + I*B,1},{A - I*B,1}}

(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

```

Complex floating-point can be done by turning on rounded in addition to complex. With complex off however, REDUCE knows that i is the square root of -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 rationalize. INDEX

CREF _ _ _ _ _ _ _ _ _ _ _ _ switch

The switch 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, 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 cref off will cause a cross-reference listing to be produced.

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 aeval. INDEX

CRAMER _ _ _ _ _ _ _ _ _ _ _ _ switch

When the cramer switch is on, matrix inversion and linear equation solving (operator solve) is done by Cramer's rule, through exte rior multiplication. Default is off.

### examples:

```
on time;

Time: 80 ms

off output;

Time: 100 ms

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));

Time: 300 ms

inverse := 1/mm;

Time: 18460 ms

on cramer;

Time: 80 ms

cramersinv := 1/mm;

Time: 9260 ms

```

Your time readings will vary depending on the REDUCE version you u se. After you invert the matrix, turn on output and ask for one of the elements of the inverse matrix, such as 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 cramer on. However, inversion of numeric-valued matrices is slower. Consider the matrices you're inverting before deciding whether to turn 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 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. INDEX

DEFN _ _ _ _ _ _ _ _ _ _ _ _ switch

When the switch defn is on, the Standard Lisp equivalent of the input statement or procedure is printed, but not evaluated. Default is off.

### examples:

```

on defn;

17/3;

(AEVAL (LIST 'QUOTIENT 17 3))

df(sin(x),x,2);

(AEVAL (LIST 'DF (LIST 'SIN 'X) 'X 2))

procedure coshval(a);
begin scalar g;
g := (exp(a) + exp(-a))/2;
return g
end;

(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)))) )

coshval(1);

(AEVAL (LIST 'COSHVAL 1))

off defn;

coshval(1);

Declare COSHVAL operator? (Y or N)

n

procedure coshval(a);
begin scalar g;
g := (exp(a) + exp(-a))/2;
return g
end;

COSHVAL

on rounded;

coshval(1);

1.54308063482

```

The above function coshval finds the hyperbolic cosine (c osh) of its argument. When 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 Declare COSHVAL operator?. It must be reentered with defn off to be recognized. This procedure is used as an example; a more efficient procedure would eliminate the unnecessary local variable with

```
procedure coshval(a);
(exp(a) + exp(-a))/2;
``` INDEX

DEMO _ _ _ _ _ _ _ _ _ _ _ _ switch

The demo switch is used for interactive files, causing the system to pause after each command in the file until you type a Return. Default is off.

The switch 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 on demo command in the file, or enter it from the top level before bringing in any file. Unlike the pause command, on demo does not perm it you to interrupt the file for questions of your own. INDEX

DFPRINT _ _ _ _ _ _ _ _ _ _ _ _ switch

When dfprint is on, expressions in the differentiation operator df are printed in a more ``natural'' notation , with the differentiation variables appearing as subscripts. In addition, if the switch noarg is on (the default), the arguments of t he differentiated operator are suppressed.

### examples:

```
operator f;

df(f x,x);

DF(F(X),X);

on dfprint;

ws;

F
X

df(f(x,y),x,y);

F
Y

off noarg;

ws;

F(X,Y)
X

``` INDEX

DIV _ _ _ _ _ _ _ _ _ _ _ _ switch

When div is on, the system divides any simple factors found in the denominator of an expression into the numerator. Default is off.

### examples:

```

on div;

a := x**2/y**2;

2   -2
A := X  *Y

b := a/(3*z);

1  2   -2    -1
B := -*X  *Y    *Z
3

off div;

a;

2
X
---
2
Y

b;

2
X
-------
2
3*Y  *Z

```

The div switch only has effect when the pri switch is on. When pri is off, regardless of the setting of div, the printing behavior is as if div were off. INDEX

ECHO _ _ _ _ _ _ _ _ _ _ _ _ switch

The echo switch is normally off for top-level entry, and on when files are brought in. If echo is turned on at the top level, your input statements are echoed to the screen (thus appearing twice). Default off (but note default on for files).

If you want to display certain portions of a file and not others, use the commands off echo and on echo inside the file. If you want no display of the file, use the input command

in filename\$

rather than using the semicolon delimiter.

Be careful when you use commands within a file to generate another file. Since echo is on for files, the output file echoes input statements (unlike its behavior from the top level). You should explicitly turn off echo when writing output, and turn it back on when you're done. INDEX

ERRCONT _ _ _ _ _ _ _ _ _ _ _ _ switch

When the errcont switch is on, error conditions do not stop file execution. Error messages will be printed whether errcont is on or off.

Default is off.

The following describes what happens when an error occurs in a file under each setting of errcont and int:

Both off: Message is printed and parsing continues, but no further statements are executed; no commands from keyboard accepted except bye or end;

errcontoff, int on: Message is printed, and you are asked if you wish to continue. (This is the default behavior);

errconton, int off: Message is printed, and file continues to execute without pause;

Both on: Message is printed, and file continues to execute without pause. INDEX

EVALLHSEQP _ _ _ _ _ _ _ _ _ _ _ _ switch

Under normal circumstances, the right-hand-side of an equation is evaluated but not the left-hand-side. This also applies to any substitutions made by the sub operator. If both sides are to be evaluated, the switch evallhseqp should be turned on. INDEX

EXP _ _ _ _ _ _ _ _ _ _ _ _ switch

When the exp switch is on, powers and products of expressions are expanded. Default is on.

### examples:

```
(x+1)**3;

3      2
X  + 3*X  + 3*X + 1

(a + b*i)*(c + d*i);

A*C + A*D*I + B*C*I - B*D

off exp;

(x+1)**3;

3
(X + 1)

(a + b*i)*(c + d*i);

(A + B*I)*(C + D*I)

length((x+1)**2/(y+1));

2

```

Note that REDUCE knows that i^2 = -1. When 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 exp is off, such as length. Be cautious about leaving exp off. INDEX

EXPANDLOGS _ _ _ _ _ _ _ _ _ _ _ _ switch

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 expandlogs and combinelogs to carry out these operations. Bo th are off by default.

### examples:

```
on expandlogs;

log(x*y);

LOG(X) + LOG(Y)

on combinelogs;

ws;

LOG(X*Y)

```

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. INDEX

EZGCD _ _ _ _ _ _ _ _ _ _ _ _ switch

When ezgcd and gcd are on, greatest common divisors are computed using the EZ GCD algorithm that uses modular arithmetic (and is usually faster). Default is off.

As a side effect of the gcd calculation, the expressions involved are factored, though not the heavy-duty factoring of factorize. The EZ GCD algorithm was introduced in a paper by J. Moses and D.Y.Y. Yun in <Proceedings of the ACM>, 1973, pp. 159-166.

Note that the gcd switch must also be on for ezgcd to have effect. INDEX

FACTOR _ _ _ _ _ _ _ _ _ _ _ _ switch

When the factor switch is on, input expressions and results are automatically factored.

### 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;

2
AA := (A + B)*(3*X  + Y)*(X + 2*Y)

off factor;

aa;

3        2                  2         3        2
3*A*X  + 6*A*X *Y + A*X*Y + 2*A*Y   + 3*B*X  + 6*B*X *Y

+ B*X*Y + 2*B*Y^{2}

on factor;

ab := x**2 - 2;

2
AB := X  - 2

```

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 factor switch is turned on, the exp switch is turned off, and when the factor switch is turned off, the exp switch is turned on, whether it was on pr eviously or not.

When the switch trfac is on, informative messages are generat ed at each call to the factorizer. The trallfac switch causes the production of a more verbose trace message. It takes precedence over trfac if they are both on.

To factor a polynomial explicitly and store the results, use the operator factorize. INDEX

FAILHARD _ _ _ _ _ _ _ _ _ _ _ _ switch

When the failhard switch is on, the integration operator int terminates with an error message if the integral cannot be done in closed terms. Default is off.

Use the 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. INDEX

FORT _ _ _ _ _ _ _ _ _ _ _ _ switch

When fort is on, output is given Fortran-compatible syntax. Default is off.

### 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))

```

REDUCE results can be written to a file (using out) and used as data by Fortran programs when fort is in effect. fort knows about correct statement length, continuation characters, defining a symbol when it is first used, and other Fortran details.

The GENTRAN package offers many more possibilitie s than the fort switch. It produces Fortran (or C or Ratfor) code from REDUCE procedures or structured specifications, including facilities for producing double precision output. INDEX

FORTUPPER _ _ _ _ _ _ _ _ _ _ _ _ switch

When fortupper is on, any Fortran-style output appears in upper case. Default is off.

### 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)

``` INDEX

FULLPREC _ _ _ _ _ _ _ _ _ _ _ _ switch

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 fullprec can be turned on.

### examples:

```
on rounded;

1/2;

0.5

on fullprec;

ws;

0.500000000000

```

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 scientific_notation. INDEX

FULLROOTS _ _ _ _ _ _ _ _ _ _ _ _ switch

Since roots of cubic and quartic polynomials can often be very messy, a switch fullroots controls the production of results in closed form. solve will apply the formulas for explicit forms for degrees 3 and 4 only if fullroots is on. Otherwise the result forms are built using root_of. Default is off. INDEX

GC _ _ _ _ _ _ _ _ _ _ _ _ switch

With the 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.

See reclaim for an explanation of garbage collect ion. REDUCE does garbage collection when needed even if you have turned the notices off. INDEX

GCD _ _ _ _ _ _ _ _ _ _ _ _ switch

When gcd is on, common factors in numerators and denominators of expressions are canceled. Default is off.

### examples:

```

(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);

2  2    2          2  2      2        3      3    4
F *G  + F *G*H - 2*F *H  - F*G *H + F*H  - G*H  + H
----------------------------------------------------
2      2        2                2    2        2
F *G - F *H + F*G  - 2*F*G*H + F*H  - G *H + G*H

on gcd;

ws;

2
F*G + 2*F*H + H
----------------
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)

```

Even with gcd off, a check is automatically made for comm on variable and numerical products in the numerators and denominators of expression, and the appropriate cancellations made. Thus the example demonstrating the use of gcd is somewhat complicated. Note when exp is off, gcd has the side effect of factoring the expression. INDEX

HORNER _ _ _ _ _ _ _ _ _ _ _ _ switch

When the horner switch is on, polynomial expressions are printed in Horner's form for faster and safer numerical evaluation. Default is off. The leading variable of the expression is selected as Horner variable. To select the Horner variable explicitly use the korder declaration.

### examples:

```
on horner;

(13p-4q)^3;

3            2
( - 64)*q   + p*(624*q   + p*(( - 2028)*q + p*2197))

korder q;

ws;

3                  2
2197*p   + q*(( - 2028)*p   + q*(624*p + q*(-64)))

``` INDEX

IFACTOR _ _ _ _ _ _ _ _ _ _ _ _ switch

When the ifactor switch is on, any integer terms appearing as a result of the factorize command are factored themselves int o primes. Default is off. If the argument of factorize is an integer, ifactor has no effect, since the integer is always factored.

### examples:

```
factorize(4*x**2 + 28*x + 48);

{{4,1},{X + 4,1},{X + 3,1}}

factorize(22587);

{{3,1},{7529,1}}

on ifactor;

factorize(4*x**2 + 28*x + 48);

{{2,2},{X + 4,1},{X + 3,1}}

factorize(22587);

{{3,1},{7529,1}}

```

Constant terms that appear within nonconstant polynomial factors are not factored.

The ifactor switch affects only factoring done specifically with factorize, not on factoring done automaticall y when the factor switch is on. INDEX

INT _ _ _ _ _ _ _ _ _ _ _ _ switch

The int switch specifies an interactive mode of operation. Default on.

There is no reason to turn int off during interactive calculations, since there are no benefits to be gained. If you do have 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 end; or bye; from the keyboard; everything else is ignored, even the command on int. INDEX

INTSTR _ _ _ _ _ _ _ _ _ _ _ _ switch

If intstr (for ``internal structure'') is on, arguments of an operator are printed in a more structured form.

### examples:

```
operator f;

f(2x+2y);

F(2*X + 2*Y)

on intstr;

ws;

F(2*(X + Y))

``` INDEX

LCM _ _ _ _ _ _ _ _ _ _ _ _ switch

The lcm switch instructs REDUCE to compute the least common multiple of denominators whenever rational expressions occur. Default is on.

### examples:

```
off lcm;

z := 1/(x**2 - y**2) + 1/(x-y)**2;

2*X*(X - Y)
Z := -------------------------
4      3          3    4
X  - 2*X *Y + 2*X*Y  - Y

on lcm;

z;

2*X*(X - Y)
-------------------------
4      3          3    4
X  - 2*X *Y + 2*X*Y  - Y

zz := 1/(x**2 - y**2) + 1/(x-y)**2;

2*X
ZZ := ---------------------
3    2        2    3
X  - X *Y - X*Y  + Y

on gcd;

z;

2*X
----------------------
3    2        2    3
X  - X *Y - X*Y  + Y

```

Note that lcm has effect only when rational expressions a re first combined. It does not examine existing structures for simplifications on display. That is shown above when z is entered with lcm off. It remains unsimplified even after lcm is turned back on. However, a new variable containing the same expression is simplified on entry. The switch 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 lcm switch.