switch.tex 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751
  1. \section{General Switches}
  2. \begin{Introduction}{SWITCHES}
  3. Switches are set on or off using the commands \nameref{on} or
  4. \nameref{off}, respectively.
  5. The default setting of the switches described in this section is
  6. \nameref{off} unless stated otherwise.
  7. \end{Introduction}
  8. \begin{Switch}{ALGINT}
  9. \index{integration}
  10. When the \name{algint} switch is on, the algebraic integration module (which
  11. must be loaded from the REDUCE library) is used for integration.
  12. \begin{Comments}
  13. Loading \name{algint} from the library automatically turns on the
  14. \name{algint} switch. An error message will be given if \name{algint} is
  15. turned on when the \name{algint} has not been loaded from the library.
  16. \end{Comments}
  17. \end{Switch}
  18. \begin{Switch}{ALLBRANCH}
  19. When \name{allbranch} is on, the operator \nameref{solve} selects all
  20. branches of solutions.
  21. When \name{allbranch} is off, it selects only the principal
  22. branches. Default is \name{on}.
  23. \begin{Examples}
  24. solve(log(sin(x+3)),x); &
  25. \begin{multilineoutput}{6cm}
  26. \{X=2*ARBINT(1)*PI - ASIN(1) - 3,
  27. X=2*ARBINT(1)*PI + ASIN(1) + PI - 3\}
  28. \end{multilineoutput}\\
  29. off allbranch; \\
  30. solve(log(sin(x+3)),x); &
  31. {X=ASIN(1) - 3}
  32. \end{Examples}
  33. \begin{Comments}
  34. \nameref{arbint}(1) indicates an arbitrary integer, which is given a
  35. unique identifier by REDUCE, showing that there are infinitely many
  36. solutions of this type. When \name{allbranch} is off, the single
  37. canonical solution is given.
  38. \end{Comments}
  39. \end{Switch}
  40. \begin{Switch}{ALLFAC}
  41. \index{output}
  42. The \name{allfac} switch, when on, causes REDUCE to factor out automatically
  43. common products in the output of expressions. Default is \name{on}.
  44. \begin{Examples}
  45. x + x*y**3 + x**2*cos(z); & X*(COS(Z)*X + Y^{3} + 1) \\
  46. off allfac; \\
  47. x + x*y**3 + x**2*cos(z); & COS(Z)*X^{2} + X*Y^{3} + X
  48. \end{Examples}
  49. \begin{Comments}
  50. The \name{allfac} switch has no effect when \name{pri} is off. Although the
  51. switch setting stays as it was, printing behavior is as if it were off.
  52. \end{Comments}
  53. \end{Switch}
  54. % \begin{Switch}{ALLPREC}
  55. %
  56. % \end{Switch}
  57. %
  58. %
  59. \begin{Switch}{ARBVARS}
  60. \index{solve}
  61. When \name{arbvars} is on, the solutions of singular or underdetermined
  62. systems of equations are presented in terms of arbitrary complex variables
  63. (see \nameref{arbcomplex}). Otherwise, the solution is parametrized in
  64. terms of some of the input variables. Default is \name{on}.
  65. \begin{Examples}
  66. solve({2x + y,4x + 2y},{x,y}); &
  67. \{\{x= - \rfrac{arbcomplex(1)}{2},y=arbcomplex(1)\}\} \\
  68. solve({sqrt(x)+ y**3-1},{x,y}); &
  69. \{\{y=arbcomplex(2),x=y^6 - 2*y^3 + 1\}\} \\
  70. off arbvars; \\
  71. solve({2x + y,4x + 2y},{x,y}); &
  72. \{\{x= - \rfrac{y}{2}\}\} \\
  73. solve({sqrt(x)+ y**3-1},{x,y}); &
  74. \{\{x=y^6 - 2*y^3 + 1\}\} \\
  75. \end{Examples}
  76. \begin{Comments}
  77. With \name{arbvars} off, the return value \name{\{\{\}\}} means that the
  78. equations given to \nameref{solve} imply no relation among the input
  79. variables.
  80. \end{Comments}
  81. \end{Switch}
  82. \begin{Switch}{BALANCED\_MOD}
  83. \index{modular}
  84. \nameref{modular} numbers are normally produced in the range [0,...\meta{n}),
  85. where
  86. \meta{n} is the current modulus. With \name{balanced\_mod} on, the range
  87. [-\meta{n}/2,\meta{n}/2] is used instead.
  88. \begin{Examples}
  89. setmod 7; & 1 \\
  90. on modular; \\
  91. 4; & 4 \\
  92. on balanced_mod; \\
  93. 4; & -3
  94. \end{Examples}
  95. \end{Switch}
  96. \begin{Switch}{BFSPACE}
  97. \index{output}\index{floating point}
  98. Floating point numbers are normally printed in a compact notation (either
  99. fixed point or in scientific notation if \nameref{SCIENTIFIC\_NOTATION}
  100. has been used). In some (but not all) cases, it helps comprehensibility
  101. if spaces are inserted in the number at regular intervals. The switch
  102. \name{bfspace}, if on, will cause a blank to be inserted in the number after
  103. every five characters.
  104. \begin{Examples}
  105. on rounded; \\
  106. 1.2345678; & 1.2345678 \\
  107. on bfspace; \\
  108. 1.2345678; & 1.234 5678
  109. \end{Examples}
  110. \begin{Comments}
  111. \name{bfspace} is normally off.
  112. \end{Comments}
  113. \end{Switch}
  114. \begin{Switch}{COMBINEEXPT}
  115. \index{exponent simplification}
  116. REDUCE is in general poor at surd simplification. However, when the
  117. switch \name{combineexpt} is on, the system attempts to combine
  118. exponentials whenever possible.
  119. \begin{TEX}
  120. \begin{Examples}
  121. 3^(1/2)*3^(1/3)*3^(1/6); & SQRT(3)*3^{\rfrac{1}{3}}*3^{\rfrac{1}{6}} \\
  122. on combineexpt; \\
  123. ws; & 1
  124. \end{Examples}
  125. \end{TEX}
  126. \begin{INFO}
  127. {\begin{Examples}
  128. 3^(1/2)*3^(1/3)*3^(1/6); & SQRT(3)*3^{1/3}*3^{1/6} \\
  129. on combineexpt; \\
  130. ws; & 1
  131. \end{Examples}}
  132. \end{INFO}
  133. \end{Switch}
  134. \begin{Switch}{COMBINELOGS}
  135. \index{logarithm}
  136. In many cases it is desirable to expand product arguments of logarithms,
  137. or collect a sum of logarithms into a single logarithm. Since these are
  138. inverse operations, it is not possible to provide rules for doing both at
  139. the same time and preserve the REDUCE concept of idempotent evaluation.
  140. As an alternative, REDUCE provides two switches \nameref{expandlogs} and
  141. \name{combinelogs} to carry out these operations.
  142. \begin{Examples}
  143. on expandlogs; \\
  144. log(x*y); & LOG(X) + LOG(Y) \\
  145. on combinelogs; \\
  146. ws; & LOG(X*Y)
  147. \end{Examples}
  148. \begin{Comments}
  149. At the present time, it is possible to have both switches on at once,
  150. which could lead to infinite recursion. However, an expression is
  151. switched from one form to the other in this case. Users should not rely
  152. on this behavior, since it may change in the next release.
  153. \end{Comments}
  154. \end{Switch}
  155. \begin{Switch}{COMP}
  156. \index{compiler}
  157. When \name{comp} is on, any succeeding function definitions are compiled
  158. into a faster-running form. Default is \name{off}.
  159. \begin{Examples}
  160. \explanation{The following procedure finds Fibonacci numbers recursively.
  161. Create a new file ``refib" in your current directory with the following
  162. lines in it:} \\[6mm]
  163. \begin{multilineinput}
  164. procedure refib(n);
  165. if fixp n and n >= 0 then
  166. if n <= 1 then 1
  167. else refib(n-1) + refib(n-2)
  168. else rederr "nonnegative integer only";
  169. end;
  170. \end{multilineinput}\\
  171. \explanation{Now load REDUCE and run the following:}\\
  172. on time; & Time: 100 ms \\
  173. in "refib"$ & Time: 0 ms \\
  174. & REFIB \\
  175. & Time: 260 ms \\
  176. & Time: 20 ms \\
  177. refib(80); & 37889062373143906 \\
  178. & Time: 14840 ms \\
  179. on comp; & Time: 80 ms \\
  180. in "refib"$ & Time: 20 ms \\
  181. & REFIB \\
  182. & Time: 640 ms \\
  183. refib(80); & 37889062373143906 \\
  184. & Time: 10940 ms
  185. \end{Examples}
  186. \begin{Comments}
  187. Note that the compiled procedure runs faster. Your time messages will
  188. differ depending upon which system you have. Compiled functions remain so
  189. for the duration of the REDUCE session, and are then lost. They must be
  190. recompiled if wanted in another session. With the switch \nameref{time} on
  191. as shown above, the CPU time used in executing the command is returned in
  192. milliseconds. Be careful not to leave \name{comp} on unless you want it,
  193. as it makes the processing of procedures much slower.
  194. \end{Comments}
  195. \end{Switch}
  196. \begin{Switch}{COMPLEX}
  197. \index{complex}
  198. When the \name{complex} switch is on, full complex arithmetic is used in
  199. simplification, function evaluation, and factorization. Default is \name{off}.
  200. \begin{Examples}
  201. factorize(a**2 + b**2); & \{A^{2} + B^{2} \} \\
  202. on complex; \\
  203. factorize(a**2 + b**2); & \{A - I*B,A + I*B\} \\
  204. (x**2 + y**2)/(x + i*y); & X - I*Y \\
  205. on rounded; &
  206. *** Domain mode COMPLEX changed to COMPLEX\_FLOAT \\
  207. sqrt(-17); & 4.12310562562*I \\
  208. log(7*i); & 1.94591014906 + 1.57079632679*I
  209. \end{Examples}
  210. \begin{Comments}
  211. Complex floating-point can be done by turning on \nameref{rounded} in
  212. addition to \name{complex}. With \name{complex} off however, REDUCE knows
  213. that \IFTEX{$i$}{i} is the square root of \IFTEX{$-1$}{-1} but will not
  214. carry out more complicated complex operations. If you want complex
  215. denominators cleared by multiplication by their conjugates, turn on the
  216. switch \nameref{rationalize}.
  217. \end{Comments}
  218. \end{Switch}
  219. \begin{Switch}{CREF}
  220. \index{cross reference}
  221. The switch \name{cref} invokes the CREF cross-reference program that
  222. processes a set of procedure definitions to produce a summary of their
  223. entry points, undefined procedures, non-local variables and so on. The
  224. program will also check that procedures are called with a consistent
  225. number of arguments, and print a diagnostic message otherwise.
  226. The output is alphabetized on the first seven characters of each function
  227. name.
  228. To invoke the cross-reference program, \name{cref} is first turned on.
  229. This causes the program to load and the cross-referencing process to
  230. begin. After all the required definitions are loaded, turning \name{cref}
  231. off will cause a cross-reference listing to be produced.
  232. \begin{Comments}
  233. Algebraic procedures in REDUCE are treated as if they were symbolic, so
  234. that algebraic constructs will actually appear as calls to symbolic
  235. functions, such as \name{aeval}.
  236. \end{Comments}
  237. \end{Switch}
  238. \begin{Switch}{CRAMER}
  239. \index{matrix}\index{linear system}\index{solve}
  240. When the \name{cramer} switch is on, \nameref{matrix} inversion
  241. and linear equation
  242. solving (operator \nameref{solve}) is done by Cramer's rule, through exterior
  243. multiplication. Default is \name{off}.
  244. \begin{Examples}
  245. on time; & Time: 80 ms \\
  246. off output; & Time: 100 ms \\[4mm]
  247. \begin{multilineinput}
  248. mm := mat((a,b,c,d,f),(a,a,c,f,b),(b,c,a,c,d), (c,c,a,b,f),
  249. (d,a,d,e,f));
  250. \end{multilineinput} & Time: 300 ms \\
  251. inverse := 1/mm; & Time: 18460 ms \\
  252. on cramer; & Time: 80 ms \\
  253. cramersinv := 1/mm; & Time: 9260 ms
  254. \end{Examples}
  255. \begin{Comments}
  256. Your time readings will vary depending on the REDUCE version you use.
  257. After you invert the matrix, turn on \nameref{output} and ask for one of
  258. the elements of the inverse matrix, such as \name{cramersinv(3,2)}, so that
  259. you can see the size of the expressions produced.
  260. Inversion of matrices and the solution of linear equations with dense
  261. symbolic entries in many variables is generally considerably faster with
  262. \name{cramer} on. However, inversion of numeric-valued matrices is
  263. slower. Consider the matrices you're inverting before deciding whether to
  264. turn \name{cramer} on or off. A substantial portion of the time in matrix
  265. inversion is given to formatting the results for printing. To save this
  266. time, turn \name{output} off, as shown in this example or terminate the
  267. expression with a dollar sign instead of a semicolon. The results are
  268. still available to you in the workspace associated with your prompt
  269. number, or you can assign them to an identifier for further use.
  270. \end{Comments}
  271. \end{Switch}
  272. \begin{Switch}{DEFN}
  273. \index{lisp}
  274. When the switch \name{defn} is on, the Standard Lisp equivalent of the
  275. input statement or procedure is printed, but not evaluated. Default is
  276. \name{off}.
  277. \begin{Examples}
  278. on defn; \\
  279. 17/3; & (AEVAL (LIST 'QUOTIENT 17 3)) \\
  280. df(sin(x),x,2);
  281. & (AEVAL (LIST 'DF (LIST 'SIN 'X) 'X 2)) \\
  282. \begin{multilineinput}
  283. procedure coshval(a);
  284. begin scalar g;
  285. g := (exp(a) + exp(-a))/2;
  286. return g
  287. end;
  288. \end{multilineinput} &
  289. \begin{multilineoutput}{7cm}
  290. (AEVAL
  291. (PROGN
  292. (FLAG '(COSHVAL) 'OPFN)
  293. (DE COSHVAL (A)
  294. (PROG (G)
  295. (SETQ G
  296. (AEVAL
  297. (LIST
  298. 'QUOTIENT
  299. (LIST
  300. 'PLUS
  301. (LIST 'EXP A)
  302. (LIST 'EXP (LIST 'MINUS A)))
  303. 2)))
  304. (RETURN G)))) )
  305. \end{multilineoutput} \\
  306. coshval(1); & (AEVAL (LIST 'COSHVAL 1)) \\
  307. off defn; \\
  308. coshval(1); & Declare COSHVAL operator? (Y or N) \\
  309. n \\
  310. \begin{multilineinput}
  311. procedure coshval(a);
  312. begin scalar g;
  313. g := (exp(a) + exp(-a))/2;
  314. return g
  315. end;
  316. \end{multilineinput} & COSHVAL \\
  317. on rounded; \\
  318. coshval(1); & 1.54308063482
  319. \end{Examples}
  320. \begin{Comments}
  321. The above function \name{coshval} finds the hyperbolic cosine (cosh) of its
  322. argument. When \name{defn} is on, you can see the Standard Lisp equivalent
  323. of the function, but it is not entered into the system as shown by the
  324. message \name{Declare COSHVAL operator?}. It must be reentered with
  325. \name{defn} off to be recognized. This procedure is used as an example; a
  326. more efficient procedure would eliminate the unnecessary local variable
  327. with
  328. \begin{verbatim}
  329. procedure coshval(a);
  330. (exp(a) + exp(-a))/2;
  331. \end{verbatim}
  332. \end{Comments}
  333. \end{Switch}
  334. \begin{Switch}{DEMO}
  335. \index{interactive}\index{output}
  336. The \name{demo} switch is used for interactive files, causing the system
  337. to pause after each command in the file until you type a \key{Return}.
  338. Default is \name{off}.
  339. \begin{Comments}
  340. The switch \name{demo} has no effect on top level interactive
  341. statements. Use it when you want to slow down operations in a file so
  342. you can see what is happening.
  343. You can either include the \name{on demo} command in the file, or enter
  344. it from the top level before bringing in any file. Unlike the
  345. \nameref{pause} command, \name{on demo} does not permit you to interrupt
  346. the file for questions of your own.
  347. \end{Comments}
  348. \end{Switch}
  349. \begin{Switch}{DFPRINT}
  350. \index{output}\index{derivative}
  351. When \name{dfprint} is on, expressions in the differentiation operator
  352. \nameref{df} are printed in a more ``natural'' notation, with the
  353. differentiation variables appearing as subscripts. In addition, if the
  354. switch \nameref{noarg} is on (the default), the arguments of the
  355. differentiated operator are suppressed.
  356. \begin{Examples}
  357. operator f; \\
  358. df(f x,x); & DF(F(X),X); \\
  359. on dfprint; \\
  360. ws; & F_{X} \\
  361. df(f(x,y),x,y); & F_{X}_{,}_{Y} \\
  362. off noarg; \\
  363. ws; & F(X,Y)_{X}
  364. \end{Examples}
  365. \end{Switch}
  366. \begin{Switch}{DIV}
  367. \index{output}
  368. When \name{div} is on, the system divides any simple factors found in
  369. the denominator of an expression into the numerator. Default is \name{off}.
  370. \begin{Examples}
  371. on div; \\
  372. a := x**2/y**2; & A := X^{2} *Y^{-2} \\
  373. b := a/(3*z); & B := \rfrac{1}{3}*X^{2} *Y^{-2} *Z^{-1} \\
  374. off div; \\
  375. a; & \rfrac{X^{2}}{Y^{2}}\\
  376. b; & \rfrac{X^{2}}{3*Y^{2} *Z}
  377. \end{Examples}
  378. \begin{Comments}
  379. The \name{div} switch only has effect when the \nameref{pri} switch is on.
  380. When \name{pri} is off, regardless of the setting of \name{div}, the
  381. printing behavior is as if \name{div} were off.
  382. \end{Comments}
  383. \end{Switch}
  384. \begin{Switch}{ECHO}
  385. \index{output}
  386. The \name{echo} switch is normally off for top-level entry, and on when files
  387. are brought in. If \name{echo} is turned on at the top level, your input
  388. statements are echoed to the screen (thus appearing twice). Default
  389. \name{off} (but note default \name{on} for files).
  390. \begin{Comments}
  391. If you want to display certain portions of a file and not others, use the
  392. commands \name{off echo} and \name{on echo} inside the file. If you want
  393. no display of the file, use the input command
  394. \name{in} {\em filename}\name{\$}
  395. rather than using the semicolon delimiter.
  396. Be careful when you use commands within a file to generate another file.
  397. Since \name{echo} is on for files, the output file echoes input statements
  398. (unlike its behavior from the top level). You should explicitly turn off
  399. \name{echo} when writing output, and turn it back on when you're done.
  400. \end{Comments}
  401. \end{Switch}
  402. \begin{Switch}{ERRCONT}
  403. \index{error handling}
  404. When the \name{errcont} switch is on, error conditions do not stop file
  405. execution. Error messages will be printed whether \name{errcont} is on or
  406. off.
  407. Default is \name{off}.
  408. \begin{Comments}
  409. \begin{TEX}
  410. The table below shows REDUCE behavior under the settings of \name{errcont} and
  411. \name{int} :
  412. \begin{center}
  413. \begin{tabular}{|l|l|p{9.5cm}|}
  414. \hline
  415. \multicolumn{3}{|c|}{Behavior in Case of Error in Files}\\
  416. \hline
  417. \multicolumn{1}{|c|}{errcont} &
  418. \multicolumn{1}{c|}{int} &
  419. \multicolumn{1}{c|}{Behavior when errors in files are encountered}\\
  420. \hline
  421. off & off &
  422. Message is printed and parsing continues, but no further statements are
  423. executed; no commands from keyboard accepted except \verb|bye| or
  424. \verb|end| \\
  425. off & on &
  426. Message is printed, and you are asked if you wish to continue. (This is the
  427. default behavior) \\
  428. on & off &
  429. Message is printed, and file continues to execute without pause \\
  430. on & on &
  431. Message is printed, and file continues to execute without pause\\
  432. \hline
  433. \end{tabular}
  434. \end{center}
  435. \end{TEX}
  436. \begin{INFO}
  437. The following describes what happens when an error occurs in a file under
  438. each setting of \name{errcont} and \name{int}:
  439. Both off: Message is printed and parsing continues, but no further
  440. statements are executed; no commands from keyboard accepted except bye or
  441. end;
  442. \name{errcont} off, \name{int} on: Message is printed, and you are asked
  443. if you wish to continue. (This is the default behavior);
  444. \name{errcont} on, \name{int} off: Message is printed, and file continues
  445. to execute without pause;
  446. Both on: Message is printed, and file continues to execute without pause.
  447. \end{INFO}
  448. \end{Comments}
  449. \end{Switch}
  450. \begin{Switch}{EVALLHSEQP}
  451. \index{equation}
  452. Under normal circumstances, the right-hand-side of an \nameref{equation}
  453. is evaluated but not the left-hand-side. This also applies to any
  454. substitutions made by the \nameref{sub} operator. If both sides are to be
  455. evaluated, the switch \name{evallhseqp} should be turned on.
  456. \end{Switch}
  457. \begin{Switch}{EXP}
  458. \index{simplification}
  459. When the \name{exp} switch is on, powers and products of expressions are
  460. expanded. Default is \name{on}.
  461. \begin{Examples}
  462. (x+1)**3; & X^{3} + 3*X^{2} + 3*X + 1 \\
  463. (a + b*i)*(c + d*i); & A*C + A*D*I + B*C*I - B*D \\
  464. off exp; \\
  465. (x+1)**3; & (X + 1)^{3} \\
  466. (a + b*i)*(c + d*i); & (A + B*I)*(C + D*I) \\
  467. length((x+1)**2/(y+1)); & 2
  468. \end{Examples}
  469. \begin{Comments}
  470. Note that REDUCE knows that \IFTEX{$i^2 = -1$}{i^2 = -1}.
  471. When \name{exp} is off, equivalent expressions may not simplify to the same
  472. form, although zero expressions still simplify to zero. Several operators
  473. that expect a polynomial argument behave differently when \name{exp} is
  474. off, such as \nameref{length}. Be cautious about leaving \name{exp} off.
  475. \end{Comments}
  476. \end{Switch}
  477. \begin{Switch}{EXPANDLOGS}
  478. \index{logarithm}
  479. In many cases it is desirable to expand product arguments of logarithms,
  480. or collect a sum of logarithms into a single logarithm. Since these are
  481. inverse operations, it is not possible to provide rules for doing both at
  482. the same time and preserve the REDUCE concept of idempotent evaluation.
  483. As an alternative, REDUCE provides two switches \name{expandlogs} and
  484. \nameref{combinelogs} to carry out these operations. Both are off by default.
  485. \begin{Examples}
  486. on expandlogs; \\
  487. log(x*y); & LOG(X) + LOG(Y) \\
  488. on combinelogs; \\
  489. ws; & LOG(X*Y)
  490. \end{Examples}
  491. \begin{Comments}
  492. At the present time, it is possible to have both switches on at once,
  493. which could lead to infinite recursion. However, an expression is
  494. switched from one form to the other in this case. Users should not rely
  495. on this behavior, since it may change in the next release.
  496. \end{Comments}
  497. \end{Switch}
  498. \begin{Switch}{EZGCD}
  499. \index{greatest common divisor}\index{polynomial}
  500. When \name{ezgcd} and \nameref{gcd} are on, greatest common divisors are
  501. computed using the EZ GCD algorithm that uses modular arithmetic (and is
  502. usually faster). Default is \name{off}.
  503. \begin{Comments}
  504. As a side effect of the gcd calculation, the expressions involved are
  505. factored, though not the heavy-duty factoring of \nameref{factorize}. The
  506. EZ GCD algorithm was introduced in a paper by J. Moses and D.Y.Y. Yun in
  507. \meta{Proceedings of the ACM}, 1973, pp. 159-166.
  508. Note that the \nameref{gcd} switch must also be on for \name{ezgcd} to have
  509. effect.
  510. \end{Comments}
  511. \end{Switch}
  512. \begin{Switch}{FACTOR}
  513. \index{output}
  514. When the \name{factor} switch is on, input expressions and results are
  515. automatically factored.
  516. \begin{Examples}
  517. on factor; \\
  518. aa := 3*x**3*a + 6*x**2*y*a + 3*x**3*b + 6*x**2*y*b\\
  519. + x*y*a + 2*y**2*a + x*y*b + 2*y**2*b;
  520. & AA := (A + B)*(3*X^{2} + Y)*(X + 2*Y) \\
  521. off factor; \\
  522. aa; &
  523. 3*A*X^{3} + 6*A*X^{2}*Y + A*X*Y + 2*A*Y^{2} + 3*B*X^{3} + 6*B*X^{2}*Y\\
  524. + B*X*Y + 2*B*Y^{2} \\
  525. on factor; \\
  526. ab := x**2 - 2; & AB := X^{2} - 2
  527. \end{Examples}
  528. \begin{Comments}
  529. REDUCE factors univariate and multivariate polynomials with
  530. integer coefficients, finding any factors that also have integer coefficients.
  531. The factoring is done by reducing multivariate problems to univariate
  532. ones with symbolic coefficients, and then solving the univariate ones modulo
  533. small primes. The results of these calculations are merged to
  534. determine the factors of the original polynomial. The factorizer normally
  535. selects evaluation points and primes using a random number generator.
  536. Thus, the detailed factoring behavior may be different each time any
  537. particular problem is tackled.
  538. When the \name{factor} switch is turned on, the \nameref{exp} switch is
  539. turned off, and when the \name{factor} switch is turned off, the
  540. \nameref{exp} switch is turned on, whether it was on previously or not.
  541. When the switch \nameref{trfac} is on, informative messages are generated at
  542. each call to the factorizer. The \nameref{trallfac} switch causes the
  543. production of a more verbose trace message. It takes precedence over
  544. \name{trfac} if they are both on.
  545. To factor a polynomial explicitly and store the results, use the operator
  546. \nameref{factorize}.
  547. \end{Comments}
  548. \end{Switch}
  549. \begin{Switch}{FAILHARD}
  550. \index{integration}
  551. When the \name{failhard} switch is on, the integration operator \nameref{int}
  552. terminates with an error message if the integral cannot be done in closed
  553. terms.
  554. Default is off.
  555. \begin{Comments}
  556. Use the \name{failhard} switch when you are dealing with complicated integrals
  557. and want to know immediately if REDUCE was unable to handle them. The
  558. integration operator sometimes returns a formal integration form that is
  559. more complicated than the original expression, when it is unable to
  560. complete the integration.
  561. \end{Comments}
  562. \end{Switch}
  563. \begin{Switch}{FORT}
  564. \index{FORTRAN}
  565. When \name{fort} is on, output is given Fortran-compatible syntax. Default
  566. is \name{off}.
  567. \begin{Examples}
  568. on fort; \\
  569. df(sin(7*x + y),x); & ANS=7.*COS(7*X+Y) \\
  570. on rounded; \\
  571. b := log(sin(pi/5 + n*pi)); &
  572. B=LOG(SIN(3.14159265359*N+0.628318530718))
  573. \end{Examples}
  574. \begin{Comments}
  575. REDUCE results can be written to a file (using \nameref{out}) and used as data
  576. by Fortran programs when \name{fort} is in effect. \name{fort} knows about
  577. correct statement length, continuation characters, defining a symbol when
  578. it is first used, and other Fortran details.
  579. The \nameref{GENTRAN} package offers many more possibilities than the
  580. \name{fort} switch. It produces Fortran (or C or Ratfor) code from REDUCE
  581. procedures or structured specifications, including facilities for producing
  582. double precision output.
  583. \end{Comments}
  584. \end{Switch}
  585. \begin{Switch}{FORTUPPER}
  586. \index{FORTRAN}
  587. When \name{fortupper} is on, any Fortran-style output appears in upper case.
  588. Default is \name{off}.
  589. \begin{Examples}
  590. on fort; \\
  591. df(sin(7*x + y),x); & ans=7.*cos(7*x+y) \\
  592. on fortupper; \\
  593. df(sin(7*x + y),x); & ANS=7.*COS(7*X+Y) \\
  594. \end{Examples}
  595. \end{Switch}
  596. \begin{Switch}{FULLPREC}
  597. \index{precision}\index{rounded}
  598. Trailing zeroes of rounded numbers to the full system precision are
  599. normally not printed. If this information is needed, for example to get a
  600. more understandable indication of the accuracy of certain data, the switch
  601. \name{fullprec} can be turned on.
  602. \begin{Examples}
  603. on rounded; \\
  604. 1/2; & 0.5 \\
  605. on fullprec; \\
  606. ws; & 0.500000000000
  607. \end{Examples}
  608. \begin{Comments}
  609. This is just an output options which neither influences
  610. the accuracy of the computation nor does it give additional
  611. information about the precision of the results.
  612. See also \nameref{scientific_notation}.
  613. \end{Comments}
  614. \end{Switch}
  615. \begin{Switch}{FULLROOTS}
  616. \index{solve}\index{polynomial}
  617. Since roots of cubic and quartic polynomials can often be very
  618. messy, a switch \name{fullroots} controls the production
  619. of results in closed form. \nameref{solve} will apply the
  620. formulas for explicit forms for degrees 3 and 4 only if
  621. \name{fullroots} is \name{on}. Otherwise the result forms
  622. are built using \nameref{root\_of}. Default is \name{off}.
  623. \end{Switch}
  624. \begin{Switch}{GC}
  625. \index{memory}
  626. With the \name{gc} switch, you can turn the garbage collection messages on
  627. or off. The form of the message depends on the particular Lisp used for
  628. the REDUCE implementation.
  629. \begin{Comments}
  630. See \nameref{reclaim} for an explanation of garbage collection. REDUCE does
  631. garbage collection when needed even if you have turned the notices off.
  632. \end{Comments}
  633. \end{Switch}
  634. \begin{Switch}{GCD}
  635. \index{greatest common divisor}\index{rational expression}
  636. When \name{gcd} is on, common factors in numerators and denominators of
  637. expressions are canceled. Default is \name{off}.
  638. \begin{Examples}
  639. \begin{multilineinput}
  640. (2*(f*h)**2 - f**2*g*h - (f*g)**2 - f*h**3 + f*h*g**2
  641. - h**4 + g*h**3)/(f**2*h - f**2*g - f*h**2 + 2*f*g*h
  642. - f*g**2 - g*h**2 + g**2*h);
  643. \end{multilineinput} &
  644. \rfrac{F^{2}*G^{2} + F^{2}*G*H - 2*F^{2}*H^{2} - F*G^{2}*H + F*H^{3} - G*H^{3} +
  645. H^{4}}
  646. {F^{2}*G - F^{2}*H + F*G^{2} - 2*F*G*H + F*H^{2} - G^{2}*H + G*H^{2}} \\
  647. on gcd; \\
  648. ws; & \rfrac{F*G + 2*F*H + H^{2}}{F + G} \\
  649. e2 := a*c + a*d + b*c + b*d; & E2 := A*C + A*D + B*C + B*D \\
  650. off exp; \\
  651. e2; & (A + B)*(C + D)
  652. \end{Examples}
  653. \begin{Comments}
  654. Even with \name{gcd} off, a check is automatically made for common variable
  655. and numerical products in the numerators and denominators of expression,
  656. and the appropriate cancellations made. Thus the example demonstrating the
  657. use of \name{gcd} is somewhat complicated. Note when \nameref{exp} is off,
  658. \name{gcd} has the side effect of factoring the expression.
  659. \end{Comments}
  660. \end{Switch}
  661. \begin{Switch}{HORNER}
  662. \index{output}\index{polynomial}
  663. When the \name{horner} switch is on, polynomial expressions are printed
  664. in Horner's form for faster and safer numerical evaluation. Default
  665. is \name{off}. The leading variable of the expression is selected as
  666. Horner variable. To select the Horner variable explicitly use the
  667. \nameref{korder} declaration.
  668. \begin{Examples}
  669. on horner;\\
  670. (13p-4q)^3;&
  671. ( - 64)*q^3 + p*(624*q^2 + p*(( - 2028)*q + p*2197))\\
  672. korder q;\\
  673. ws;&
  674. 2197*p^3 + q*(( - 2028)*p^2 + q*(624*p + q*(-64)))
  675. \end{Examples}
  676. \end{Switch}
  677. \begin{Switch}{IFACTOR}
  678. \index{integer}\index{factorize}
  679. When the \name{ifactor} switch is on, any integer terms appearing as a result
  680. of the \nameref{factorize} command are factored themselves into primes. Default
  681. is \name{off}. If the argument of \name{factorize} is an integer,
  682. \name{ifactor} has no effect, since the integer is always factored.
  683. \begin{Examples}
  684. factorize(4*x**2 + 28*x + 48); & \{4,X + 3,X + 4\} \\
  685. factorize(22587); & \{3,7529\} \\
  686. on ifactor; \\
  687. factorize(4*x**2 + 28*x + 48); & \{2,2,X + 4,X + 3\} \\
  688. factorize(22587); & \{3,7529\}
  689. \end{Examples}
  690. \begin{Comments}
  691. Constant terms that appear within nonconstant
  692. polynomial factors are not factored.
  693. The \name{ifactor} switch affects only factoring done specifically
  694. with \nameref{factorize}, not on factoring done automatically when the
  695. \nameref{factor} switch is on.
  696. \end{Comments}
  697. \end{Switch}
  698. \begin{Switch}{INT}
  699. \index{interactive}
  700. The \name{int} switch specifies an interactive mode of operation. Default
  701. \name{on}.
  702. \begin{Comments}
  703. There is no reason to turn \name{int} off during interactive calculations,
  704. since there are no benefits to be gained. If you do have \name{int} off
  705. while inputting a file, and REDUCE finds an error, it prints the message
  706. ``Continuing with parsing only." In this state, REDUCE accepts only
  707. \nameref{end}\name{;} or \nameref{bye}\name{;} from the keyboard;
  708. everything else is ignored, even the command \name{on int}.
  709. \end{Comments}
  710. \end{Switch}
  711. \begin{Switch}{INTSTR}
  712. \index{output}
  713. If \name{intstr} (for ``internal structure'') is on, arguments of an
  714. operator are printed in a more structured form.
  715. \begin{Examples}
  716. operator f; \\
  717. f(2x+2y); & F(2*X + 2*Y) \\
  718. on intstr; \\
  719. ws; & F(2*(X + Y))
  720. \end{Examples}
  721. \end{Switch}
  722. \begin{Switch}{LCM}
  723. \index{rational expression}
  724. The \name{lcm} switch instructs REDUCE to compute the least common multiple
  725. of denominators whenever rational expressions occur. Default is \name{on}.
  726. \begin{Examples}
  727. off lcm; \\
  728. z := 1/(x**2 - y**2) + 1/(x-y)**2;
  729. & Z := \rfrac{2*X*(X - Y)}{X^{4} - 2*X^{3}*Y +
  730. 2*X*Y^{3} - Y^{4}} \\
  731. on lcm; \\
  732. z; & \rfrac{2*X*(X - Y)}{X^{4} - 2*X^{3}*Y + 2*X*Y
  733. ^{3} - Y^{4}} \\
  734. zz := 1/(x**2 - y**2) + 1/(x-y)**2;
  735. & ZZ := \rfrac{2*X}{X^{3} - X^{2}*Y - X*Y^{2} +
  736. Y^{3}} \\
  737. on gcd; \\
  738. z; & \rfrac{2*X}{X^{3} - X^{2}*Y - X*Y^{2} + Y^{3}
  739. }
  740. \end{Examples}
  741. \begin{Comments}
  742. Note that \name{lcm} has effect only when rational expressions are first
  743. combined. It does not examine existing structures for simplifications on
  744. display. That is shown above when \IFTEX{$z$}{z} is entered with
  745. \name{lcm} off. It remains unsimplified even after \name{lcm} is turned
  746. back on. However, a new variable containing the same expression is
  747. simplified on entry. The switch \nameref{gcd} does examine existing
  748. structures, as shown in the last example line above.
  749. Full greatest common divisor calculations become expensive if work with
  750. large rational expressions is required. A considerable savings of time
  751. can be had if a full gcd check is made only when denominators are combined,
  752. and only a partial check for numerators. This is the effect of the \name{lcm}
  753. switch.
  754. \end{Comments}
  755. \end{Switch}
  756. \begin{Switch}{LESSSPACE}
  757. \index{output}
  758. You can turn on the switch \name{lessspace} if you want fewer
  759. blank lines in your output.
  760. \end{Switch}
  761. \begin{Switch}{LIMITEDFACTORS}
  762. \index{factorize}\index{polynomial}
  763. To get limited factorization in cases where it is too expensive to use
  764. full multivariate polynomial factorization, the switch
  765. \name{limitedfactors} can be turned on. In that case, only ``inexpensive''
  766. factoring operations, such as square-free factorization, will be used
  767. when \nameref{factorize} is called.
  768. \begin{Examples}
  769. a := (y-x)^2*(y^3+2x*y+5)*(y^2-3x*y+7)$ \\
  770. factorize a; &
  771. \begin{multilineoutput}{7cm}
  772. \{ - X + Y,
  773. X - Y,
  774. 2*X*Y + Y^{3} + 5,
  775. 3*X*Y - Y^{2} - 7\}
  776. \end{multilineoutput} \\
  777. on limitedfactors; \\
  778. factorize a; &
  779. \begin{multilineoutput}{7cm}
  780. \{ - X + Y,
  781. X - Y,
  782. 6*X^{2}*Y^{2} + 3*X*Y^{4} - 2*X*Y^{3} + X*Y - Y^{5} - 7*Y^{3} - 5*Y^{2} - 35\}
  783. \end{multilineoutput}
  784. \end{Examples}
  785. \end{Switch}
  786. \begin{Switch}{LIST}
  787. The \name{list} switch causes REDUCE to print each term in any sum on
  788. separate lines.
  789. \begin{Examples}
  790. x**2*(y**2 + 2*y) + x*(y**2 + z)/(2*a);
  791. & \rfrac{X*(2*A*X*Y^{2} + 4*A*X*Y + Y^{2} +
  792. Z)}{2*A} \\
  793. on list; \\
  794. ws; &
  795. \begin{multilineoutput}{6cm}
  796. (X*(2*A*X*Y^{2}
  797. + 4*A*X*Y
  798. + Y^{2}
  799. + Z))/(2*A)
  800. \end{multilineoutput}
  801. \end{Examples}
  802. \end{Switch}
  803. \begin{Switch}{LISTARGS}
  804. \index{list}\index{argument}\index{operator}
  805. If an operator other than those specifically defined for lists is given a
  806. single argument that is a list, then the result of this operation will be
  807. a list in which that operator is applied to each element of the list.
  808. This process can be inhibited globally by turning on the switch
  809. \name{listargs}.
  810. \begin{Examples}
  811. log {a,b,c}; & {LOG(A),LOG(B),LOG(C)} \\
  812. on listargs; \\
  813. log {a,b,c}; & LOG({A,B,C})
  814. \end{Examples}
  815. \begin{Comments}
  816. It is possible to inhibit such distribution for a specific operator by
  817. using the declaration \nameref{listargp}. In addition, if an operator has
  818. more than one argument, no such distribution occurs, so \name{listargs}
  819. has no effect.
  820. \end{Comments}
  821. \end{Switch}
  822. \begin{Switch}{MCD}
  823. \index{rational expression}
  824. When \name{mcd} is on, sums and differences of rational expressions are put
  825. on a common denominator. Default is \name{on}.
  826. \begin{Examples}
  827. a/(x+1) + b/5; & \rfrac{5*A + B*X + B}{5*(X + 1)} \\
  828. off mcd; \\
  829. a/(x+1) + b/5; & (X + 1)^{-1}*A + 1/5*B \\
  830. 1/6 + 1/7; & 13/42
  831. \end{Examples}
  832. \begin{Comments}
  833. Even with \name{mcd} off, rational expressions involving only numbers are still
  834. put over a common denominator.
  835. Turning \name{mcd} off is useful when explicit negative powers are needed,
  836. or if no greatest common divisor calculations are desired, or when
  837. differentiating complicated rational expressions. Results when \name{mcd}
  838. is off are no longer in canonical form, and expressions equivalent to zero
  839. may not simplify to 0. Some operations, such as factoring cannot be done
  840. while \name{mcd} is off. This option should therefore be used with some
  841. caution. Turning \name{mcd} off is most valuable in intermediate parts of
  842. a complicated calculation, and should be turned back on for the last stage.
  843. \end{Comments}
  844. \end{Switch}
  845. \begin{Switch}{MODULAR}
  846. \index{modular}
  847. When \name{modular} is on, polynomial coefficients are reduced by the
  848. modulus set by \nameref{setmod}. If no modulus has been set, \name{modular}
  849. has no effect.
  850. \begin{Examples}
  851. setmod 2; & 1 \\
  852. on modular; \\
  853. (x+y)**2; & X^{2} + Y^{2} \\
  854. 145*x**2 + 20*x**3 + 17 + 15*x*y;
  855. & X^{2} + X*Y + 1
  856. \end{Examples}
  857. \begin{Comments}
  858. Modular operations are only conducted on the coefficients, not the
  859. exponents. The modulus is not restricted to being prime. When the modulus
  860. is prime, division by a number not relatively prime to the modulus results
  861. in a \meta{Zero divisor} error message. When the modulus is a composite
  862. number, division by a power of the modulus results in an error message, but
  863. division by an integer which is a factor of the modulus does not.
  864. The representation of modular number can be influenced by
  865. \nameref{balanced\_mod}.
  866. \end{Comments}
  867. \end{Switch}
  868. \begin{Switch}{MSG}
  869. \index{output}
  870. When \name{msg} is off, the printing of warning messages is suppressed. Error
  871. messages are still printed.
  872. \begin{Comments}
  873. Warning messages include those about redimensioning an \nameref{array}
  874. or declaring an \nameref{operator} where one is expected.
  875. \end{Comments}
  876. \end{Switch}
  877. \begin{Switch}{MULTIPLICITIES}
  878. \index{solve}
  879. When \nameref{solve} is applied to a set of equations with multiple roots,
  880. solution multiplicities are normally stored in the global variable
  881. \nameref{root\_multiplicities} rather than the solution list. If you want
  882. the multiplicities explicitly displayed, the switch \name{multiplicities}
  883. should be turned on. In this case, \name{root_multiplicities} has no value.
  884. \begin{Examples}
  885. solve(x^2=2x-1,x); & {X=1} \\
  886. root_multiplicities; & {2} \\
  887. on multiplicities; \\
  888. solve(x^2=2x-1,x); & {X=1,X=1} \\
  889. root_multiplicities; &
  890. \end{Examples}
  891. \end{Switch}
  892. \begin{Switch}{NAT}
  893. \index{output}
  894. When \name{nat} is on, output is printed to the screen in natural form, with
  895. raised exponents. \name{nat} should be turned off when outputting expressions
  896. to a file for future input. Default is \name{on}.
  897. \begin{Examples}
  898. (x + y)**3; & X^{3} + 3*X^{2}*Y + 3*X*Y^{2} + Y^{3} \\
  899. off nat; \\
  900. (x + y)**3; & X**3 + 3*X**2*Y + 3*X*Y**2 + Y**3\$ \\
  901. on fort; \\
  902. (x + y)**3; & ANS=X**3+3.*X**2*Y+3.*X*Y**2+Y**3
  903. \end{Examples}
  904. \begin{Comments}
  905. With \name{nat} off, a dollar sign is printed at the end of each expression.
  906. An output file written with \name{nat} off is ready to be read into REDUCE
  907. using the command \nameref{in}.
  908. \end{Comments}
  909. \end{Switch}
  910. \begin{Switch}{NERO}
  911. \index{output}
  912. When \name{nero} is on, zero assignments (such as matrix elements) are not
  913. printed.
  914. \begin{Examples}
  915. matrix a;
  916. a := mat((1,0),(0,1)); & \begin{multilineoutput}{6cm}
  917. A(1,1) := 1
  918. A(1,2) := 0
  919. A(2,1) := 0
  920. A(2,2) := 1
  921. \end{multilineoutput}\\
  922. on nero; \\
  923. a; & \begin{multilineoutput}{6cm}
  924. MAT(1,1) := 1
  925. MAT(2,2) := 1
  926. \end{multilineoutput}\\
  927. a(1,2); & \explanationo{nothing is printed.} \\
  928. b := 0; & \explanationo{nothing is printed.} \\
  929. off nero; \\
  930. b := 0; & B := 0
  931. \end{Examples}
  932. \begin{Comments}
  933. \name{nero} is often used when dealing with large sparse matrices, to avoid
  934. being overloaded with zero assignments.
  935. \end{Comments}
  936. \end{Switch}
  937. \begin{Switch}{NOARG}
  938. \index{output}\index{derivative}
  939. When \nameref{dfprint} is on, expressions in the differentiation operator
  940. \nameref{df} are printed in a more ``natural'' notation, with the
  941. differentiation variables appearing as subscripts. When \name{noarg}
  942. is on (the default), the arguments of the differentiated operator are also
  943. suppressed.
  944. \begin{Examples}
  945. operator f; \\
  946. df(f x,x); & DF(F(X),X); \\
  947. on dfprint; \\
  948. ws; & F_{X} \\
  949. off noarg; \\
  950. ws; & F(X)_{X}
  951. \end{Examples}
  952. \end{Switch}
  953. \begin{Switch}{NOLNR}
  954. \index{integration}
  955. When \name{nolnr} is on, the linear properties of the integration operator
  956. \nameref{int} are suppressed if the integral cannot be found in closed terms.
  957. \begin{Comments}
  958. REDUCE uses the linear properties of integration to attempt to break down
  959. an integral into manageable pieces. If an integral cannot be found in
  960. closed terms, these pieces are returned. When the \name{nolnr} switch is off,
  961. as many of the pieces as possible are integrated. When it is on, if any piece
  962. fails, the rest of them remain unevaluated.
  963. \end{Comments}
  964. \end{Switch}
  965. %\begin{Switch}{NORNDBF}
  966. %
  967. %***** To be added *****
  968. %
  969. %\end{Switch}
  970. \begin{Switch}{NOSPLIT}
  971. \index{output}
  972. Under normal circumstances, the printing routines try to break an expression
  973. across lines at a natural point. This is a fairly expensive process. If
  974. you are not overly concerned about where the end-of-line breaks come, you
  975. can speed up the printing of expressions by turning off the switch
  976. \name{nosplit}. This switch is normally on.
  977. \end{Switch}
  978. \begin{Switch}{NUMVAL}
  979. \index{rounded}
  980. With \nameref{rounded} on, elementary functions with numerical arguments
  981. will return a numerical answer where appropriate. If you wish to inhibit
  982. this evaluation, \name{numval} should be turned off. It is normally on.
  983. \begin{Examples}
  984. on rounded; \\
  985. cos 3.4; & - 0.966798192579 \\
  986. off numval; \\
  987. cos 3.4; & COS(3.4)
  988. \end{Examples}
  989. \end{Switch}
  990. \begin{Switch}{OUTPUT}
  991. \index{output}
  992. When \name{output} is off, no output is printed from any REDUCE calculation.
  993. The calculations have their usual effects other than printing. Default is
  994. \name{on}.
  995. \begin{Comments}
  996. Turn output \name{off} if you do not wish to see output when executing
  997. large files, or to save the time REDUCE spends formatting large expressions
  998. for display. Results are still available with \nameref{ws}, or in their
  999. assigned variables.
  1000. \end{Comments}
  1001. \end{Switch}
  1002. \begin{Switch}{OVERVIEW}
  1003. \index{factorize}
  1004. When \name{overview} is on, the amount of detail reported by the factorizer
  1005. switches \nameref{trfac} and \nameref{trallfac} is reduced.
  1006. \end{Switch}
  1007. \begin{Switch}{PERIOD}
  1008. \index{output}\index{integer}
  1009. When \name{period} is on, periods are added after integers in
  1010. Fortran-compatible output (when \nameref{fort} is on). There is no effect
  1011. when \name{fort} is off. Default is \name{on}.
  1012. \end{Switch}
  1013. \begin{Switch}{PRECISE}
  1014. \index{simplification}\index{square root}
  1015. When the \name{precise} switch is on, simplification of roots of even
  1016. powers returns absolute values, a more precise answer mathematically.
  1017. Default is \name{on}.
  1018. \begin{Examples}
  1019. sqrt(x**2); & X \\
  1020. (x**2)**(1/4); & SQRT(X) \\
  1021. on precise; \\
  1022. sqrt(x**2); & ABS(X) \\
  1023. (x**2)**(1/4); & SQRT(ABS(X))
  1024. \end{Examples}
  1025. \begin{Comments}
  1026. In many types of mathematical work, simplification of powers and surds can
  1027. proceed by the fastest means of simplifying the exponents arithmetically.
  1028. When it is important to you that the positive root be returned, turn
  1029. \name{precise} on. One situation where this is important is when graphing
  1030. square-root expressions such as \IFTEX{$\sqrt{x^2+y^2}$}{sqrt(x^2+y^2)} to
  1031. avoid a spike caused by REDUCE simplifying
  1032. \IFTEX{$\sqrt{y^2}$}{sqrt(y^2)} to \IFTEX{$y$}{y} when \IFTEX{$x$}{x} is
  1033. zero.
  1034. \end{Comments}
  1035. \end{Switch}
  1036. \begin{Switch}{PRET}
  1037. \index{output}
  1038. When \name{pret} is on, input is printed in standard REDUCE format and then
  1039. evaluated.
  1040. \begin{Examples}
  1041. on pret; \\
  1042. (x+1)^3; &
  1043. \begin{multilineoutput}{6cm}
  1044. (x + 1)**3;
  1045. X^{3} + 3*X^{2} + 3*X + 1
  1046. \end{multilineoutput} \\
  1047. \begin{multilineinput}
  1048. procedure fac(n);
  1049. if not (fixp(n) and n>=0)
  1050. then rederr "Choose nonneg. integer only"
  1051. else for i := 0:n-1 product i+1;
  1052. \end{multilineinput} &
  1053. \begin{multilineoutput}{8cm}
  1054. procedure fac n;
  1055. if not (fixp n and n>=0)
  1056. then rederr "Choose nonneg. integer only"
  1057. else for i := 0:n - 1 product i + 1;
  1058. FAC
  1059. \end{multilineoutput}\\
  1060. fac 5; & \begin{multilineoutput}{6cm}
  1061. fac 5;
  1062. 120
  1063. \end{multilineoutput}
  1064. \end{Examples}
  1065. \begin{Comments}
  1066. Note that all input is converted to lower case except strings (which keep
  1067. the same case) all operators with a single argument have had the
  1068. parentheses removed, and all infix operators have had a space added on each
  1069. side. In addition, syntactical constructs like
  1070. \name{if}\ldots\name{then}\ldots\name{else} are printed in a standard format.
  1071. \end{Comments}
  1072. \end{Switch}
  1073. \begin{Switch}{PRI}
  1074. \index{output}
  1075. When \name{pri} is on, the declarations \nameref{order} and \nameref{factor} can
  1076. be used, and the switches \nameref{allfac}, \nameref{div}, \nameref{rat},
  1077. and \nameref{revpri} take effect when they are on. Default is \name{on}.
  1078. \begin{Comments}
  1079. Printing of expressions is faster with \name{pri} off. The expressions are
  1080. then returned in one standard form, without any of the display options that
  1081. can be used to feature or display various parts of the expression. You can
  1082. also gain insight into REDUCE's representation of expressions with
  1083. \name{pri} off.
  1084. \end{Comments}
  1085. \end{Switch}
  1086. \begin{Switch}{RAISE}
  1087. \index{input}\index{character}
  1088. When \name{raise} is on, lower case letters are automatically converted to
  1089. upper case on input. \name{raise} is normally on.
  1090. \begin{Comments}
  1091. This conversion affects the internal representation of the letter, and is
  1092. independent of the case with which a letter is printed, which is normally
  1093. lower case.
  1094. \end{Comments}
  1095. \end{Switch}
  1096. \begin{Switch}{RAT}
  1097. \index{output}
  1098. When the \name{rat} switch is on, and kernels have been selected to display
  1099. with the \nameref{factor} declaration, the denominator is printed with each
  1100. term rather than one common denominator at the end of an expression.
  1101. \begin{Examples}
  1102. (x+1)/x + x**2/sin y;
  1103. & \rfrac{SIN(Y)*X + SIN(Y) + X^{3}}{SIN(Y)*X} \
  1104. \
  1105. factor x; \\
  1106. (x+1)/x + x**2/sin y;
  1107. & \rfrac{X^{3} + X*SIN(Y) + SIN(Y)}{X*SIN(Y)} \
  1108. \
  1109. on rat; \\
  1110. (x+1)/x + x**2/sin y;
  1111. & \rfrac{X^{2}}{SIN(Y)} + 1 + X^{-1}
  1112. \end{Examples}
  1113. \begin{Comments}
  1114. The \name{rat} switch only has effect when the \nameref{pri} switch is on.
  1115. When \name{pri} is off, regardless of the setting of \name{rat}, the
  1116. printing behavior is as if \name{rat} were off. \name{rat} only has
  1117. effect upon the display of expressions, not their internal form.
  1118. \end{Comments}
  1119. \end{Switch}
  1120. \begin{Switch}{RATARG}
  1121. \index{rational expression}\index{polynomial}
  1122. When \name{ratarg} is on, rational expressions can be given to operators
  1123. such as \nameref{coeff} and \nameref{lterm} that normally require
  1124. polynomials in one of their arguments. When \name{ratarg} is off, rational
  1125. expressions cause an error message.
  1126. \begin{Examples}
  1127. aa := x/y**2 + 1/x + y/x**2;
  1128. & AA := \rfrac{X^{3} + X*Y^{2} + Y^{3}}{X^{2}*Y^{2}} \\
  1129. coeff(aa,x); &
  1130. ***** \rfrac{X^{3} + X*Y^{2} + Y^{3}}{X^{2}*Y^{2}} invalid as POLYNOMIAL\\
  1131. on ratarg; \\
  1132. coeff(aa,x);
  1133. & \{\rfrac{Y}{X^{2}},\rfrac{1}{X^{2}},0,\rfrac{1}{X^{2}*Y^{2}}\}
  1134. \end{Examples}
  1135. \end{Switch}
  1136. \begin{Switch}{RATIONAL}
  1137. \index{rational expression}\index{polynomial}
  1138. When \name{rational} is on, polynomial expressions with rational coefficients
  1139. are produced.
  1140. \begin{Examples}
  1141. x/2 + 3*y/4; & \rfrac{2*X + 3*Y}{4} \\
  1142. (x**2 + 5*x + 17)/2; & \rfrac{X^{2} + 5*X + 17}{2} \\
  1143. on rational; \\
  1144. x/2 + 3y/4; & \rfrac{1}{2}*(X + \rfrac{3}{2}*Y) \\
  1145. (x**2 + 5*x + 17)/2; & \rfrac{1}{2}*(X^{2} + 5*X + 17)
  1146. \end{Examples}
  1147. \begin{Comments}
  1148. By using \name{rational}, polynomial expressions with rational
  1149. coefficients can be used in some commands that expect polynomials. With
  1150. \name{rational} off, such a polynomial becomes a rational expression, with
  1151. denominator the least common multiple of the denominators of the rational
  1152. number coefficients. % The \nameref{factorize} command does not accept
  1153. % polynomials with rational coefficients.
  1154. \end{Comments}
  1155. \end{Switch}
  1156. \begin{Switch}{RATIONALIZE}
  1157. \index{rational expression}\index{simplification}\index{complex}
  1158. When the \name{rationalize} switch is on, denominators of rational expressions
  1159. that contain complex numbers or root expressions are simplified by
  1160. multiplication by their conjugates.
  1161. \begin{Examples}
  1162. qq := (1+sqrt(3))/(sqrt(3)-7); & QQ := \rfrac{SQRT(3) + 1}{SQRT(3) - 7} \\
  1163. on rationalize; \\
  1164. qq; & \rfrac{- 4*SQRT(3) - 5}{23} \\
  1165. 2/(4 + 6**(1/3)); & \rfrac{6^{2/3} - 4*6^{1/3} + 16}{35} \\
  1166. (i-1)/(i+3); & \rfrac{2*I - 1}{5} \\
  1167. off rationalize; \\
  1168. (i-1)/(i+3); & \rfrac{I - 1}{I + 3}
  1169. \end{Examples}
  1170. \end{Switch}
  1171. \begin{Switch}{RATPRI}
  1172. \index{output}\index{rational expression}
  1173. When the \name{ratpri} switch is on, rational expressions and fractions are
  1174. printed as two lines separated by a fraction bar, rather than in a linear
  1175. style. Default is \name{on}.
  1176. \begin{Examples}
  1177. 3/17; & \rfrac{3}{17} \\
  1178. 2/b + 3/y; & \rfrac{3*B + 2*Y}{B*Y} \\
  1179. off ratpri; \\
  1180. 3/17; & 3/17 \\
  1181. 2/b + 3/y; & (3*B + 2*Y)/(B*Y)
  1182. \end{Examples}
  1183. \end{Switch}
  1184. \begin{Switch}{REVPRI}
  1185. \index{output}
  1186. When the \name{revpri} switch is on, terms are printed in reverse order from
  1187. the normal printing order.
  1188. \begin{Examples}
  1189. x**5 + x**2 + 18 + sqrt(y); & SQRT(Y) + X^{5} + X^{2} + 18 \\
  1190. a + b + c + w; & A + B + C + W \\
  1191. on revpri; \\
  1192. x**5 + x**2 + 18 + sqrt(y); & 17 + X^{2} + X^{5} + SQRT(Y) \\
  1193. a + b + c + w; & W + C + B + A
  1194. \end{Examples}
  1195. \begin{Comments}
  1196. Turn \name{revpri} on when you want to display a polynomial in ascending
  1197. rather than descending order.
  1198. \end{Comments}
  1199. \end{Switch}
  1200. \begin{Switch}{RLISP88}
  1201. \index{lisp}
  1202. Rlisp '88 is a superset of the Rlisp that has been traditionally used for
  1203. the support of REDUCE. It is fully documented in the book Marti, J.B.,
  1204. ``{RLISP} '88: An Evolutionary Approach to Program Design and Reuse'',
  1205. World Scientific, Singapore (1993). It supports different looping
  1206. constructs from the traditional Rlisp, and treats ``-'' as a letter unless
  1207. separated by spaces. Turning on the switch \name{rlisp88} converts to
  1208. Rlisp '88 parsing conventions in symbolic mode, and enables the use of
  1209. Rlisp '88 extensions. Turning off the switch reverts to the traditional
  1210. Rlisp and the previous mode ( (\nameref{symbolic} or \nameref{algebraic})
  1211. in force before \name{rlisp88} was turned on.
  1212. \end{Switch}
  1213. \begin{Switch}{ROUNDALL}
  1214. \index{rounded}\index{rational expression}\index{floating point}
  1215. In \nameref{rounded} mode, rational numbers are normally converted to a
  1216. floating point representation. If \name{roundall} is off, this conversion
  1217. does not occur. \name{roundall} is normally \name{on}.
  1218. \begin{Examples}
  1219. on rounded; \\
  1220. 1/2; & 0.5 \\
  1221. off roundall; \\
  1222. 1/2; \rfrac{1}{2}
  1223. \end{Examples}
  1224. \end{Switch}
  1225. \begin{Switch}{ROUNDBF}
  1226. When \nameref{rounded} is on, the normal defaults cause underflows to be
  1227. converted to zero. If you really want the small number that results in
  1228. such cases, \name{roundbf} can be turned on.
  1229. \begin{Examples}
  1230. on rounded; \\
  1231. exp(-100000.1^2); & 0 \\
  1232. on roundbf; \\
  1233. exp(-100000.1^2); & 1.18441281937E-4342953505
  1234. \end{Examples}
  1235. \begin{Comments}
  1236. If a polynomial is input in \nameref{rounded} mode at the default
  1237. precision into any \nameref{roots} function, and it is not possible to
  1238. represent any of the coefficients of the polynomial precisely in the
  1239. system floating point representation, the switch \name{roundbf} will be
  1240. automatically turned on. All rounded computation will use the internal
  1241. bigfloat representation until the user subsequently turns \name{roundbf}
  1242. off. (A message is output to indicate that this condition is in effect.)
  1243. \end{Comments}
  1244. \end{Switch}
  1245. \begin{Switch}{ROUNDED}
  1246. \index{floating point}
  1247. When \name{rounded} is on, floating-point arithmetic is enabled, with
  1248. precision initially at a system default value, which is usually 12 digits.
  1249. The precise number can be found by the command \nameref{precision}(0).
  1250. \begin{Examples}
  1251. pi; & PI \\
  1252. 35/217; & \rfrac{5}{31} \\
  1253. on rounded; \\
  1254. pi; & 3.14159265359 \\
  1255. 35/217; & 0.161 \\
  1256. sqrt(3); & 1.73205080756
  1257. \end{Examples}
  1258. \begin{Comments}
  1259. If more than the default number of decimal places are required, use the
  1260. \nameref{precision} command to set the required number.
  1261. \end{Comments}
  1262. \end{Switch}
  1263. \begin{Switch}{SAVESTRUCTR}
  1264. \index{STRUCTR OPERATOR}
  1265. When \name{savestructr} is on, results of the \nameref{structr} command are
  1266. returned as a list whose first element is the representation for the
  1267. expression and the remaining elements are equations showing the
  1268. relationships of the generated variables.
  1269. \begin{Examples}
  1270. off exp; \\
  1271. structr((x+y)^3 + sin(x)^2); &
  1272. \begin{multilineoutput}{6cm}
  1273. ANS3
  1274. where
  1275. ANS3 := ANS1^{3} + ANS2^{2}
  1276. ANS2 := SIN(X)
  1277. ANS1 := X + Y
  1278. \end{multilineoutput}\\
  1279. ans3; & ANS3 \\
  1280. on savestructr; \\
  1281. structr((x+y)^{3} + sin(x)^{2}); &
  1282. {ANS3,ANS3=ANS1^{3} + ANS2^{2},ANS2=SIN(X),ANS1=X + Y} \\
  1283. ans3 where rest ws; &
  1284. (X + Y)^{3} + SIN(X)^{2}
  1285. \end{Examples}
  1286. \begin{Comments}
  1287. In normal operation, \nameref{structr} is only a display command. With
  1288. \name{savestructr} on, you can access the various parts of the expression
  1289. produced by \name{structr}.
  1290. The generic system names use the stem \name{ANS}. You can change this to your
  1291. own stem by the command \nameref{varname}. REDUCE adds integers to this stem
  1292. to make unique identifiers.
  1293. \end{Comments}
  1294. \end{Switch}
  1295. \begin{Switch}{SOLVESINGULAR}
  1296. \index{solve}
  1297. When \name{solvesingular} is on, singular or underdetermined systems of
  1298. linear equations are solved, using arbitrary real, complex or integer
  1299. variables in the answer. Default is \name{on}.
  1300. \begin{Examples}
  1301. solve({2x + y,4x + 2y},{x,y}); &
  1302. \{\{X= - \rfrac{ARBCOMPLEX(1)}{2},Y=ARBCOMPLEX(1)\}\} \\
  1303. solve({7x + 15y - z,x - y - z},{x,y,z}); &
  1304. \begin{multilineoutput}{6cm}
  1305. \{\{X=\rfrac{8*ARBCOMPLEX(3)}{11}
  1306. Y= - \rfrac{3*ARBCOMPLEX(3)}{11}
  1307. Z=ARBCOMPLEX(3)\}\}
  1308. \end{multilineoutput}\\
  1309. off solvesingular; \\
  1310. solve({2x + y,4x + 2y},{x,y}); &
  1311. ***** SOLVE given singular equations \\
  1312. solve({7x + 15y - z,x - y - z},{x,y,z}); &
  1313. ***** SOLVE given singular equations
  1314. \end{Examples}
  1315. \begin{Comments}
  1316. The integer following the identifier \nameref{arbcomplex} above is assigned by
  1317. the system, and serves to identify the variable uniquely. It has no other
  1318. significance.
  1319. \end{Comments}
  1320. \end{Switch}
  1321. \begin{Switch}{TIME}
  1322. \index{time}
  1323. When \name{time} is on, the system time used in executing each REDUCE
  1324. statement is printed after the answer is printed.
  1325. \begin{Examples}
  1326. on time; & Time: 4940 ms \\
  1327. df(sin(x**2 + y),y); &
  1328. \begin{multilineoutput}{6cm}
  1329. COS(X + Y^{2})
  1330. Time: 180 ms
  1331. \end{multilineoutput}\\
  1332. solve(x**2 - 6*y,x); &
  1333. \begin{multilineoutput}{6cm}
  1334. \{X= - SQRT(Y)*SQRT(6),
  1335. X=SQRT(Y)*SQRT(6)\}
  1336. Time: 320 ms
  1337. \end{multilineoutput}
  1338. \end{Examples}
  1339. \begin{Comments}
  1340. When \name{time} is first turned on, the time since the beginning of the
  1341. REDUCE session is printed. After that, the time used in computation,
  1342. (usually in milliseconds, though this is system dependent) is printed after
  1343. the results of each command. Idle time or time spent typing in commands is
  1344. not counted. If \name{time} is turned off, the first reading after it is
  1345. turned on again gives the time elapsed since it was turned off. The time
  1346. printed is CPU or wall clock time, depending on the system.
  1347. \end{Comments}
  1348. \end{Switch}
  1349. \begin{Switch}{TRALLFAC}
  1350. \index{factorize}
  1351. When \name{trallfac} is on, a more detailed trace of factorizer calls is
  1352. generated.
  1353. \begin{Comments}
  1354. The \name{trallfac} switch takes precedence over \nameref{trfac} if they are
  1355. both on. \name{trfac} gives a factorization trace with less detail in it.
  1356. When the \nameref{factor} switch is on also, all input polynomials are sent to
  1357. the factorizer automatically and trace information is generated. The
  1358. \nameref{out} command saves the results of the factoring, but not the trace.
  1359. % You need to use the \name{dribble} command to save the trace text to a file.
  1360. \end{Comments}
  1361. \end{Switch}
  1362. \begin{Switch}{TRFAC}
  1363. \index{factorize}
  1364. When \name{trfac} is on, a narrative trace of any calls to the factorizer is
  1365. generated. Default is \name{off}.
  1366. \begin{Comments}
  1367. When the switch \nameref{factor} is on, and \name{trfac} is on, every input
  1368. polynomial is sent to the factorizer, and a trace generated. With
  1369. \name{factor} off, only polynomials that are explicitly factored with the
  1370. command \nameref{factorize} generate trace information.
  1371. % Use the \name{dribble} or \name{logfile} command to save the trace text to
  1372. % a file.
  1373. The \nameref{out} command saves the results of the factoring, but not
  1374. the trace. The \nameref{trallfac} switch gives trace information to a
  1375. greater level of detail.
  1376. \end{Comments}
  1377. \end{Switch}
  1378. \begin{Switch}{TRIGFORM}
  1379. \index{solve}\index{polynomial}
  1380. When \nameref{fullroots} is on, \nameref{solve} will compute the
  1381. roots of a cubic or quartic polynomial is closed form. When
  1382. \name{trigform} is on, the roots will be expressed by trigonometric
  1383. forms. Otherwise nested surds are used. Default is \name{on}.
  1384. \end{Switch}
  1385. \begin{Switch}{TRINT}
  1386. \index{integration}
  1387. When \name{trint} is on, a narrative tracing various steps in the
  1388. integration process is produced.
  1389. \begin{Comments}
  1390. %Use the \name{dribble} or \name{logfile} command to save this text to a file.
  1391. The \nameref{out} command saves the results of the integration, but not the
  1392. trace.
  1393. \end{Comments}
  1394. \end{Switch}
  1395. \begin{Switch}{TRNONLNR}
  1396. \index{solve}
  1397. When \name{trnonlnr} is on, a narrative tracing various steps in
  1398. the process for solving non-linear equations is produced.
  1399. \begin{Comments}
  1400. \name{trnonlnr} can only be used after the solve package has been loaded
  1401. (e.g., by an explicit call of \nameref{load\_package}). The \nameref{out}
  1402. command saves the results of the equation solving, but not the trace.
  1403. \end{Comments}
  1404. \end{Switch}
  1405. \begin{Switch}{VAROPT}
  1406. \index{solve}
  1407. When \name{varopt} is on, the sequence of variables is optimized by
  1408. \nameref{solve} with respect to execution speed. Otherwise, the sequence
  1409. given in the call to \nameref{solve} is preserved. Default is \name{on}.
  1410. In combination with the switch \nameref{arbvars}, \name{varopt} can be used
  1411. to control variable elimination.
  1412. \begin{Examples}
  1413. off arbvars; \\
  1414. solve({x+2z,x-3y},{x,y,z}); &
  1415. \{\{y=\rfrac{x}{3},z= - \rfrac{x}{2}\}\} \\
  1416. solve({x*y=1,z=x},{x,y,z}); &
  1417. \{\{z=x,y=\rfrac{1}{x}\}\} \\
  1418. off varopt; \\
  1419. solve({x+2z,x-3y},{x,y,z}); &
  1420. \{\{x= - 2*z,y= - \rfrac{2*z}{3}\}\} \\
  1421. solve({x*y=1,z=x},{x,y,z}); &
  1422. \{\{y=\rfrac{1}{z},x=z\}\} \\
  1423. \end{Examples}
  1424. \end{Switch}