variable.tex 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. \section{Variables}
  2. \begin{Variable}{assumptions}
  3. \index{solve}
  4. After solving a linear or polynomial equation system
  5. with parameters, the variable \name{assumptions} contains a list
  6. of side relations for the parameters. The solution is valid only
  7. as long as none of these expression is zero.
  8. \begin{Examples}
  9. solve({a*x-b*y+x,y-c},{x,y});&
  10. \{\{x=\rfrac{b*c}{a + 1},y=c\}\} \\
  11. assumptions; & \{a + 1\}
  12. \end{Examples}
  13. \end{Variable}
  14. \begin{Variable}{CARD\_NO}
  15. \index{FORTRAN}\index{output}
  16. \name{card\_no} sets the total number of cards allowed in a Fortran
  17. output statement when \name{fort} is on. Default is 20.
  18. \begin{Examples}
  19. on fort; \\
  20. card_no := 4; & CARD\_NO=4. \\
  21. z := (x + y)**15; &
  22. \begin{multilineoutput}{6cm}
  23. ANS1=5005.*X**6*Y**9+3003.*X**5*Y**10+1365.*X**4*Y**
  24. . 11+455.*X**3*Y**12+105.*X**2*Y**13+15.*X*Y**14+Y**15
  25. Z=X**15+15.*X**14*Y+105.*X**13*Y**2+455.*X**12*Y**3+
  26. . 1365.*X**11*Y**4+3003.*X**10*Y**5+5005.*X**9*Y**6+
  27. . 6435.*X**8*Y**7+6435.*X**7*Y**8+ANS1
  28. \end{multilineoutput}
  29. \end{Examples}
  30. \begin{Comments}
  31. Twenty total cards means 19 continuation cards. You may set it for more
  32. if your Fortran system allows more. Expressions are broken apart in a
  33. Fortran-compatible way if they extend for more than \name{card\_no}
  34. continuation cards.
  35. \end{Comments}
  36. \end{Variable}
  37. \begin{Constant}{E}
  38. The constant \name{e} is reserved for use as the base of the natural
  39. logarithm. Its value is approximately 2.71828284590, which REDUCE gives
  40. to the current decimal precision when the switch \nameref{rounded} is on.
  41. \begin{Comments}
  42. \name{e} may be used as an iterative variable in a \nameref{for} statement,
  43. or as a local variable or a \nameref{procedure}. If \name{e} is defined
  44. as a local
  45. variable inside the procedure, the normal definition as the base of the
  46. natural logarithm would be suspended inside the procedure.
  47. \end{Comments}
  48. \end{Constant}
  49. \begin{Variable}{EVAL\_MODE}
  50. \index{algebraic}\index{symbolic}
  51. The system variable \name{eval\_mode} contains the current mode, either
  52. \nameref{algebraic} or \nameref{symbolic}.
  53. \begin{Examples}
  54. EVAL\_MODE; & ALGEBRAIC
  55. \end{Examples}
  56. \begin{Comments}
  57. Some commands do not behave the same way in algebraic and symbolic modes.
  58. %You can determine what mode you are in without using this command by noting
  59. %that the numbered prompt in algebraic mode contains a colon (\name{:}), while
  60. %the numbered prompt in symbolic mode contains an asterisk (\name{*}).
  61. \end{Comments}
  62. \end{Variable}
  63. \begin{Variable}{FORT\_WIDTH}
  64. \index{output}\index{FORTRAN}
  65. The \name{fort\_width} variable sets the number of characters in a line of
  66. Fortran-compatible output produced when the \nameref{fort} switch is on.
  67. Default is 70.
  68. \begin{Examples}
  69. fort_width := 30; & FORT\_WIDTH := 30 \\
  70. on fort; \\
  71. df(sin(x**3*y),x); & \begin{multilineoutput}{3cm}
  72. ANS=3.*COS(X
  73. . **3*Y)*X**2*
  74. . Y
  75. \end{multilineoutput}
  76. \end{Examples}
  77. \begin{Comments}
  78. \name{fort\_width} includes the usually blank characters at the beginning
  79. of the card. As you may notice above, it is conservative and makes the
  80. lines even shorter than it was told.
  81. \end{Comments}
  82. \end{Variable}
  83. \begin{Variable}{HIGH\_POW}
  84. \index{polynomial}\index{degree}
  85. The variable \name{high\_pow} is set by \nameref{coeff} to the highest power
  86. of the variable of interest in the given expression. You can access this
  87. variable for use in further computation or display.
  88. \begin{Examples}
  89. coeff((x+1)^5*(x*(y+3)^2)^2,x); &
  90. \begin{multilineoutput}{6cm}
  91. \{0,
  92. 0,
  93. Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81,
  94. 5*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
  95. 10*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
  96. 10*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
  97. 5*(Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81),
  98. Y^{4} + 12*Y^{3} + 54*Y^{2} + 108*Y + 81\}
  99. \end{multilineoutput} \\
  100. high_pow; & 7
  101. \end{Examples}
  102. \end{Variable}
  103. \begin{Constant}{I}
  104. \index{complex}
  105. REDUCE knows \name{i} is the square root of -1,
  106. and that \IFTEX{$i^2 = -1$}{i^2 = -1}.
  107. \begin{Examples}
  108. (a + b*i)*(c + d*i); & A*C + A*D*I + B*C*I - B*D \\
  109. i**2; & -1
  110. \end{Examples}
  111. \begin{Comments}
  112. \name{i} cannot be used as an identifier. It is all right to use \name{i}
  113. as an index variable in a \name{for} loop, or as a local (\name{scalar})
  114. variable inside a \name{begin...end} block, but it loses its definition as
  115. the square root of -1 inside the block in that case.
  116. Only the simplest properties of \IFTEX{$i$}{i} are known by REDUCE unless
  117. the switch \nameref{complex} is turned on, which implements full complex
  118. arithmetic in factoring, simplification, and functional values.
  119. \name{complex} is ordinarily off.
  120. \end{Comments}
  121. \end{Constant}
  122. \begin{Constant}{INFINITY}
  123. The name \name{infinity} is used to represent the infinite positive number.
  124. However, at the present time, arithmetic in terms of this operator reflects
  125. finite arithmetic, rather than true operations on infinity.
  126. \end{Constant}
  127. \begin{Variable}{LOW\_POW}
  128. \index{degree}\index{polynomial}
  129. The variable \name{low\_pow} is set by \nameref{coeff} to the lowest power
  130. of the variable of interest in the given expression. You can access this
  131. variable for use in further computation or display.
  132. \begin{Examples}
  133. coeff((x+2*y)**6,y); &
  134. \begin{multilineoutput}{6cm}
  135. \{X^{6},
  136. 12*X^{5},
  137. 60*X^{4},
  138. 160*X^{3},
  139. 240*X^{2},
  140. 192*X,
  141. 64\}
  142. \end{multilineoutput}\\
  143. low_pow; & 0 \\
  144. coeff(x**2*(x*sin(y) + 1),x);
  145. & \{0,0,1,SIN(Y)\} \\
  146. low_pow; & 2
  147. \end{Examples}
  148. \end{Variable}
  149. \begin{Constant}{NIL}
  150. \index{false}
  151. \name{nil} represents the truth value {\it false} in symbolic mode, and is
  152. a synonym for 0 in algebraic mode. It cannot be used for any other
  153. purpose, even inside procedures or \nameref{for} loops.
  154. \end{Constant}
  155. \begin{Constant}{PI}
  156. The identifier \name{pi} is reserved for use as the circular constant.
  157. Its value is given by 3.14159265358..., which REDUCE gives to the current
  158. decimal precision when REDUCE is in a floating-point mode.
  159. \begin{Comments}
  160. \name{pi} may be used as a looping variable in a \nameref{for} statement,
  161. or as a local variable in a \nameref{procedure}. Its value in such cases
  162. will be taken from the local environment.
  163. \end{Comments}
  164. \end{Constant}
  165. \begin{Variable}{requirements}
  166. \index{solve}
  167. After an attempt to solve an inconsistent equation system
  168. with parameters, the variable \name{requirements} contains a list
  169. of expressions. These expressions define a set of conditions implicitly
  170. equated with zero. Any solution to this system defines a setting for
  171. the parameters sufficient to make the original system consistent.
  172. \begin{Examples}
  173. solve({x-a,x-y,y-1},{x,y}); & \{\}\\
  174. requirements;&\{a - 1\}
  175. \end{Examples}
  176. \end{Variable}
  177. \begin{Variable}{ROOT\_MULTIPLICITIES}
  178. \index{root}\index{solve}\index{polynomial}
  179. The \name{root\_multiplicities} variable is set to the list of the
  180. multiplicities of the roots of an equation by the \nameref{solve} operator.
  181. \begin{Comments}
  182. \nameref{solve} returns its solutions in a list. The multiplicities of
  183. each solution are put in the corresponding locations of the list
  184. \name{root\_multiplicities}.
  185. \end{Comments}
  186. \end{Variable}
  187. \begin{Constant}{T}
  188. The constant \name{t} stands for the truth value {\it true}. It cannot be used
  189. as a scalar variable in a \nameref{block}, as a looping variable in a
  190. \nameref{for} statement or as an \nameref{operator} name.
  191. \end{Constant}