File r37/doc/help/variable.tex artifact f39242dd85 part of check-in 3af273af29


\section{Variables}

\begin{Variable}{assumptions}
\index{solve}
After solving a linear or polynomial equation system
with parameters, the variable \name{assumptions} contains a list 
of side relations for the parameters. The solution is valid only
as long as none of these expression is zero.
\begin{Examples}
solve({a*x-b*y+x,y-c},{x,y});&
\{\{x=\rfrac{b*c}{a + 1},y=c\}\} \\
assumptions; & \{a + 1\}
\end{Examples}
\end{Variable}

\begin{Variable}{CARD\_NO}
\index{FORTRAN}\index{output}
\name{card\_no} sets the total number of cards allowed in a Fortran
output statement when \name{fort} is on.  Default is 20.

\begin{Examples}
on fort; \\
card_no := 4;                &         CARD\_NO=4. \\
z := (x + y)**15;            &
\begin{multilineoutput}{6cm}
      ANS1=5005.*X**6*Y**9+3003.*X**5*Y**10+1365.*X**4*Y**
     . 11+455.*X**3*Y**12+105.*X**2*Y**13+15.*X*Y**14+Y**15
      Z=X**15+15.*X**14*Y+105.*X**13*Y**2+455.*X**12*Y**3+ 
     . 1365.*X**11*Y**4+3003.*X**10*Y**5+5005.*X**9*Y**6+
     . 6435.*X**8*Y**7+6435.*X**7*Y**8+ANS1
\end{multilineoutput}
\end{Examples}

\begin{Comments}
Twenty total cards means 19 continuation cards.  You may set it for more
if your Fortran system allows more.  Expressions are broken apart in a
Fortran-compatible way if they extend for more than \name{card\_no}
continuation cards.
\end{Comments}
\end{Variable}


\begin{Constant}{E}
The constant \name{e} is reserved for use as the base of the natural
logarithm.  Its value is approximately 2.71828284590, which REDUCE gives
to the current decimal precision when the switch \nameref{rounded} is on.

\begin{Comments}
\name{e} may be used as an iterative variable in a \nameref{for} statement,
or as a local variable or a \nameref{procedure}.  If \name{e} is defined
as a local
variable inside the procedure, the normal definition as the base of the
natural logarithm would be suspended inside the procedure.
\end{Comments}
\end{Constant}


\begin{Variable}{EVAL\_MODE}
\index{algebraic}\index{symbolic}
The system variable \name{eval\_mode} contains the current mode, either
\nameref{algebraic} or \nameref{symbolic}.

\begin{Examples}
EVAL\_MODE;                  &        ALGEBRAIC
\end{Examples}

\begin{Comments}
Some commands do not behave the same way in algebraic and symbolic modes.
%You can determine what mode you are in without using this command by noting
%that the numbered prompt in algebraic mode contains a colon (\name{:}), while
%the numbered prompt in symbolic mode contains an asterisk (\name{*}).
\end{Comments}
\end{Variable}


\begin{Variable}{FORT\_WIDTH}
\index{output}\index{FORTRAN}
The \name{fort\_width} variable sets the number of characters in a line of
Fortran-compatible output produced when the \nameref{fort} switch is on.
Default is 70.

\begin{Examples}
fort_width := 30;            &         FORT\_WIDTH := 30  \\
on fort; \\
df(sin(x**3*y),x);           &         \begin{multilineoutput}{3cm}
      ANS=3.*COS(X
     . **3*Y)*X**2*
     . Y
\end{multilineoutput}
\end{Examples}

\begin{Comments}
\name{fort\_width} includes the usually blank characters at the beginning
of the card.  As you may notice above, it is conservative and makes the
lines even shorter than it was told.
\end{Comments}
\end{Variable}


\begin{Variable}{HIGH\_POW}
\index{polynomial}\index{degree}
The variable \name{high\_pow} is set by \nameref{coeff} to the highest power
of the variable of interest in the given expression.  You can access this
variable for use in further computation or display.

\begin{Examples}
coeff((x+1)^5*(x*(y+3)^2)^2,x); &
\begin{multilineoutput}{6cm}
\{0,
 0,
 Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81,
 5*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
 10*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
 10*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
 5*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
 Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81\}
\end{multilineoutput} \\
high_pow;                    &        7
\end{Examples}
\end{Variable}


\begin{Constant}{I}
\index{complex}
REDUCE knows \name{i} is the square root of -1,
 and that \IFTEX{$i^2 = -1$}{i^2 = -1}.

\begin{Examples}
(a + b*i)*(c + d*i);         &      A*C + A*D*I + B*C*I - B*D \\
i**2;                        &      -1
\end{Examples}

\begin{Comments}
\name{i} cannot be used as an identifier.  It is all right to use \name{i}
as an index variable in a \name{for} loop, or as a local (\name{scalar})
variable inside a \name{begin...end} block, but it loses its definition as
the square root of -1 inside the block in that case.

Only the simplest properties of \IFTEX{$i$}{i} are known by REDUCE unless
the switch \nameref{complex} is turned on, which implements full complex
arithmetic in factoring, simplification, and functional values.
\name{complex} is ordinarily off.
\end{Comments}
\end{Constant}


\begin{Constant}{INFINITY}
The name \name{infinity} is used to represent the infinite positive number.
However, at the present time, arithmetic in terms of this operator reflects
finite arithmetic, rather than true operations on infinity.

\end{Constant}


\begin{Variable}{LOW\_POW}
\index{degree}\index{polynomial}
The variable \name{low\_pow} is set by \nameref{coeff} to the lowest power
of the variable of interest in the given expression.  You can access this
variable for use in further computation or display.

\begin{Examples}
coeff((x+2*y)**6,y);        &
\begin{multilineoutput}{6cm}
\{X^{6},
 12*X^{5},
 60*X^{4},
 160*X^{3},
 240*X^{2},
 192*X,
 64\}
\end{multilineoutput}\\
low_pow;                    &      0 \\
coeff(x**2*(x*sin(y) + 1),x); 
			    &      \{0,0,1,SIN(Y)\} \\
low_pow;                    &      2
\end{Examples}

\end{Variable}


\begin{Constant}{NIL}
\index{false}
\name{nil} represents the truth value {\it false} in symbolic mode, and is
a synonym for 0 in algebraic mode.  It cannot be used for any other
purpose, even inside procedures or \nameref{for} loops.
\end{Constant}


\begin{Constant}{PI}
The identifier \name{pi} is reserved for use as the circular constant.
Its value is given by 3.14159265358..., which REDUCE gives to the current
decimal precision when REDUCE is in a floating-point mode.

\begin{Comments}
\name{pi} may be used as a looping variable in a \nameref{for} statement,
or as a local variable in a \nameref{procedure}.  Its value in such cases
will be taken from the local environment.
\end{Comments}
\end{Constant}

\begin{Variable}{requirements}
\index{solve}
After an attempt to solve an inconsistent equation system
with parameters, the variable \name{requirements} contains a list 
of expressions. These expressions define a set of conditions implicitly
equated with zero. Any solution to this system defines a setting for
the parameters sufficient to make the original system consistent.
\begin{Examples}
solve({x-a,x-y,y-1},{x,y}); & \{\}\\
requirements;&\{a - 1\}
\end{Examples}
\end{Variable}

\begin{Variable}{ROOT\_MULTIPLICITIES}
\index{root}\index{solve}\index{polynomial}
The \name{root\_multiplicities} variable is set to the list of the
multiplicities of the roots of an equation by the \nameref{solve} operator.

\begin{Comments}
\nameref{solve} returns its solutions in a list.  The multiplicities of
each solution are put in the corresponding locations of the list
\name{root\_multiplicities}.
\end{Comments}
\end{Variable}


\begin{Constant}{T}
The constant \name{t} stands for the truth value {\it true}.  It cannot be used
as a scalar variable in a \nameref{block}, as a looping variable in a
\nameref{for} statement or as an \nameref{operator} name.

\end{Constant}



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