File r38/lisp/csl/r38.doc/r38_0250.html artifact 887b6e516e part of check-in 52fc28dabe



<a name=r38_0250>

<title>COSH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COSH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>cosh</em> operator returns the hyperbolic cosine of its argument. 
The derivative of <em>cosh</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>cosh</em>(&lt;expression&gt;) or <em>cosh</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression, not an array, matrix or 

vector expression. &lt;simple\_expression&gt; must be a single identifier or 
begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

cosh b; 

  COSH(B) 



cosh(0); 

  1 



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

  SINH(X*Y)*Y 



int(cosh(x),x); 

  SINH(X)

</tt></pre><p>You may attach further functionality by defining its inverse (see 


<a href=r38_0200.html#r38_0237>acosh</a>). 
A numeric value is not returned by <em>cosh</em> unless the switch 

<a href=r38_0300.html#r38_0330>rounded</a> is on and its argument evaluates to a
 number. 
<P>
<P>
<P>
<P>

<a name=r38_0251>

<title>COT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
<em>cot</em> represents the cotangent of its argument. It takes an arbitrary 
scalar expression as its argument. The derivative of <em>acot</em> and some 
simple properties are known to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>cot</em>(&lt;expression&gt;) or <em>cot</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression. &lt;simple\_expression
&gt; 
must be a single identifier or begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
cot(a)*tan(a); 

  COT(A)*TAN(A)) 


cot(1); 

  COT(1) 


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

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

</tt></pre><p>Numerical values of expressions involving <em>cot</em> may be foun
d by 
turning on the switch 
<a href=r38_0300.html#r38_0330>rounded</a>. 
<P>
<P>
<P>
<P>

<a name=r38_0252>

<title>COTH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COTH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>coth</em> operator returns the hyperbolic cotangent of its argument. 
The derivative of <em>coth</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>coth</em>(&lt;expression&gt;) or <em>coth</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression. &lt;simple\_expression
&gt; 
must be a single identifier or begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
df(coth(x*y),x); 

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



coth acoth z; 

  Z

</tt></pre><p>You can write 
<a href=r38_0150.html#r38_0199>let</a> statements and procedures to add further 

functionality to <em>coth</em> if you wish. Numerical values of expressions 
involving <em>coth</em> may also be found by turning on the switch 

<a href=r38_0300.html#r38_0330>rounded</a>. 
<P>
<P>
<P>
<P>

<a name=r38_0253>

<title>CSC</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>CSC</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>csc</em> operator returns the cosecant of its argument. 
The derivative of <em>csc</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>csc</em>(&lt;expression&gt;) or <em>csc</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression. &lt;simple\_expression
&gt; 
must be a single identifier or begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

csc(q)*sin(q); 

  CSC(Q)*SIN(Q) 



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

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

</tt></pre><p>You can write 
<a href=r38_0150.html#r38_0199>let</a> statements and procedures to add further 

functionality to <em>csc</em> if you wish. Numerical values of expressions 
involving <em>csc</em> may also be found by turning on the switch 

<a href=r38_0300.html#r38_0330>rounded</a>. 
<P>
<P>
<P>
<P>

<a name=r38_0254>

<title>CSCH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>CSCH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>cosh</em> operator returns the hyperbolic cosecant of its argument. 
The derivative of <em>csch</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>csch</em>(&lt;expression&gt;) or <em>csch</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression, not an array, matrix or 

vector expression. &lt;simple\_expression&gt; must be a single identifier or 
begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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)

</tt></pre><p>A numeric value is not returned by <em>csch</em> unless the switch
 

<a href=r38_0300.html#r38_0330>rounded</a> is on and its argument evaluates to a
 number. 
<P>
<P>
<P>

<a name=r38_0255>

<title>ERF</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ERF</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>erf</em> operator represents the error function, defined by 
<P>
<P>
erf(x) = (2/sqrt(pi))*int(e^(-x^2),x) 
<P>
<P>
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. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>
<a name=r38_0256>

<title>EXP</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>EXP</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>exp</em> operator returns <em>e</em> raised to the power of its argument
. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>exp</em>(&lt;expression&gt;) or <em>exp</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; can be any valid REDUCE scalar expression. 
&lt;simple\_expression&gt; must be a single identifier or begin with a 
prefix operator. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
exp(sin(x)); 

   SIN X
  E      


exp(11); 

   11
  E   


on rounded; 

exp sin(pi/3); 

  2.37744267524

</tt></pre><p>Numeric values are returned only when <em>rounded</em> is on. 
The single letter <em>e</em> with the exponential operator <em>^</em> or 
<em>**</em> may be substituted for <em>exp</em> without change of function. 
<P>
<P>
<P>

<a name=r38_0257>

<title>SEC</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>SEC</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
The <em>sec</em> operator returns the secant of its argument. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>sec</em>(&lt;expression&gt;) or <em>sec</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; is any valid scalar REDUCE expression, 
&lt;simple\_expression&gt; is a single identifier or begins with a prefix 
operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>


sec abc; 

  SEC(ABC) 



sec(pi); 

  -1 



sec 4; 

  SEC(4) 



on rounded; 


sec(4); 

  - 1.52988565647 



sec log 5; 

  - 25.8852966005

</tt></pre><p><em>sec</em>returns a numeric value only if 
<a href=r38_0300.html#r38_0330>rounded</a> is on. Then the 
secant is calculated to the current degree of floating point precision. 
<P>
<P>
<P>

<a name=r38_0258>

<title>SECH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>SECH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>sech</em> operator returns the hyperbolic secant of its argument. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>sech</em>(&lt;expression&gt;) or <em>sech</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; is any valid scalar REDUCE expression, 
&lt;simple\_expression&gt; is a single identifier or begins with a prefix 
operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
sech abc; 

  SECH(ABC) 



sech(0); 

  1 



sech 4; 

  SECH(4) 



on rounded; 


sech(4); 

  0.0366189934737 



sech log 5; 

  0.384615384615

</tt></pre><p><em>sech</em>returns a numeric value only if 
<a href=r38_0300.html#r38_0330>rounded</a> is on. Then the 
expression is calculated to the current degree of floating point precision. 
<P>
<P>
<P>

<a name=r38_0259>

<title>SIN</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>SIN</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>sin</em> operator returns the sine of its argument. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>sin</em>(&lt;expression&gt;) or <em>sin</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; is any valid scalar REDUCE expression, 
&lt;simple\_expression&gt; is a single identifier or begins with a prefix 
operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
sin aa; 

  SIN(AA) 


sin(pi/2); 

  1 


on rounded; 

sin 3; 

  0.14112000806 


sin(pi/2); 

  1.0

</tt></pre><p><em>sin</em>returns a numeric value only if <em>rounded</em> 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. 
<P>
<P>
<P>

<a name=r38_0260>

<title>SINH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>SINH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>sinh</em> operator returns the hyperbolic sine of its argument. 
The derivative of <em>sinh</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>sinh</em>(&lt;expression&gt;) or <em>sinh</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression, not an array, matrix or 

vector expression. &lt;simple\_expression&gt; must be a single identifier or 
begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>You may attach further functionality by defining its inverse (see 


<a href=r38_0200.html#r38_0245>asinh</a>). 
A numeric value is not returned by <em>sinh</em> unless the switch 

<a href=r38_0300.html#r38_0330>rounded</a> is on and its argument evaluates to a
 number. 
<P>
<P>
<P>

<a name=r38_0261>

<title>TAN</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>TAN</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
The <em>tan</em> operator returns the tangent of its argument. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>tan</em>(&lt;expression&gt;) or <em>tan</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
<P>
&lt;expression&gt; is any valid scalar REDUCE expression, 
&lt;simple\_expression&gt; is a single identifier or begins with a prefix 
operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
tan a; 

  TAN(A) 


tan(pi/5); 

      PI
  TAN(--) 
      5


on rounded;
tan(pi/5); 

  0.726542528005

</tt></pre><p><em>tan</em>returns a numeric value only if <em>rounded</em> is on
. Then the 
tangent is calculated to the current degree of floating point accuracy. 
<P>
<P>
When 
<a href=r38_0300.html#r38_0330>rounded</a> is on, 
no check is made to see if the argument of <em>tan</em> 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. 
<P>
<P>
<P>

<a name=r38_0262>

<title>TANH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>TANH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>operator</b><P>
<P>
 
 <P>
<P>
The <em>tanh</em> operator returns the hyperbolic tangent of its argument. 
The derivative of <em>tanh</em> and some simple transformations are known 
to the system. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>tanh</em>(&lt;expression&gt;) or <em>tanh</em> &lt;simple\_expression&gt; 
<P>
<P>
<P>
&lt;expression&gt; may be any scalar REDUCE expression, not an array, matrix or 

vector expression. &lt;simple\_expression&gt; must be a single identifier or 
begin with a prefix operator name. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>You may attach further functionality by defining its inverse (see 


<a href=r38_0200.html#r38_0247>atanh</a>). 
A numeric value is not returned by <em>tanh</em> unless the switch 

<a href=r38_0300.html#r38_0330>rounded</a> is on and its argument evaluates to a
 number. 
<P>
<P>
<P>

<a name=r38_0263>

<title>Elementary Functions</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>
<b>Elementary Functions</b><menu>
<li><a href=r38_0200.html#r38_0236>ACOS operator</a><P>
<li><a href=r38_0200.html#r38_0237>ACOSH operator</a><P>
<li><a href=r38_0200.html#r38_0238>ACOT operator</a><P>
<li><a href=r38_0200.html#r38_0239>ACOTH operator</a><P>
<li><a href=r38_0200.html#r38_0240>ACSC operator</a><P>
<li><a href=r38_0200.html#r38_0241>ACSCH operator</a><P>
<li><a href=r38_0200.html#r38_0242>ASEC operator</a><P>
<li><a href=r38_0200.html#r38_0243>ASECH operator</a><P>
<li><a href=r38_0200.html#r38_0244>ASIN operator</a><P>
<li><a href=r38_0200.html#r38_0245>ASINH operator</a><P>
<li><a href=r38_0200.html#r38_0246>ATAN operator</a><P>
<li><a href=r38_0200.html#r38_0247>ATANH operator</a><P>
<li><a href=r38_0200.html#r38_0248>ATAN2 operator</a><P>
<li><a href=r38_0200.html#r38_0249>COS operator</a><P>
<li><a href=r38_0250.html#r38_0250>COSH operator</a><P>
<li><a href=r38_0250.html#r38_0251>COT operator</a><P>
<li><a href=r38_0250.html#r38_0252>COTH operator</a><P>
<li><a href=r38_0250.html#r38_0253>CSC operator</a><P>
<li><a href=r38_0250.html#r38_0254>CSCH operator</a><P>
<li><a href=r38_0250.html#r38_0255>ERF operator</a><P>
<li><a href=r38_0250.html#r38_0256>EXP operator</a><P>
<li><a href=r38_0250.html#r38_0257>SEC operator</a><P>
<li><a href=r38_0250.html#r38_0258>SECH operator</a><P>
<li><a href=r38_0250.html#r38_0259>SIN operator</a><P>
<li><a href=r38_0250.html#r38_0260>SINH operator</a><P>
<li><a href=r38_0250.html#r38_0261>TAN operator</a><P>
<li><a href=r38_0250.html#r38_0262>TANH operator</a><P>
</menu>
<a name=r38_0264>

<title>SWITCHES</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>SWITCHES</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>introduction</b><P>
<P>
 
Switches are set on or off using the commands 
<a href=r38_0200.html#r38_0210>on</a> or 

<a href=r38_0200.html#r38_0209>off</a>, respectively. 
The default setting of the switches described in this section is 

<a href=r38_0200.html#r38_0209>off</a> unless stated otherwise. 
<P>
<P>

<a name=r38_0265>

<title>ALGINT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ALGINT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>algint</em> switch is on, the algebraic integration module (which 
must be loaded from the REDUCE library) is used for integration. 
<P>
<P>
Loading <em>algint</em> from the library automatically turns on the 
<em>algint</em> switch. An error message will be given if <em>algint</em> is 
turned on when the <em>algint</em> has not been loaded from the library. 
<P>
<P>
<P>

<a name=r38_0266>

<title>ALLBRANCH</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ALLBRANCH</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
When <em>allbranch</em> is on, the operator 
<a href=r38_0150.html#r38_0179>solve</a> selects all 
branches of solutions. 
When <em>allbranch</em> is off, it selects only the principal 
branches. Default is <em>on</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>
<a href=r38_0100.html#r38_0138>arbint</a>(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 <em>allbranch</em> is off, the single 
canonical solution is given. 
<P>
<P>
<P>

<a name=r38_0267>

<title>ALLFAC</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ALLFAC</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The <em>allfac</em> switch, when on, causes REDUCE to factor out automatically 
common products in the output of expressions. Default is <em>on</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>The <em>allfac</em> switch has no effect when <em>pri</em> is off.
 Although the 
switch setting stays as it was, printing behavior is as if it were off. 
<P>
<P>
<P>

<a name=r38_0268>

<title>ARBVARS</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ARBVARS</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>arbvars</em> is on, the solutions of singular or underdetermined 
systems of equations are presented in terms of arbitrary complex variables 
(see 
<a href=r38_0100.html#r38_0139>arbcomplex</a>). Otherwise, the solution is param
etrized in 
terms of some of the input variables. Default is <em>on</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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}} 

</tt></pre><p>With <em>arbvars</em> off, the return value <em>{{}}</em> means th
at the 
equations given to 
<a href=r38_0150.html#r38_0179>solve</a> imply no relation among the input 
variables. 
<P>
<P>
<P>

<a name=r38_0269>

<title>BALANCED_MOD</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>BALANCED\_MOD</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>

<a href=r38_0300.html#r38_0305>modular</a>numbers are normally produced in the r
ange [0,...&lt;n&gt;), 
where 
&lt;n&gt; is the current modulus. With <em>balanced_mod</em> on, the range 
[-&lt;n&gt;/2,&lt;n&gt;/2], or more precisely 
[-floor((&lt;n&gt;-1)/2), ceiling((&lt;n&gt;-1)/2)], is used instead. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
setmod 7; 

  1 


on modular; 

4; 

  4 


on balanced_mod; 

4; 

  -3

</tt></pre><p>
<a name=r38_0270>

<title>BFSPACE</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>BFSPACE</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
Floating point numbers are normally printed in a compact notation (either 
fixed point or in scientific notation if 
<a href=r38_0200.html#r38_0219>SCIENTIFIC_NOTATION</a> 
has been used). In some (but not all) cases, it helps comprehensibility 
if spaces are inserted in the number at regular intervals. The switch 
<em>bfspace</em>, if on, will cause a blank to be inserted in the number after 
every five characters. 
 <P> <H3> 
examples: </H3>
<p><pre><tt>
on rounded; 

1.2345678; 

  1.2345678 


on bfspace; 

1.2345678; 

  1.234 5678

</tt></pre><p><P>
<P>
<em>bfspace</em>is normally off. 
<P>
<P>
<P>

<a name=r38_0271>

<title>COMBINEEXPT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COMBINEEXPT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
REDUCE is in general poor at surd simplification. However, when the 
switch <em>combineexpt</em> is on, the system attempts to combine 
exponentials whenever possible. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
3^(1/2)*3^(1/3)*3^(1/6); 

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


on combineexpt; 

ws; 

  1

</tt></pre><p>
<a name=r38_0272>

<title>COMBINELOGS</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COMBINELOGS</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
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 
<a href=r38_0250.html#r38_0285>expandlogs</a> and 
<em>combinelogs</em> to carry out these operations. 
 <P> <H3> 
examples: </H3>
<p><pre><tt>
on expandlogs; 

log(x*y); 

  LOG(X) + LOG(Y) 


on combinelogs; 

ws; 

  LOG(X*Y)

</tt></pre><p><P>
<P>
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. 
<P>
<P>
<P>

<a name=r38_0273>

<title>COMP</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COMP</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>comp</em> is on, any succeeding function definitions are compiled 
into a faster-running form. Default is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt></tt></pre><p>The following procedure finds Fibonacci numbers recurs
ively. 
Create a new file ``refib&quot; in your current directory with the following 
lines in it:<p><pre><tt> 

procedure refib(n);
   if fixp n and n &gt;= 0 then
     if n &lt;= 1 then 1
       else refib(n-1) + refib(n-2)
    else rederr &quot;nonnegative integer only&quot;;

end;

</tt></pre><p>Now load REDUCE and run the following:<p><pre><tt>

on time; 

  Time: 100 ms 



in &quot;refib&quot;$ 

  Time: 0 ms 



 

  REFIB 



 

  Time: 260 ms 



 

  Time: 20 ms 



refib(80); 

  37889062373143906 



 

  Time: 14840 ms 



on comp; 

  Time: 80 ms 



in &quot;refib&quot;$ 

  Time: 20 ms 



 

  REFIB 



 

  Time: 640 ms 



refib(80); 

  37889062373143906 



 

  Time: 10940 ms

</tt></pre><p> 
<P>
<P>
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 
<a href=r38_0300.html#r38_0333>time</a> on 
as shown above, the CPU time used in executing the command is returned in 
milliseconds. Be careful not to leave <em>comp</em> on unless you want it, 
as it makes the processing of procedures much slower. 
<P>
<P>
<P>
<P>

<a name=r38_0274>

<title>COMPLEX</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>COMPLEX</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>complex</em> switch is on, full complex arithmetic is used in 
simplification, function evaluation, and factorization. Default is <em>off</em>.
 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>Complex floating-point can be done by turning on 
<a href=r38_0300.html#r38_0330>rounded</a> in 
addition to <em>complex</em>. With <em>complex</em> 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 
<a href=r38_0300.html#r38_0324>rationalize</a>. 
<P>
<P>
<P>

<a name=r38_0275>

<title>CREF</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>CREF</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The switch <em>cref</em> 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. 
<P>
<P>
The output is alphabetized on the first seven characters of each function 
name. 
<P>
<P>
To invoke the cross-reference program, <em>cref</em> 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 <em>cref</em> 
off will cause a cross-reference listing to be produced. 
<P>
<P>
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 <em>aeval</em>. 
<P>
<P>
<P>

<a name=r38_0276>

<title>CRAMER</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>CRAMER</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>cramer</em> switch is on, 
<a href=r38_0300.html#r38_0345>matrix</a> inversion 
and linear equation 
solving (operator 
<a href=r38_0150.html#r38_0179>solve</a>) is done by Cramer's rule, through exte
rior 
multiplication. Default is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>Your time readings will vary depending on the REDUCE version you u
se. 
After you invert the matrix, turn on 
<a href=r38_0300.html#r38_0314>output</a> and ask for one of 
the elements of the inverse matrix, such as <em>cramersinv(3,2)</em>, so that 
you can see the size of the expressions produced. 
<P>
<P>
Inversion of matrices and the solution of linear equations with dense 
symbolic entries in many variables is generally considerably faster with 
<em>cramer</em> on. However, inversion of numeric-valued matrices is 
slower. Consider the matrices you're inverting before deciding whether to 
turn <em>cramer</em> 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 <em>output</em> 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. 
<P>
<P>
<P>

<a name=r38_0277>

<title>DEFN</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>DEFN</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the switch <em>defn</em> is on, the Standard Lisp equivalent of the 
input statement or procedure is printed, but not evaluated. Default is 
<em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

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

<a name=r38_0278>

<title>DEMO</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>DEMO</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The <em>demo</em> switch is used for interactive files, causing the system 
to pause after each command in the file until you type a <em>Return</em>. 
Default is <em>off</em>. 
<P>
<P>
The switch <em>demo</em> 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. 
<P>
<P>
You can either include the <em>on demo</em> command in the file, or enter 
it from the top level before bringing in any file. Unlike the 

<a href=r38_0100.html#r38_0128>pause</a> command, <em>on demo</em> does not perm
it you to interrupt 
the file for questions of your own. 
<P>
<P>
<P>
<P>

<a name=r38_0279>

<title>DFPRINT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>DFPRINT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>dfprint</em> is on, expressions in the differentiation operator 

<a href=r38_0100.html#r38_0148>df</a> are printed in a more ``natural'' notation
, with the 
differentiation variables appearing as subscripts. In addition, if the 
switch 
<a href=r38_0300.html#r38_0310>noarg</a> is on (the default), the arguments of t
he 
differentiated operator are suppressed. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>
<a name=r38_0280>

<title>DIV</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>DIV</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>div</em> is on, the system divides any simple factors found in 
the denominator of an expression into the numerator. Default is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>The <em>div</em> switch only has effect when the 
<a href=r38_0300.html#r38_0319>pri</a> switch is on. 
When <em>pri</em> is off, regardless of the setting of <em>div</em>, the 
printing behavior is as if <em>div</em> were off. 
<P>
<P>
<P>

<a name=r38_0281>

<title>ECHO</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ECHO</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The <em>echo</em> switch is normally off for top-level entry, and on when files 

are brought in. If <em>echo</em> is turned on at the top level, your input 
statements are echoed to the screen (thus appearing twice). Default 
<em>off</em> (but note default <em>on</em> for files). 
<P>
<P>
If you want to display certain portions of a file and not others, use the 
commands <em>off echo</em> and <em>on echo</em> inside the file. If you want 
no display of the file, use the input command 
<P>
<P>
	<em>in</em> filename<em>$</em> 
<P>
<P>
rather than using the semicolon delimiter. 
<P>
<P>
Be careful when you use commands within a file to generate another file. 
Since <em>echo</em> is on for files, the output file echoes input statements 
(unlike its behavior from the top level). You should explicitly turn off 
<em>echo</em> when writing output, and turn it back on when you're done. 
<P>
<P>
<P>

<a name=r38_0282>

<title>ERRCONT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>ERRCONT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>errcont</em> switch is on, error conditions do not stop file 
execution. Error messages will be printed whether <em>errcont</em> is on or 
off. 
<P>
<P>
Default is <em>off</em>. 
<P>
<P>
The following describes what happens when an error occurs in a file under 
each setting of <em>errcont</em> and <em>int</em>: 
<P>
<P>
Both off: Message is printed and parsing continues, but no further 
statements are executed; no commands from keyboard accepted except bye or 
end; 
<P>
<P>
<em>errcont</em>off, <em>int</em> on: Message is printed, and you are asked 
if you wish to continue. (This is the default behavior); 
<P>
<P>
<em>errcont</em>on, <em>int</em> off: Message is printed, and file continues 
to execute without pause; 
<P>
<P>
Both on: Message is printed, and file continues to execute without pause. 
<P>
<P>
<P>
<P>

<a name=r38_0283>

<title>EVALLHSEQP</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>EVALLHSEQP</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
Under normal circumstances, the right-hand-side of an 
<a href=r38_0001.html#r38_0045>equation</a> 
is evaluated but not the left-hand-side. This also applies to any 
substitutions made by the 
<a href=r38_0150.html#r38_0182>sub</a> operator. If both sides are to be 
evaluated, the switch <em>evallhseqp</em> should be turned on. 
<P>
<P>

<a name=r38_0284>

<title>EXP_switch</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>EXP</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>exp</em> switch is on, powers and products of expressions are 
expanded. Default is <em>on</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
(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

</tt></pre><p>Note that REDUCE knows that i^2 = -1. 
When <em>exp</em> 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 <em>exp</em> is 
off, such as 
<a href=r38_0150.html#r38_0157>length</a>. Be cautious about leaving <em>exp
</em> off. 
<P>
<P>
<P>

<a name=r38_0285>

<title>EXPANDLOGS</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>EXPANDLOGS</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
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 <em>expandlogs</em> and 

<a href=r38_0250.html#r38_0272>combinelogs</a> to carry out these operations. Bo
th are off by default. 
 <P> <H3> 
examples: </H3>
<p><pre><tt>
on expandlogs; 

log(x*y); 

  LOG(X) + LOG(Y) 


on combinelogs; 

ws; 

  LOG(X*Y)

</tt></pre><p><P>
<P>
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. 
<P>
<P>
<P>

<a name=r38_0286>

<title>EZGCD</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>EZGCD</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>ezgcd</em> and 
<a href=r38_0050.html#r38_0086>gcd</a> are on, greatest common divisors are 
computed using the EZ GCD algorithm that uses modular arithmetic (and is 
usually faster). Default is <em>off</em>. 
<P>
<P>
As a side effect of the gcd calculation, the expressions involved are 
factored, though not the heavy-duty factoring of 
<a href=r38_0150.html#r38_0151>factorize</a>. The 
EZ GCD algorithm was introduced in a paper by J. Moses and D.Y.Y. Yun in 
&lt;Proceedings of the ACM&gt;, 1973, pp. 159-166. 
<P>
<P>
Note that the 
<a href=r38_0050.html#r38_0086>gcd</a> switch must also be on for <em>ezgcd</em>
 to have 
effect. 
<P>
<P>
<P>

<a name=r38_0287>

<title>FACTOR</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FACTOR</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>factor</em> switch is on, input expressions and results are 
automatically factored. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>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. 
<P>
<P>
When the <em>factor</em> switch is turned on, the 
<a href=r38_0250.html#r38_0256>exp</a> switch is 
turned off, and when the <em>factor</em> switch is turned off, the 

<a href=r38_0250.html#r38_0256>exp</a> switch is turned on, whether it was on pr
eviously or not. 
<P>
<P>
When the switch 
<a href=r38_0300.html#r38_0335>trfac</a> is on, informative messages are generat
ed at 
each call to the factorizer. The 
<a href=r38_0300.html#r38_0334>trallfac</a> switch causes the 
production of a more verbose trace message. It takes precedence over 
<em>trfac</em> if they are both on. 
<P>
<P>
To factor a polynomial explicitly and store the results, use the operator 

<a href=r38_0150.html#r38_0151>factorize</a>. 
<P>
<P>
<P>

<a name=r38_0288>

<title>FAILHARD</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FAILHARD</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>failhard</em> switch is on, the integration operator 
<a href=r38_0150.html#r38_0154>int</a> 
terminates with an error message if the integral cannot be done in closed 
terms. 
Default is off. 
<P>
<P>
Use the <em>failhard</em> 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. 
<P>
<P>
<P>

<a name=r38_0289>

<title>FORT</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FORT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>fort</em> is on, output is given Fortran-compatible syntax. Default 
is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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))

</tt></pre><p>REDUCE results can be written to a file (using 
<a href=r38_0200.html#r38_0233>out</a>) and used as data 
by Fortran programs when <em>fort</em> is in effect. <em>fort</em> knows about 
correct statement length, continuation characters, defining a symbol when 
it is first used, and other Fortran details. 
<P>
<P>
The 
<a href=r38_0650.html#r38_0652>GENTRAN</a> package offers many more possibilitie
s than the 
<em>fort</em> switch. It produces Fortran (or C or Ratfor) code from REDUCE 
procedures or structured specifications, including facilities for producing 
double precision output. 
<P>
<P>
<P>

<a name=r38_0290>

<title>FORTUPPER</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FORTUPPER</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>fortupper</em> is on, any Fortran-style output appears in upper case. 
Default is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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) 

</tt></pre><p>
<a name=r38_0291>

<title>FULLPREC</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FULLPREC</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
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 
<em>fullprec</em> can be turned on. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
on rounded; 

1/2; 

  0.5 


on fullprec; 

ws; 

  0.500000000000

</tt></pre><p>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 
<a href=r38_0200.html#r38_0219>scientific_notation</a>. 
<P>
<P>
<P>

<a name=r38_0292>

<title>FULLROOTS</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>FULLROOTS</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
Since roots of cubic and quartic polynomials can often be very 
messy, a switch <em>fullroots</em> controls the production 
of results in closed form. 
<a href=r38_0150.html#r38_0179>solve</a> will apply the 
formulas for explicit forms for degrees 3 and 4 only if 
<em>fullroots</em> is <em>on</em>. Otherwise the result forms 
are built using 
<a href=r38_0150.html#r38_0176>root_of</a>. Default is <em>off</em>. 
<P>
<P>

<a name=r38_0293>

<title>GC</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>GC</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
With the <em>gc</em> 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. 
<P>
<P>
See 
<a href=r38_0100.html#r38_0130>reclaim</a> for an explanation of garbage collect
ion. REDUCE does 
garbage collection when needed even if you have turned the notices off. 
<P>
<P>
<P>

<a name=r38_0294>

<title>GCD_switch</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>GCD</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When <em>gcd</em> is on, common factors in numerators and denominators of 
expressions are canceled. Default is <em>off</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>

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

</tt></pre><p>Even with <em>gcd</em> 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 <em>gcd</em> is somewhat complicated. Note when 
<a href=r38_0250.html#r38_0256>exp</a> is off, 
<em>gcd</em> has the side effect of factoring the expression. 
<P>
<P>
<P>

<a name=r38_0295>

<title>HORNER</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>HORNER</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>horner</em> switch is on, polynomial expressions are printed 
in Horner's form for faster and safer numerical evaluation. Default 
is <em>off</em>. The leading variable of the expression is selected as 
Horner variable. To select the Horner variable explicitly use the 

<a href=r38_0150.html#r38_0198>korder</a> declaration. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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)))

</tt></pre><p>
<a name=r38_0296>

<title>IFACTOR</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>IFACTOR</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
When the <em>ifactor</em> switch is on, any integer terms appearing as a result 

of the 
<a href=r38_0150.html#r38_0151>factorize</a> command are factored themselves int
o primes. Default 
is <em>off</em>. If the argument of <em>factorize</em> is an integer, 
<em>ifactor</em> has no effect, since the integer is always factored. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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}} 

</tt></pre><p>Constant terms that appear within nonconstant 
polynomial factors are not factored. 
<P>
<P>
The <em>ifactor</em> switch affects only factoring done specifically 
with 
<a href=r38_0150.html#r38_0151>factorize</a>, not on factoring done automaticall
y when the 

<a href=r38_0250.html#r38_0287>factor</a> switch is on. 
<P>
<P>
<P>

<a name=r38_0297>

<title>INT_switch</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>INT</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The <em>int</em> switch specifies an interactive mode of operation. Default 
<em>on</em>. 
<P>
<P>
There is no reason to turn <em>int</em> off during interactive calculations, 
since there are no benefits to be gained. If you do have <em>int</em> off 
while inputting a file, and REDUCE finds an error, it prints the message 
``Continuing with parsing only.&quot; In this state, REDUCE accepts only 

<a href=r38_0001.html#r38_0044>end</a><em>;</em> or 
<a href=r38_0100.html#r38_0124>bye</a><em>;</em> from the keyboard; 
everything else is ignored, even the command <em>on int</em>. 
<P>
<P>
<P>

<a name=r38_0298>

<title>INTSTR</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>INTSTR</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
If <em>intstr</em> (for ``internal structure'') is on, arguments of an 
operator are printed in a more structured form. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
operator f; 

f(2x+2y); 

  F(2*X + 2*Y) 


on intstr; 

ws; 

  F(2*(X + Y))

</tt></pre><p>
<a name=r38_0299>

<title>LCM</title></a>
<p align="centre"><img src="redlogo.gif" width=621 height=60 border=0 alt="REDUC
E"></p>
<b><a href=r38_idx.html>INDEX</a></b><p><p>



<b>LCM</b> _ _ _  _ _ _  _ _ _  _ _ _ <b>switch</b><P>
<P>
 
 <P>
<P>
The <em>lcm</em> switch instructs REDUCE to compute the least common multiple 
of denominators whenever rational expressions occur. Default is <em>on</em>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<p><pre><tt>
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

</tt></pre><p>Note that <em>lcm</em> 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 
<em>lcm</em> off. It remains unsimplified even after <em>lcm</em> is turned 
back on. However, a new variable containing the same expression is 
simplified on entry. The switch 
<a href=r38_0050.html#r38_0086>gcd</a> does examine existing 
structures, as shown in the last example line above. 
<P>
<P>
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 <em>lcm</em> 

switch. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]