Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code
[maxima.git] / doc / info / Command.texi
blob438ad22c97b6bd4904684e5d0ed3d053d8056954
1 @menu
2 * Introduction to Command Line::
3 * Functions and Variables for Command Line::
4 * Functions and Variables for Display::
5 @end menu
7 @c -----------------------------------------------------------------------------
8 @node Introduction to Command Line, Functions and Variables for Command Line, Command Line, Command Line
9 @section Introduction to Command Line
10 @c -----------------------------------------------------------------------------
12 This section documents Maxima's interactive command-line interface,
13 called a read-eval-print loop (REPL).
15 For information on command-line options, see @mrefdot{command_line_options}
16 @c end concepts Command Line
18 @c -----------------------------------------------------------------------------
19 @node Functions and Variables for Command Line, Functions and Variables for Display, Introduction to Command Line, Command Line
20 @section Functions and Variables for Command Line
21 @c -----------------------------------------------------------------------------
23 @c -----------------------------------------------------------------------------
24 @anchor{__}
25 @defvr {System variable} __
26 @vrindex Current input expression
28 @code{__} is the input expression currently being evaluated.  That is, while an
29 input expression @var{expr} is being evaluated, @code{__} is @var{expr}.
31 @code{__} is assigned the input expression before the input is simplified or
32 evaluated.  However, the value of @code{__} is simplified (but not evaluated)
33 when it is displayed.
35 @code{__} is recognized by @mref{batch} and @mrefdot{load}  In a file processed
36 by @code{batch}, @code{__} has the same meaning as at the interactive prompt.
37 In a file processed by @code{load}, @code{__} is bound to the input expression
38 most recently entered at the interactive prompt or in a batch file; @code{__}
39 is not bound to the input expressions in the file being processed.  In
40 particular, when @code{load (@var{filename})} is called from the interactive
41 prompt, @code{__} is bound to @code{load (@var{filename})} while the file is
42 being processed.
44 See also @mref{_} and @mrefdot{%}
46 Examples:
48 @c ===beg===
49 @c print ("I was called as", __);
50 @c foo (__);
51 @c g (x) := (print ("Current input expression =", __), 0);
52 @c [aa : 1, bb : 2, cc : 3];
53 @c (aa + bb + cc)/(dd + ee + g(x));
54 @c ===end===
55 @example
56 @group
57 (%i1) print ("I was called as", __);
58 I was called as print(I was called as, __) 
59 (%o1)              print(I was called as, __)
60 @end group
61 @group
62 (%i2) foo (__);
63 (%o2)                     foo(foo(__))
64 @end group
65 @group
66 (%i3) g (x) := (print ("Current input expression =", __), 0);
67 (%o3) g(x) := (print("Current input expression =", __), 0)
68 @end group
69 @group
70 (%i4) [aa : 1, bb : 2, cc : 3];
71 (%o4)                       [1, 2, 3]
72 @end group
73 @group
74 (%i5) (aa + bb + cc)/(dd + ee + g(x));
75                             cc + bb + aa
76 Current input expression = -------------- 
77                            g(x) + ee + dd
78                                 6
79 (%o5)                        -------
80                              ee + dd
81 @end group
82 @end example
84 @opencatbox{Categories:}
85 @category{Global variables}
86 @closecatbox
87 @end defvr
89 @c -----------------------------------------------------------------------------
90 @anchor{_}
91 @defvr {System variable} _
92 @vrindex Previous input
94 @code{_} is the most recent input expression (e.g., @code{%i1}, @code{%i2},
95 @code{%i3}, @dots{}).
97 @code{_} is assigned the input expression before the input is simplified or
98 evaluated.  However, the value of @code{_} is simplified (but not evaluated)
99 when it is displayed.
101 @code{_} is recognized by @mref{batch} and @mrefdot{load}  In a file processed
102 by @code{batch}, @code{_} has the same meaning as at the interactive prompt.
103 In a file processed by @code{load}, @code{_} is bound to the input expression
104 most recently evaluated at the interactive prompt or in a batch file; @code{_}
105 is not bound to the input expressions in the file being processed.
107 See also @mref{__} and @mrefdot{%}
109 Examples:
111 @c ===beg===
112 @c 13 + 29;
113 @c :lisp $_
114 @c _;
115 @c sin (%pi/2);
116 @c :lisp $_
117 @c _;
118 @c a: 13$
119 @c b: 29$
120 @c a + b;
121 @c :lisp $_
122 @c _;
123 @c a + b;
124 @c ev (_);
125 @c ===end===
126 @example
127 @group
128 (%i1) 13 + 29;
129 (%o1)                          42
130 @end group
131 @group
132 (%i2) :lisp $_
133 ((MPLUS) 13 29)
134 @end group
135 @group
136 (%i2) _;
137 (%o2)                          42
138 @end group
139 @group
140 (%i3) sin (%pi/2);
141 (%o3)                           1
142 @end group
143 @group
144 (%i4) :lisp $_
145 ((%SIN) ((MQUOTIENT) $%PI 2))
146 @end group
147 @group
148 (%i4) _;
149 (%o4)                           1
150 @end group
151 (%i5) a: 13$
152 (%i6) b: 29$
153 @group
154 (%i7) a + b;
155 (%o7)                          42
156 @end group
157 @group
158 (%i8) :lisp $_
159 ((MPLUS) $A $B)
160 @end group
161 @group
162 (%i8) _;
163 (%o8)                         b + a
164 @end group
165 @group
166 (%i9) a + b;
167 (%o9)                          42
168 @end group
169 @group
170 (%i10) ev (_);
171 (%o10)                         42
172 @end group
173 @end example
175 @opencatbox{Categories:}
176 @category{Console interaction}
177 @category{Global variables}
178 @closecatbox
179 @end defvr
181 @c -----------------------------------------------------------------------------
182 @anchor{%}
183 @defvr {System variable} %
184 @vrindex Previous output
186 @code{%} is the output expression (e.g., @code{%o1}, @code{%o2}, @code{%o3},
187 @dots{}) most recently computed by Maxima, whether or not it was displayed.
189 @code{%} is recognized by @mref{batch} and @mrefdot{load}  In a file processed
190 by @code{batch}, @code{%} has the same meaning as at the interactive prompt.
191 In a file processed by @code{load}, @code{%} is bound to the output expression
192 most recently computed at the interactive prompt or in a batch file; @code{%}
193 is not bound to output expressions in the file being processed.
195 See also @mrefcomma{_} @mrefcomma{%%} and @mrefdot{%th}
197 @opencatbox{Categories:}
198 @category{Console interaction}
199 @category{Global variables}
200 @closecatbox
201 @end defvr
203 @c -----------------------------------------------------------------------------
204 @anchor{%%}
205 @defvr {System variable} %%
206 @vrindex Previous result in compound expression
208 In compound statements, namely @mrefcomma{block} @mrefcomma{lambda} or
209 @code{(@var{s_1}, ..., @var{s_n})}, @code{%%} is the value of the previous
210 statement.
212 At the first statement in a compound statement, or outside of a compound
213 statement, @code{%%} is undefined.
215 @code{%%} is recognized by @mref{batch} and @mrefcomma{load} and it has the
216 same meaning as at the interactive prompt.
218 See also @mrefdot{%}
220 Examples:
222 The following two examples yield the same result.
224 @example
225 (%i1) block (integrate (x^5, x), ev (%%, x=2) - ev (%%, x=1));
226                                21
227 (%o1)                          --
228                                2
229 (%i2) block ([prev], prev: integrate (x^5, x),
230                ev (prev, x=2) - ev (prev, x=1));
231                                21
232 (%o2)                          --
233                                2
235 @end example
237 A compound statement may comprise other compound statements.  Whether a
238 statement be simple or compound, @code{%%} is the value of the previous
239 statement.
241 @example
242 (%i3) block (block (a^n, %%*42), %%/6);
243                                  n
244 (%o3)                         7 a
245 @end example
247 Within a compound statement, the value of @code{%%} may be inspected at a break
248 prompt, which is opened by executing the @mref{break} function.  For example,
249 entering @code{%%;} in the following example yields @code{42}.
251 @example
252 (%i4) block (a: 42, break ())$
254 Entering a Maxima break point. Type 'exit;' to resume.
255 _%%;
258 @end example
260 @opencatbox{Categories:}
261 @category{Global variables}
262 @closecatbox
263 @end defvr
265 @c -----------------------------------------------------------------------------
266 @anchor{%th}
267 @fnindex N'th previous output
268 @deffn {Function} %th (@var{i})
270 The value of the @var{i}'th previous output expression.  That is, if the next
271 expression to be computed is the @var{n}'th output, @code{%th (@var{m})} is the
272 (@var{n} - @var{m})'th output.
274 @code{%th} is recognized by @mref{batch} and @mrefdot{load}  In a file processed
275 by @code{batch}, @code{%th} has the same meaning as at the interactive prompt.
276 In a file processed by @code{load}, @code{%th} refers to output expressions most
277 recently computed at the interactive prompt or in a batch file; @code{%th} does
278 not refer to output expressions in the file being processed.
280 See also @mref{%} and @mrefdot{%%}
282 Example:
284 @code{%th} is useful in @code{batch} files or for referring to a group of
285 output expressions.  This example sets @code{s} to the sum of the last five
286 output expressions.
288 @example
289 (%i1) 1;2;3;4;5;
290 (%o1)                           1
291 (%o2)                           2
292 (%o3)                           3
293 (%o4)                           4
294 (%o5)                           5
295 (%i6) block (s: 0, for i:1 thru 5 do s: s + %th(i), s);
296 (%o6)                          15
297 @end example
299 @opencatbox{Categories:}
300 @category{Console interaction}
301 @closecatbox
302 @end deffn
304 @c -----------------------------------------------------------------------------
305 @anchor{?}
306 @fnindex Fetch documentation
307 @deffn {Special symbol} ?
309 As prefix to a function or variable name, @code{?} signifies that the name is a
310 Lisp name, not a Maxima name.  For example, @code{?round} signifies the Lisp
311 function @code{ROUND}.  See @ref{Lisp and Maxima} for more on this point.
313 The notation @code{? word} (a question mark followed a word, separated by
314 whitespace) is equivalent to @code{describe("word")}.  The question mark must
315 occur at the beginning of an input line; otherwise it is not recognized as a
316 request for documentation.  See also @mrefdot{describe}
318 @opencatbox{Categories:}
319 @category{Help}
320 @category{Console interaction}
321 @closecatbox
322 @end deffn
324 @c -----------------------------------------------------------------------------
325 @anchor{??}
326 @fnindex Fetch documentation (inexact search)
327 @deffn {Special symbol} ??
329 The notation @code{?? word} (@code{??} followed a word, separated by whitespace)
330 is equivalent to @code{describe("word", inexact)}.  The question mark must occur
331 at the beginning of an input line; otherwise it is not recognized as a request
332 for documentation.  See also @mrefdot{describe}
334 @opencatbox{Categories:}
335 @category{Help}
336 @category{Console interaction}
337 @closecatbox
338 @end deffn
340 @c -----------------------------------------------------------------------------
341 @anchor{$}
342 @fnindex Input terminator (without display)
343 @deffn {Input terminator} $
345 The dollar sign @code{$} terminates an input expression,
346 and the most recent output @code{%} and an output label, e.g. @code{%o1},
347 are assigned the result, but the result is not displayed.
349 See also @mrefdot{;}
351 Example:
352 @c ===beg===
353 @c 1 + 2 + 3 $
354 @c %;
355 @c %o1;
356 @c ===end===
357 @example
358 (%i1) 1 + 2 + 3 $
359 @group
360 (%i2) %;
361 (%o2)                           6
362 @end group
363 @group
364 (%i3) %o1;
365 (%o3)                           6
366 @end group
367 @end example
368 @end deffn
370 @c -----------------------------------------------------------------------------
371 @anchor{;}
372 @deffn {Input terminator} ;
374 The semicolon @code{;} terminates an input expression,
375 and the resulting output is displayed.
377 See also @mrefdot{$}
379 Example:
380 @c ===beg===
381 @c 1 + 2 + 3;
382 @c ===end===
383 @example
384 @group
385 (%i1) 1 + 2 + 3;
386 (%o1)                           6
387 @end group
388 @end example
389 @end deffn
391 @c -----------------------------------------------------------------------------
392 @anchor{inchar}
393 @defvr {Option variable} inchar
394 Default value: @code{%i}
396 @code{inchar} is the prefix of the labels of expressions entered by the user.
397 Maxima automatically constructs a label for each input expression by 
398 concatenating @code{inchar} and @mrefdot{linenum}
400 @code{inchar} may be assigned any string or symbol, not necessarily a single 
401 character.  Because Maxima internally takes into account only the first char of
402 the prefix, the prefixes @code{inchar}, @mrefcomma{outchar} and
403 @mref{linechar} should have a different first char.  Otherwise some commands
404 like @code{kill(inlabels)} do not work as expected.
406 See also @mrefdot{labels}
408 Example:
410 @c ===beg===
411 @c inchar: "input";
412 @c expand((a+b)^3);
413 @c ===end===
414 @example
415 @group
416 (%i1) inchar: "input";
417 (%o1)                         input
418 @end group
419 @group
420 (input2) expand((a+b)^3);
421                      3        2      2      3
422 (%o2)               b  + 3 a b  + 3 a  b + a
423 @end group
424 @end example
426 @opencatbox{Categories:}
427 @category{Display flags and variables}
428 @closecatbox
429 @end defvr
431 @c -----------------------------------------------------------------------------
432 @anchor{infolists}
433 @defvr {System variable} infolists
434 Default value: @code{[]}
436 @code{infolists} is a list of the names of all of the information
437 lists in Maxima.  These are:
439 @table @code
440 @item labels
441 All bound @code{%i}, @code{%o}, and @code{%t} labels.
442 @item values
443 All bound atoms which are user variables, not Maxima options or switches,
444 created by @mref{:} or @mref{::} or functional binding.
445 @c WHAT IS INTENDED BY "FUNCTIONAL BINDING" HERE ??
446 @item functions
447 All user-defined functions, created by @mref{:=} or @mrefdot{define}
448 @item arrays
449 All arrays, @mref{hashed arrays} and @mref{memoizing functions}.
450 @item macros
451 All user-defined macro functions, created by @mrefdot{::=}
452 @item myoptions
453 All options ever reset by the user (whether or not they
454 are later reset to their default values).
455 @item rules
456 All user-defined pattern matching and simplification rules, created
457 by @mrefcomma{tellsimp} @mrefcomma{tellsimpafter} @mrefcomma{defmatch} or
458 @mrefdot{defrule}
459 @item aliases
460 All atoms which have a user-defined alias, created by the @mrefcomma{alias}@w{}
461 @mrefcomma{ordergreat} @mref{orderless} functions or by declaring the atom as a
462 @mref{noun} with @mrefdot{declare}
463 @item dependencies
464 All atoms which have functional dependencies, created by the
465 @mref{depends}, @mref{dependencies}, or @mref{gradef} functions.
466 @item gradefs
467 All functions which have user-defined derivatives, created by the
468 @mref{gradef} function.
469 @c UMM, WE REALLY NEED TO BE SPECIFIC -- WHAT DOES "ETC" CONTAIN HERE ??
470 @item props
471 All atoms which have any property other than those mentioned above, such as
472 properties established by @mref{atvalue} or @mref{matchdeclare}, etc.,
473 as well as properties established in the @mref{declare} function.
474 @item structures
475 @c Is also documented in Structures.texi. But it definitively is an infolist
476 @c so it has to be documented here, too.
477 All structs defined using @mrefdot{defstruct}
478 @item let_rule_packages
479 All user-defined @mref{let} rule packages
480 plus the special package @mrefdot{default_let_rule_package}
481 (@code{default_let_rule_package} is the name of the rule package used when
482 one is not explicitly set by the user.)
483 @end table
485 @opencatbox{Categories:}
486 @category{Declarations and inferences}
487 @category{Global variables}
488 @closecatbox
489 @end defvr
491 @c REVIEW FOR ACCURACY AND COMPLETENESS
492 @c THIS ITEM IS VERY IMPORTANT !!
493 @c NEEDS EXAMPLES
495 @c -----------------------------------------------------------------------------
496 @anchor{kill}
497 @deffn  {Function} kill @
498 @fname{kill} (@var{a_1}, @dots{}, @var{a_n}) @
499 @fname{kill} (labels) @
500 @fname{kill} (inlabels, outlabels, linelabels) @
501 @fname{kill} (@var{n}) @
502 @fname{kill} ([@var{m}, @var{n}]) @
503 @fname{kill} (values, functions, arrays, @dots{}) @
504 @fname{kill} (all) @
505 @fname{kill} (allbut (@var{a_1}, @dots{}, @var{a_n}))
507 Removes all bindings (value, function, array, or rule) from the arguments
508 @var{a_1}, @dots{}, @var{a_n}.  An argument @var{a_k} may be a symbol or a
509 single array element.  When @var{a_k} is a single array element, @code{kill}
510 unbinds that element without affecting any other elements of the array.
512 Several special arguments are recognized.  Different kinds of arguments
513 may be combined, e.g., @code{kill (inlabels, functions, allbut (foo, bar))}.
515 @code{kill (labels)} unbinds all input, output, and intermediate expression
516 labels created so far.  @code{kill (inlabels)} unbinds only input labels which
517 begin with the current value of @mrefdot{inchar}  Likewise,
518 @code{kill (outlabels)} unbinds only output labels which begin with the current
519 value of @mrefcomma{outchar} and @code{kill (linelabels)} unbinds only
520 intermediate expression labels which begin with the current value of
521 @mrefdot{linechar}
523 @code{kill (@var{n})}, where @var{n} is an integer,
524 unbinds the @var{n} most recent input and output labels.
526 @code{kill ([@var{m}, @var{n}])} unbinds input and output labels @var{m} through
527 @var{n}.
529 @code{kill (@var{infolist})}, where @var{infolist} is any item in
530 @code{infolists} (such as @mrefcomma{values} @mrefcomma{functions} or
531 @mref{arrays}) unbinds all items in @var{infolist}.
532 See also @mrefdot{infolists}
534 @code{kill (all)} unbinds all items on all infolists.  @code{kill (all)} does
535 not reset global variables to their default values; see @mref{reset} on this
536 point.
538 @code{kill (allbut (@var{a_1}, ..., @var{a_n}))} unbinds all items on all
539 infolists except for @var{a_1}, @dots{}, @var{a_n}.
540 @code{kill (allbut (@var{infolist}))} unbinds all items except for the ones on
541 @var{infolist}, where @var{infolist} is @mrefcomma{values}@w{}
542 @mrefcomma{functions} @mrefcomma{arrays} etc.
544 The memory taken up by a bound property is not released until all symbols are
545 unbound from it.  In particular, to release the memory taken up by the value of
546 a symbol, one unbinds the output label which shows the bound value, as well as
547 unbinding the symbol itself.
549 @code{kill} quotes its arguments.  The quote-quote operator @code{'@w{}'}
550 defeats quotation.
552 @code{kill (@var{symbol})} unbinds all properties of @var{symbol}.  In contrast,
553 the functions @mrefcomma{remvalue} @mrefcomma{remfunction}@w{}
554 @mrefcomma{remarray} and @mref{remrule} unbind a specific property.
555 Note that facts declared by @mref{assume} don't require a symbol they apply to,
556 therefore aren't stored as properties of symbols and therefore aren't affected
557 by @code{kill}.
559 @code{kill} always returns @code{done}, even if an argument has no binding.
561 @opencatbox{Categories:}
562 @category{Evaluation}
563 @category{Console interaction}
564 @category{Session management}
565 @closecatbox
566 @end deffn
568 @c -----------------------------------------------------------------------------
569 @anchor{labels}
570 @deffn  {Function} labels (@var{symbol})
572 Returns the list of input, output, or intermediate expression labels which begin
573 with @var{symbol}.  Typically @var{symbol} is the value of
574 @mrefcomma{inchar} @mrefcomma{outchar} or @mrefdot{linechar}
575 If no labels begin with @var{symbol}, @code{labels} returns an empty list.
577 By default, Maxima displays the result of each user input expression, giving the
578 result an output label.  The output display is suppressed by terminating the
579 input with @code{$} (dollar sign) instead of @code{;} (semicolon).  An output
580 label is constructed and bound to the result, but not displayed, and the label
581 may be referenced in the same way as displayed output labels.  See also
582 @mrefcomma{%} @mrefcomma{%%} and @mrefdot{%th}
584 Intermediate expression labels can be generated by some functions.  The option
585 variable @mref{programmode} controls whether @mref{solve} and some other
586 functions generate intermediate expression labels instead of returning a list of
587 expressions.  Some other functions, such as @mrefcomma{ldisplay} always generate
588 intermediate expression labels.
590 See also @mrefcomma{inchar} @mrefcomma{outchar} @mrefcomma{linechar} and
591 @mrefdot{infolists}
593 @opencatbox{Categories:}
594 @category{Display functions}
595 @category{Console interaction}
596 @closecatbox
597 @end deffn
599 @defvr {System variable} labels
601 The variable @code{labels} is the list of input, output, and intermediate
602 expression labels, including all previous labels if @code{inchar},
603 @code{outchar}, or @code{linechar} were redefined.
605 @opencatbox{Categories:}
606 @category{Display flags and variables}
607 @category{Console interaction}
608 @closecatbox
609 @end defvr
611 @c -----------------------------------------------------------------------------
612 @anchor{linechar}
613 @defvr {Option variable} linechar
614 Default value: @code{%t}
616 @code{linechar} is the prefix of the labels of intermediate expressions 
617 generated by Maxima.  Maxima constructs a label for each intermediate expression 
618 (if displayed) by concatenating @code{linechar} and @mrefdot{linenum}
620 @code{linechar} may be assigned any string or symbol, not necessarily a single 
621 character.  Because Maxima internally takes into account only the first char of
622 the prefix, the prefixes @mrefcomma{inchar} @mrefcomma{outchar} and
623 @code{linechar} should have a different first char.  Otherwise some commands
624 like @code{kill(inlabels)} do not work as expected.
626 Intermediate expressions might or might not be displayed.
627 See @mref{programmode} and @mrefdot{labels}
629 @opencatbox{Categories:}
630 @category{Display flags and variables}
631 @closecatbox
632 @end defvr
634 @c EXPAND; SHOW WHAT HAPPENS WHEN linenum IS ASSIGNED A VALUE
636 @c -----------------------------------------------------------------------------
637 @anchor{linenum}
638 @defvr {System variable} linenum
640 The line number of the current pair of input and output expressions.
642 @opencatbox{Categories:}
643 @category{Display flags and variables}
644 @category{Console interaction}
645 @closecatbox
646 @end defvr
648 @c NEEDS WORK
650 @c -----------------------------------------------------------------------------
651 @anchor{myoptions}
652 @defvr {System variable} myoptions
653 Default value: @code{[]}
655 @code{myoptions} is the list of all options ever reset by the user,
656 whether or not they get reset to their default value.
658 @opencatbox{Categories:}
659 @category{Global variables}
660 @category{Session management}
661 @category{Console interaction}
662 @closecatbox
663 @end defvr
665 @c -----------------------------------------------------------------------------
666 @anchor{nolabels}
667 @defvr {Option variable} nolabels
668 Default value: @code{false}
670 When @code{nolabels} is @code{true}, input and output result labels (@code{%i}
671 and @code{%o}, respectively) are displayed, but the labels are not bound to
672 results, and the labels are not appended to the @mref{labels} list.  Since
673 labels are not bound to results, garbage collection can recover the memory taken
674 up by the results.
676 Otherwise input and output result labels are bound to results, and the labels
677 are appended to the @code{labels} list.
679 Intermediate expression labels (@code{%t}) are not affected by @code{nolabels};
680 whether @code{nolabels} is @code{true} or @code{false}, intermediate expression
681 labels are bound and appended to the @code{labels} list.
683 See also @mrefcomma{batch} @mrefcomma{load} and @mrefdot{labels}
685 @opencatbox{Categories:}
686 @category{Global flags}
687 @category{Session management}
688 @closecatbox
689 @end defvr
691 @c NEEDS WORK
693 @c -----------------------------------------------------------------------------
694 @anchor{optionset}
695 @defvr {Option variable} optionset
696 Default value: @code{false}
698 When @code{optionset} is @code{true}, Maxima prints out a message whenever a
699 Maxima option is reset.  This is useful if the user is doubtful of the spelling
700 of some option and wants to make sure that the variable he assigned a value to
701 was truly an option variable.
703 Example:
705 @example
706 (%i1) optionset:true;
707 assignment: assigning to option optionset
708 (%o1)                         true
709 (%i2) gamma_expand:true;
710 assignment: assigning to option gamma_expand
711 (%o2)                         true
712 @end example
714 @opencatbox{Categories:}
715 @category{Global flags}
716 @category{Session management}
717 @category{Console interaction}
718 @closecatbox
719 @end defvr
721 @c -----------------------------------------------------------------------------
722 @need 800
723 @anchor{outchar}
724 @defvr {Option variable} outchar
725 Default value: @code{%o}
727 @code{outchar} is the prefix of the labels of expressions computed by Maxima.
728 Maxima automatically constructs a label for each computed expression by 
729 concatenating @code{outchar} and @mrefdot{linenum}
731 @code{outchar} may be assigned any string or symbol, not necessarily a single 
732 character.  Because Maxima internally takes into account only the first char of
733 the prefix, the prefixes @mrefcomma{inchar} @code{outchar} and
734 @mref{linechar} should have a different first char.  Otherwise some commands
735 like @code{kill(inlabels)} do not work as expected.
737 See also @mref{labels}.
739 Example:
741 @c ===beg===
742 @c outchar: "output";
743 @c expand((a+b)^3);
744 @c ===end===
745 @example
746 @group
747 (%i1) outchar: "output";
748 (output1)                    output
749 @end group
750 @group
751 (%i2) expand((a+b)^3);
752                      3        2      2      3
753 (output2)           b  + 3 a b  + 3 a  b + a
754 @end group
755 @end example
757 @opencatbox{Categories:}
758 @category{Display flags and variables}
759 @closecatbox
760 @end defvr
762 @c -----------------------------------------------------------------------------
763 @anchor{playback}
764 @deffn {Function} playback @
765 @fname{playback} () @
766 @fname{playback} (@var{n}) @
767 @fname{playback} ([@var{m}, @var{n}]) @
768 @fname{playback} ([@var{m}]) @
769 @fname{playback} (input) @
770 @fname{playback} (slow) @
771 @fname{playback} (time) @
772 @fname{playback} (grind)
774 Displays input, output, and intermediate expressions, without recomputing them.
775 @code{playback} only displays the expressions bound to labels; any other output
776 (such as text printed by @mref{print} or @mrefcomma{describe} or error messages)
777 is not displayed.  See also @mrefdot{labels}
779 @code{playback} quotes its arguments.  The quote-quote operator @code{'@w{}'}
780 defeats quotation.  @code{playback} always returns @code{done}.
782 @code{playback ()} (with no arguments) displays all input, output, and
783 intermediate expressions generated so far.  An output expression is displayed
784 even if it was suppressed by the @code{$} terminator when it was originally
785 computed.
787 @code{playback (@var{n})} displays the most recent @var{n} expressions.
788 Each input, output, and intermediate expression counts as one.
790 @code{playback ([@var{m}, @var{n}])} displays input, output, and intermediate
791 expressions with numbers from @var{m} through @var{n}, inclusive.
793 @code{playback ([@var{m}])} is equivalent to
794 @code{playback ([@var{m}, @var{m}])}; this usually prints one pair of input and
795 output expressions.
797 @code{playback (input)} displays all input expressions generated so far.
799 @code{playback (slow)} pauses between expressions and waits for the user to
800 press @code{enter}.  This behavior is similar to @mrefdot{demo}
801 @c WHAT DOES THE FOLLOWING MEAN ???
802 @code{playback (slow)} is useful in conjunction with @code{save} or
803 @mref{stringout} when creating a secondary-storage file in order to pick out
804 useful expressions.
806 @code{playback (time)} displays the computation time for each expression.
807 @c DON'T BOTHER TO MENTION OBSOLETE OPTIONS !!!
808 @c The arguments @code{gctime} and @code{totaltime} have the same effect as @code{time}.
810 @code{playback (grind)} displays input expressions in the same format as the
811 @code{grind} function.  Output expressions are not affected by the @code{grind}
812 option.  See @mrefdot{grind}
814 Arguments may be combined, e.g., @code{playback ([5, 10], grind, time, slow)}.
815 @c APPEARS TO BE input INTERSECT (UNION OF ALL OTHER ARGUMENTS). CORRECT ???
817 @opencatbox{Categories:}
818 @category{Display functions}
819 @category{Console interaction}
820 @closecatbox
821 @end deffn
823 @c -----------------------------------------------------------------------------
824 @need 800
825 @anchor{prompt}
826 @defvr {Option variable} prompt
827 Default value: @code{_}
829 @code{prompt} is the prompt symbol of the @mref{demo} function,
830 @code{playback (slow)} mode, and the Maxima break loop (as invoked by
831 @mref{break}).
833 @opencatbox{Categories:}
834 @category{Global variables}
835 @category{Console interaction}
836 @closecatbox
837 @end defvr
839 @c -----------------------------------------------------------------------------
840 @anchor{quit}
841 @deffn {Function} quit ([@var{exit-code}])
843 Terminates the Maxima session.  Note that the function must be invoked as
844 @code{quit();} or @code{quit()$}, not @code{quit} by itself.
845 @code{quit} supports returning an exit code to the shell for Lisps and
846 OSes that support exit codes.  The default exit code is 0 (usually
847 indicating no errors encountered).  Thus @code{quit(1)} indicates to the
848 shell that maxima exited with some kind of failure.  This is useful in
849 scripts where maxima can indicate to the shell that maxima failed to
850 compute something or some other bad thing happened.
852 To stop a lengthy computation, type @code{control-C}.  The default action is to
853 return to the Maxima prompt.  If @code{*debugger-hook*} is @code{nil},
854 @code{control-C} opens the Lisp debugger.  See also @ref{Debugging}.
856 @opencatbox{Categories:}
857 @category{Console interaction}
858 @closecatbox
859 @end deffn
861 @c -----------------------------------------------------------------------------
862 @anchor{read}
863 @deffn {Function} read (@var{expr_1}, @dots{}, @var{expr_n})
865 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
866 console and returns the evaluated expression.  The expression is terminated with
867 a semicolon @code{;} or dollar sign @code{$}.
869 See also @mref{readonly}
871 Example:
873 @example
874 (%i1) foo: 42$ 
875 (%i2) foo: read ("foo is", foo, " -- enter new value.")$
876 foo is 42  -- enter new value. 
877 (a+b)^3;
878 (%i3) foo;
879                                      3
880 (%o3)                         (b + a)
881 @end example
883 @opencatbox{Categories:}
884 @category{Console interaction}
885 @closecatbox
886 @end deffn
888 @c -----------------------------------------------------------------------------
889 @anchor{readonly}
890 @deffn {Function} readonly (@var{expr_1}, @dots{}, @var{expr_n})
892 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
893 console and returns the expression (without evaluation).  The expression is
894 terminated with a @code{;} (semicolon) or @code{$} (dollar sign).
896 See also @mrefdot{read}
898 Examples:
900 @example
901 (%i1) aa: 7$
902 (%i2) foo: readonly ("Enter an expression:");
903 Enter an expression: 
904 2^aa;
905                                   aa
906 (%o2)                            2
907 (%i3) foo: read ("Enter an expression:");
908 Enter an expression: 
909 2^aa;
910 (%o3)                            128
911 @end example
913 @opencatbox{Categories:}
914 @category{Console interaction}
915 @closecatbox
916 @end deffn
918 @c -----------------------------------------------------------------------------
919 @anchor{reset}
920 @deffn {Function} reset ()
922 Resets many global variables and options, and some other variables, to their
923 default values.
925 @code{reset} processes the variables on the Lisp list
926 @code{*variable-initial-values*}.  The Lisp macro @code{defmvar} puts variables
927 on this list (among other actions).  Many, but not all, global variables and
928 options are defined by @code{defmvar}, and some variables defined by
929 @code{defmvar} are not global variables or options.
931 @opencatbox{Categories:}
932 @category{Session management}
933 @closecatbox
934 @end deffn
936 @c -----------------------------------------------------------------------------
937 @anchor{showtime}
938 @defvr {Option variable} showtime
939 Default value: @code{false}
941 When @code{showtime} is @code{true}, the computation time and elapsed time is
942 printed with each output expression.
944 The computation time is always recorded, so @mref{time} and @mref{playback} can
945 display the computation time even when @code{showtime} is @code{false}.
947 See also @mrefdot{timer}
949 @opencatbox{Categories:}
950 @category{Display flags and variables}
951 @category{Debugging}
952 @closecatbox
953 @end defvr
955 @c -----------------------------------------------------------------------------
956 @anchor{to_lisp}
957 @deffn {Function} to_lisp ()
959 Enters the Lisp system under Maxima.  @code{(to-maxima)} returns to Maxima.
961 Example:
963 Define a function and enter the Lisp system under Maxima.  The definition is
964 inspected on the property list, then the function definition is extracted,
965 factored and stored in the variable @code{$result}.  The variable can be used in Maxima
966 after returning to Maxima.
968 @example
969 (%i1) f(x):=x^2+x;
970                                   2
971 (%o1)                    f(x) := x  + x
972 (%i2) to_lisp();
973 Type (to-maxima) to restart, ($quit) to quit Maxima.
974 MAXIMA> (symbol-plist '$f)
975 (MPROPS (NIL MEXPR ((LAMBDA) ((MLIST) $X) 
976                              ((MPLUS) ((MEXPT) $X 2) $X))))
977 MAXIMA> (setq $result ($factor (caddr (mget '$f 'mexpr))))
978 ((MTIMES SIMP FACTORED) $X ((MPLUS SIMP IRREDUCIBLE) 1 $X))
979 MAXIMA> (to-maxima)
980 Returning to Maxima
981 (%o2)                         true
982 (%i3) result;
983 (%o3)                       x (x + 1)
984 @end example
986 @opencatbox{Categories:}
987 @category{Console interaction}
988 @closecatbox
989 @end deffn
991 @c -----------------------------------------------------------------------------
992 @anchor{eval_string_lisp}
993 @deffn {Function} eval_string_lisp (@var{str})
995 Sequentially read lisp forms from the string @var{str} and evaluate them.
996 Any values produced from the last form are returned as a Maxima list.
998 Examples:
1000 @c ===beg===
1001 @c eval_string_lisp ("");
1002 @c eval_string_lisp ("(values)");
1003 @c eval_string_lisp ("69");
1004 @c eval_string_lisp ("1 2 3");
1005 @c eval_string_lisp ("(values 1 2 3)");
1006 @c eval_string_lisp ("(defun $foo (x) (* 2 x))");
1007 @c foo (5);
1008 @c ===end===
1009 @example
1010 @group
1011 (%i1) eval_string_lisp ("");
1012 (%o1) []
1013 @end group
1014 @group
1015 (%i2) eval_string_lisp ("(values)");
1016 (%o2) []
1017 @end group
1018 @group
1019 (%i3) eval_string_lisp ("69");
1020 (%o3) [69]
1021 @end group
1022 @group
1023 (%i4) eval_string_lisp ("1 2 3");
1024 (%o4) [3]
1025 @end group
1026 @group
1027 (%i5) eval_string_lisp ("(values 1 2 3)");
1028 (%o5) [1,2,3]
1029 @end group
1030 @group
1031 (%i6) eval_string_lisp ("(defun $foo (x) (* 2 x))");
1032 (%o6) [foo]
1033 @end group
1034 @group
1035 (%i7) foo (5);
1036 (%o7) 10
1037 @end group
1038 @end example
1040 See also @ref{eval_string}.
1042 @opencatbox{Categories:}
1043 @category{Debugging}
1044 @category{Evaluation}
1045 @closecatbox
1047 @end deffn
1049 @c -----------------------------------------------------------------------------
1050 @anchor{values}
1051 @defvr {System variable} values
1052 Initial value: @code{[]}
1054 @code{values} is a list of all bound user variables (not Maxima options or
1055 switches).  The list comprises symbols bound by @mrefcomma{:} or @mrefdot{::}
1057 If the value of a variable is removed with the commands @code{kill}, 
1058 @mrefcomma{remove} or @mref{remvalue} the variable is deleted from
1059 @code{values}.
1061 See @mref{functions} for a list of user defined functions.
1063 Examples:
1065 First, @code{values} shows the symbols @code{a}, @code{b}, and @code{c}, but 
1066 not @code{d}, it is not bound to a value, and not the user function @code{f}.
1067 The values are removed from the variables.  @code{values} is the empty list.
1069 @c ===beg===
1070 @c [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1071 @c values;
1072 @c [kill(a), remove(b,value), remvalue(c)];
1073 @c values;
1074 @c ===end===
1075 @example
1076 @group
1077 (%i1) [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1078                                            2
1079 (%o1)              [99, 9, 90, d, f(x) := x ]
1080 @end group
1081 @group
1082 (%i2) values;
1083 (%o2)                       [a, b, c]
1084 @end group
1085 @group
1086 (%i3) [kill(a), remove(b,value), remvalue(c)];
1087 (%o3)                   [done, done, [c]]
1088 @end group
1089 @group
1090 (%i4) values;
1091 (%o4)                          []
1092 @end group
1093 @end example
1095 @opencatbox{Categories:}
1096 @category{Evaluation}
1097 @category{Global variables}
1098 @closecatbox
1099 @end defvr
1101 @c -----------------------------------------------------------------------------
1102 @node Functions and Variables for Display, , Functions and Variables for Command Line, Command Line
1103 @section Functions and Variables for Display
1104 @c -----------------------------------------------------------------------------
1106 @c -----------------------------------------------------------------------------
1107 @anchor{%edispflag}
1108 @defvr {Option variable} %edispflag
1109 Default value: @code{false}
1111 When @code{%edispflag} is @code{true}, Maxima displays @code{%e} to a negative
1112 exponent as a quotient.  For example, @code{%e^-x} is displayed as
1113 @code{1/%e^x}.  See also @mrefdot{exptdispflag}
1115 Example:
1117 @c ===beg===
1118 @c %e^-10;
1119 @c %edispflag:true$
1120 @c %e^-10;
1121 @c ===end===
1122 @example
1123 @group
1124 (%i1) %e^-10;
1125                                - 10
1126 (%o1)                        %e
1127 @end group
1128 (%i2) %edispflag:true$
1129 @group
1130 (%i3) %e^-10;
1131                                1
1132 (%o3)                         ----
1133                                 10
1134                               %e
1135 @end group
1136 @end example
1138 @opencatbox{Categories:}
1139 @category{Exponential and logarithm functions}
1140 @category{Display flags and variables}
1141 @closecatbox
1142 @end defvr
1144 @c -----------------------------------------------------------------------------
1145 @anchor{absboxchar}
1146 @defvr {Option variable} absboxchar
1147 Default value: @code{!}
1149 @code{absboxchar} is the character used to draw absolute value
1150 signs around expressions which are more than one line tall.
1152 @code{absboxchar} is only used when @code{display2d_unicode} is @code{false}.
1154 Example:
1156 @example
1157 (%i1) display2d_unicode: false $
1158 (%i2) abs((x^3+1));
1159                             ! 3    !
1160 (%o2)                       !x  + 1!
1161 @end example
1163 @opencatbox{Categories:}
1164 @category{Display flags and variables}
1165 @closecatbox
1166 @end defvr
1168 @c AFTER REVIEWING src/displa.lisp, IT LOOKS LIKE THIS VARIABLE HAS NO EFFECT
1169 @c CUT IT ON THE NEXT PASS
1170 @c @defvar cursordisp
1171 @c Default value: @code{true}
1172 @c 
1173 @c When @code{cursordisp} is @code{true}, expressions are drawn by
1174 @c the displayer in logical sequence.  This only works with a console
1175 @c which can do cursor movement.  If @code{false}, expressions are
1176 @c printed line by line.
1177 @c 
1178 @c @code{cursordisp} is always @code{false} when a @code{writefile} is in
1179 @c effect.
1180 @c 
1181 @c @end defvar
1183 @c -----------------------------------------------------------------------------
1184 @anchor{declare_index_properties}
1185 @deffn {Function} declare_index_properties (@var{a}, [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1186 @deffnx {Function} declare_index_properties ([@var{a}, @var{b}, @var{c}, ...], [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1187 @deffnx {Symbol} postsubscript
1188 @deffnx {Symbol} postsuperscript
1189 @deffnx {Symbol} presuperscript
1190 @deffnx {Symbol} presubscript
1192 Declares the properties of indices applied to the symbol @var{a}
1193 or each of the of symbols @var{a}, @var{b}, @var{c}, ....
1194 If multiple symbols are given,
1195 the whole list of properties applies to each symbol.
1197 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1198 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1199 There may be any number of index properties, in any order. 
1201 Each property @var{p_k} must one of these four recognized properties:
1202 @code{postsubscript}, @code{postsuperscript}, @code{presuperscript}, or @code{presubscript},
1203 to denote indices which are displayed, respectively,
1204 to the right and below, to the right and above, to the left and above, or to the left and below.
1206 Index properties apply only to the 2-dimensional display of indexed variables
1207 (i.e., when @mref{display2d} is @code{true})
1208 and TeX output via @code{tex}.
1209 Otherwise, index properties are ignored.
1210 Index properties do not change the input of indexed variables,
1211 do not change the algebraic properties of indexed variables,
1212 and do not change the 1-dimensional display of indexed variables.
1214 @code{declare_index_properties} quotes (does not evaluate) its arguments.
1216 @code{remove_index_properties} removes index properties.
1217 @code{kill} also removes index properties (and all other properties).
1219 @code{get_index_properties} retrieves index properties.
1221 Examples:
1223 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1224 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1225 There may be any number of index properties, in any order. 
1227 @c ===beg===
1228 @c declare_index_properties (A, [presubscript, postsubscript]);
1229 @c declare_index_properties (B, [postsuperscript, postsuperscript,
1230 @c  presuperscript]);
1231 @c declare_index_properties (C, [postsuperscript, presubscript,
1232 @c  presubscript, presuperscript]);
1233 @c A[w, x];
1234 @c B[w, x, y];
1235 @c C[w, x, y, z];
1236 @c ===end===
1237 @example
1238 @group
1239 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1240 (%o1)                         done
1241 @end group
1242 @group
1243 (%i2) declare_index_properties (B, [postsuperscript, postsuperscript,
1244  presuperscript]);
1245 (%o2)                         done
1246 @end group
1247 @group
1248 (%i3) declare_index_properties (C, [postsuperscript, presubscript,
1249  presubscript, presuperscript]);
1250 (%o3)                         done
1251 @end group
1252 @group
1253 (%i4) A[w, x];
1254 (%o4)                           A
1255                                w x
1256 @end group
1257 @group
1258 (%i5) B[w, x, y];
1259                              y w, x
1260 (%o5)                         B
1261 @end group
1262 @group
1263 (%i6) C[w, x, y, z];
1264                                 z w
1265 (%o6)                            C
1266                              x, y
1267 @end group
1268 @end example
1270 Index properties apply only to the 2-dimensional display of indexed variables and TeX output.
1271 Otherwise, index properties are ignored.
1273 @c ===beg===
1274 @c declare_index_properties (A, [presubscript, postsubscript]);
1275 @c A[w, x];
1276 @c tex (A[w, x]);
1277 @c display2d: false $
1278 @c A[w, x];
1279 @c display2d: true $
1280 @c grind (A[w, x]);
1281 @c stringdisp: true $
1282 @c string (A[w, x]);
1283 @c ===end===
1284 @example
1285 @group
1286 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1287 (%o1)                         done
1288 @end group
1289 @group
1290 (%i2) A[w, x];
1291 (%o2)                           A
1292                                w x
1293 @end group
1294 @group
1295 (%i3) tex (A[w, x]);
1296 $$@{@}_@{w@}A_@{x@}$$
1297 (%o3)                         false
1298 @end group
1299 (%i4) display2d: false $
1300 @group
1301 (%i5) A[w, x];
1302 (%o5) A[w,x]
1303 @end group
1304 (%i6) display2d: true $
1305 @group
1306 (%i7) grind (A[w, x]);
1307 A[w,x]$
1308 (%o7)                         done
1309 @end group
1310 (%i8) stringdisp: true $
1311 @group
1312 (%i9) string (A[w, x]);
1313 (%o9)                       "A[w,x]"
1314 @end group
1315 @end example
1317 @opencatbox{Categories:}
1318 @category{Display flags and variables}
1319 @closecatbox
1320 @end deffn
1322 @c -----------------------------------------------------------------------------
1323 @anchor{get_index_properties}
1324 @deffn {Function} get_index_properties (@var{a})
1326 Returns the properties for @var{a} established by @code{declare_index_properties}.
1328 See also @mrefdot{remove_index_properties}
1330 @opencatbox{Categories:}
1331 @category{Display flags and variables}
1332 @closecatbox
1333 @end deffn
1335 @c -----------------------------------------------------------------------------
1336 @anchor{remove_index_properties}
1337 @deffn {Function} remove_index_properties (@var{a}, @var{b}, @var{c}, ...)
1339 Removes the properties established by @code{declare_index_properties}.
1340 All index properties are removed from each symbol @var{a}, @var{b}, @var{c}, ....
1342 @code{remove_index_properties} quotes (does not evaluate) its arguments.
1344 @opencatbox{Categories:}
1345 @category{Display flags and variables}
1346 @closecatbox
1347 @end deffn
1349 @c -----------------------------------------------------------------------------
1350 @anchor{display_index_separator}
1351 @defvr {Symbol property} display_index_separator
1353 When a symbol @var{A} has index display properties declared via @code{declare_index_properties},
1354 the value of the property @code{display_index_separator}
1355 is the string or other expression which is displayed between indices.
1357 The value of @code{display_index_separator}
1358 is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1359 where @var{S} is a string or other expression.
1360 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1362 The display index separator @var{S} can be a string, including an empty string,
1363 or @code{false}, indicating the default separator, or any expression.
1364 If not a string and not @code{false}, the property value is coerced to a string via @code{string}.
1366 If no display index separator is assigned, the default separator is used.
1367 The default separator is a comma.
1368 There is no way to change the default separator.
1370 Each symbol has its own value of @code{display_index_separator}.
1372 See also @mref{put}, @mref{get}, and @mrefdot{declare_index_properties}
1374 Examples:
1375     
1376 When a symbol @var{A} has index display properties,
1377 the value of the property @code{display_index_separator}
1378 is the string or other expression which is displayed between indices.
1379 The value is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1381 @c ===beg===
1382 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1383 @c  presubscript, presubscript]);
1384 @c put (A, ";", display_index_separator);
1385 @c A[w, x, y, z];
1386 @c ===end===
1387 @example
1388 @group
1389 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1390  presubscript, presubscript]);
1391 (%o1)                         done
1392 @end group
1393 @group
1394 (%i2) put (A, ";", display_index_separator);
1395 (%o2)                           ;
1396 @end group
1397 @group
1398 (%i3) A[w, x, y, z];
1399                                  w;x
1400 (%o3)                           A
1401                              y;z
1402 @end group
1403 @end example
1405 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1407 @c ===beg===
1408 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1409 @c  presubscript, presubscript]);
1410 @c put (A, ";", display_index_separator);
1411 @c get (A, display_index_separator);
1412 @c ===end===
1413 @example
1414 @group
1415 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1416  presubscript, presubscript]);
1417 (%o1)                         done
1418 @end group
1419 @group
1420 (%i2) put (A, ";", display_index_separator);
1421 (%o2)                           ;
1422 @end group
1423 @group
1424 (%i3) get (A, display_index_separator);
1425 (%o3)                           ;
1426 @end group
1427 @end example
1429 The display index separator @var{S} can be a string, including an empty string,
1430 or @code{false}, indicating the default separator, or any expression.
1432 @c ===beg===
1433 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1434 @c  presubscript, presubscript]);
1435 @c A[w, x, y, z];
1436 @c put (A, "-", display_index_separator);
1437 @c A[w, x, y, z];
1438 @c put (A, " ", display_index_separator);
1439 @c A[w, x, y, z];
1440 @c put (A, "", display_index_separator);
1441 @c A[w, x, y, z];
1442 @c put (A, false, display_index_separator);
1443 @c A[w, x, y, z];
1444 @c put (A, 'foo, display_index_separator);
1445 @c A[w, x, y, z];
1446 @c ===end===
1447 @example
1448 @group
1449 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1450  presubscript, presubscript]);
1451 (%o1)                         done
1452 @end group
1453 @group
1454 (%i2) A[w, x, y, z];
1455                                  w, x
1456 (%o2)                           A
1457                             y, z
1458 @end group
1459 @group
1460 (%i3) put (A, "-", display_index_separator);
1461 (%o3)                           -
1462 @end group
1463 @group
1464 (%i4) A[w, x, y, z];
1465                                  w-x
1466 (%o4)                           A
1467                              y-z
1468 @end group
1469 @group
1470 (%i5) put (A, " ", display_index_separator);
1471 (%o5)                            
1472 @end group
1473 @group
1474 (%i6) A[w, x, y, z];
1475                                  w x
1476 (%o6)                           A
1477                              y z
1478 @end group
1479 @group
1480 (%i7) put (A, "", display_index_separator);
1481 (%o7) 
1482 @end group
1483 @group
1484 (%i8) A[w, x, y, z];
1485                                  wx
1486 (%o8)                           A
1487                               yz
1488 @end group
1489 @group
1490 (%i9) put (A, false, display_index_separator);
1491 (%o9)                         false
1492 @end group
1493 @group
1494 (%i10) A[w, x, y, z];
1495                                  w, x
1496 (%o10)                          A
1497                             y, z
1498 @end group
1499 @group
1500 (%i11) put (A, 'foo, display_index_separator);
1501 (%o11)                         foo
1502 @end group
1503 @group
1504 (%i12) A[w, x, y, z];
1505                                  wfoox
1506 (%o12)                          A
1507                            yfooz
1508 @end group
1509 @end example
1511 If no display index separator is assigned, the default separator is used.
1512 The default separator is a comma.
1514 @c ===beg===
1515 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1516 @c  presubscript, presubscript]);
1517 @c A[w, x, y, z];
1518 @c ===end===
1519 @example
1520 @group
1521 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1522  presubscript, presubscript]);
1523 (%o1)                         done
1524 @end group
1525 @group
1526 (%i2) A[w, x, y, z];
1527                                  w, x
1528 (%o2)                           A
1529                             y, z
1530 @end group
1531 @end example
1533 Each symbol has its own value of @code{display_index_separator}.
1535 @c ===beg===
1536 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1537 @c  presubscript, presubscript]);
1538 @c put (A, " ", display_index_separator);
1539 @c declare_index_properties (B, [presuperscript, presuperscript,
1540 @c  postsubscript, postsubscript]);
1541 @c put (B, ";", display_index_separator);
1542 @c A[w, x, y, z] + B[w, x, y, z];
1543 @c ===end===
1544 @example
1545 @group
1546 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1547  presubscript, presubscript]);
1548 (%o1)                         done
1549 @end group
1550 @group
1551 (%i2) put (A, " ", display_index_separator);
1552 (%o2)                            
1553 @end group
1554 @group
1555 (%i3) declare_index_properties (B, [postsuperscript, postsuperscript, presubscript, presubscript]);
1556 (%o3)                         done
1557 @end group
1558 @group
1559 (%i4) put (B, ";", display_index_separator);
1560 (%o4)                           ;
1561 @end group
1562 @group
1563 (%i5) A[w, x, y, z] + B[w, x, y, z];
1564                             w;x       w x
1565 (%o5)                      B    +    A
1566                         y;z       y z
1567 @end group
1568 @end example
1570 @opencatbox{Categories:}
1571 @category{Display flags and variables}
1572 @closecatbox
1573 @end defvr
1575 @c -----------------------------------------------------------------------------
1576 @anchor{disp}
1577 @deffn {Function} disp (@var{expr_1}, @var{expr_2}, @dots{})
1579 is like @mref{display} but only the value of the arguments are displayed rather
1580 than equations.  This is useful for complicated arguments which don't have names 
1581 or where only the value of the argument is of interest and not the name.
1583 See also @mref{ldisp} and @mrefdot{print}
1585 Example:
1587 @c ===beg===
1588 @c b[1,2]:x-x^2$
1589 @c x:123$
1590 @c disp(x, b[1,2], sin(1.0));
1591 @c ===end===
1592 @example
1593 (%i1) b[1,2]:x-x^2$
1594 (%i2) x:123$
1595 @group
1596 (%i3) disp(x, b[1,2], sin(1.0));
1597                                123
1599                                   2
1600                              x - x
1602                        0.8414709848078965
1604 (%o3)                         done
1605 @end group
1606 @end example
1608 @opencatbox{Categories:}
1609 @category{Display functions}
1610 @closecatbox
1611 @end deffn
1613 @c -----------------------------------------------------------------------------
1614 @anchor{display}
1615 @deffn {Function} display (@var{expr_1}, @var{expr_2}, @dots{})
1617 Displays equations whose left side is @var{expr_i} unevaluated, and whose right
1618 side is the value of the expression centered on the line.  This function is 
1619 useful in blocks and @mref{for} statements in order to have intermediate results
1620 displayed.  The arguments to @code{display} are usually atoms, subscripted 
1621 variables, or function calls.
1623 See also @mrefcomma{ldisplay} @mrefcomma{disp} and @mrefdot{ldisp}
1625 Example:
1627 @c ===beg===
1628 @c b[1,2]:x-x^2$
1629 @c x:123$
1630 @c display(x, b[1,2], sin(1.0));
1631 @c ===end===
1632 @example
1633 (%i1) b[1,2]:x-x^2$
1634 (%i2) x:123$
1635 @group
1636 (%i3) display(x, b[1,2], sin(1.0));
1637                              x = 123
1639                                       2
1640                          b     = x - x
1641                           1, 2
1643                   sin(1.0) = 0.8414709848078965
1645 (%o3)                         done
1646 @end group
1647 @end example
1649 @opencatbox{Categories:}
1650 @category{Display functions}
1651 @closecatbox
1652 @end deffn
1654 @c -----------------------------------------------------------------------------
1655 @anchor{display2d}
1656 @defvr {Option variable} display2d
1657 Default value: @code{true}
1659 When @code{display2d} is @code{true},
1660 the console display is an attempt to present mathematical expressions
1661 as they might appear in books and articles,
1662 using only letters, numbers, and some punctuation characters.
1663 This display is sometimes called the "pretty printer" display.
1665 When @code{display2d} is @code{true},
1666 Maxima attempts to honor the global variable for line length, @code{linel}.
1667 When an atom (symbol, number, or string) would otherwise cause a line to exceed @code{linel},
1668 the atom may be printed in pieces on successive lines,
1669 with a continuation character (backslash, @code{\}) at the end of the leading piece;
1670 however, in some cases, such atoms are printed without a line break,
1671 and the length of the line is greater than @code{linel}.
1673 When @code{display2d} is @code{false},
1674 the console display is a 1-dimensional or linear form
1675 which is the same as the output produced by @code{grind}.
1677 When @code{display2d} is @code{false},
1678 the value of @mref{stringdisp} is ignored,
1679 and strings are always displayed with quote marks.
1681 When @code{display2d} is @code{false},
1682 Maxima attempts to honor @code{linel},
1683 but atoms are not broken across lines,
1684 and the actual length of an output line may exceed @code{linel}.
1686 See also @mref{leftjust} to switch between a left justified and a centered
1687 display of equations.
1689 Example:
1691 @c ===beg===
1692 @c x/(x^2+1);
1693 @c display2d:false$
1694 @c x/(x^2+1);
1695 @c ===end===
1696 @example
1697 @group
1698 (%i1) x/(x^2+1);
1699                                x
1700 (%o1)                        ------
1701                               2
1702                              x  + 1
1703 @end group
1704 (%i2) display2d:false$
1705 @group
1706 (%i3) x/(x^2+1);
1707 (%o3) x/(x^2+1)
1708 @end group
1709 @end example
1711 @opencatbox{Categories:}
1712 @category{Display flags and variables}
1713 @closecatbox
1714 @end defvr
1716 @c -----------------------------------------------------------------------------
1717 @anchor{display_format_internal}
1718 @defvr {Option variable} display_format_internal
1719 Default value: @code{false}
1721 When @code{display_format_internal} is @code{true}, expressions are displayed
1722 without being transformed in ways that hide the internal mathematical
1723 representation.  The display then corresponds to what @mref{inpart} returns
1724 rather than @mrefdot{part}
1726 Examples:
1728 @example
1729 User     part       inpart
1730 a-b;      a - b     a + (- 1) b
1732            a            - 1
1733 a/b;       -         a b
1734            b
1735                        1/2
1736 sqrt(x);   sqrt(x)    x
1738           4 X        4
1739 X*4/3;    ---        - X
1740            3         3
1741 @end example
1743 @opencatbox{Categories:}
1744 @category{Display flags and variables}
1745 @closecatbox
1746 @end defvr
1748 @c -----------------------------------------------------------------------------
1749 @anchor{with_default_2d_display}
1750 @deffn {Function} with_default_2d_display (expr)
1752 While maxima by default realizes 2d Output using ASCII-Art some frontend
1753 change that to TeX, MathML or a specific XML dialect that better suits
1754 the needs for this specific frontend. @code{with_default_2d_display}
1755 temporarily switches maxima to the default 2D ASCII Art formatter for
1756 outputting the result of @code{expr}.
1758 See also @mref{set_alt_display} and @mrefdot{display2d}
1760 @opencatbox{Categories:}
1761 @category{Display functions}
1762 @closecatbox
1763 @end deffn
1765 @c -----------------------------------------------------------------------------
1766 @anchor{display2d_unicode}
1767 @defvr {Option variable} display2d_unicode
1768 Default value: @code{true}
1770 When @code{display2d_unicode} is @code{true},
1771 the 2-d pretty printer (enabled by the global flag @code{display2d}) uses Unicode drawing characters [1] to display
1772 integrals, summations, products, matrices, ratios, derivatives,
1773 @code{box} expressions, @code{at} expressions, and absolute value expressions.
1775 Otherwise, the pretty printer uses only ASCII characters to display every kind of expression.
1777 In addition to displaying expressions in console interaction (as @code{%o} labeled expressions),
1778 the 2-d pretty printer is invoked to display expressions for @code{print},
1779 and @code{printf} with the @code{~m} format specifier.
1781 @ifnotinfo
1782 Examples:
1784 Expressions displayed by 2-d pretty printer using Unicode drawing characters
1785 (@code{display2d_unicode} equal to @code{true}),
1786 shown as an image:
1788 @image{figures/maxima-unicode-display-variety-1,8cm}
1790 Same expressions, displayed using only ASCII characters
1791 (@code{display2d_unicode} equal to @code{false}),
1792 shown as an image:
1794 @image{figures/maxima-unicode-display-variety-1-ascii,8cm}
1796 @end ifnotinfo
1798 Footnotes:
1800 [1] @url{https://en.wikipedia.org/wiki/Box-drawing_character}
1802 @opencatbox{Categories:}
1803 @category{Display flags and variables}
1804 @closecatbox
1806 @end defvr
1808 @c IS THIS FUNCTION STILL USEFUL ???
1809 @c REPHRASE, NEEDS EXAMPLES
1811 @c -----------------------------------------------------------------------------
1812 @anchor{dispterms}
1813 @deffn {Function} dispterms (@var{expr})
1815 Displays @var{expr} in parts one below the other.  That is, first the operator
1816 of @var{expr} is displayed, then each term in a sum, or factor in a product, or
1817 part of a more general expression is displayed separately.  This is useful if
1818 @var{expr} is too large to be otherwise displayed.  For example if @code{P1},
1819 @code{P2}, @dots{}  are very large expressions then the display program may run
1820 out of storage space in trying to display @code{P1 + P2 + ...}  all at once.
1821 However, @code{dispterms (P1 + P2 + ...)} displays @code{P1}, then below it
1822 @code{P2}, etc.  When not using @code{dispterms}, if an exponential expression
1823 is too wide to be displayed as @code{A^B} it appears as @code{expt (A, B)} (or
1824 as @code{ncexpt (A, B)} in the case of @code{A^^B}).
1826 Example:
1828 @example
1829 (%i1) dispterms(2*a*sin(x)+%e^x);
1833 2 a sin(x)
1835   x
1838 (%o1)                         done
1839 @end example
1841 @opencatbox{Categories:}
1842 @category{Display functions}
1843 @closecatbox
1844 @end deffn
1846 @c -----------------------------------------------------------------------------
1847 @anchor{expt}
1848 @anchor{ncexpt}
1849 @deffn  {Special symbol} expt (@var{a}, @var{b})
1850 @deffnx {Special symbol} ncexpt (@var{a}, @var{b})
1852 If an exponential expression is too wide to be displayed as
1853 @code{@var{a}^@var{b}} it appears as @code{expt (@var{a}, @var{b})} (or as
1854 @code{ncexpt (@var{a}, @var{b})} in the case of @code{@var{a}^^@var{b}}).
1856 @c THIS SEEMS LIKE A BUG TO ME.  expt, ncexpt SHOULD BE RECOGNIZED SINCE MAXIMA
1857 @c ITSELF PRINTS THEM SOMETIMES.  THESE SHOULD JUST SIMPLIFY TO ^ AND ^^,
1858 @c RESPECTIVELY.
1859 @code{expt} and @code{ncexpt} are not recognized in input.
1860 @end deffn
1862 @c -----------------------------------------------------------------------------
1863 @anchor{exptdispflag}
1864 @defvr {Option variable} exptdispflag
1865 Default value: @code{true}
1867 When @code{exptdispflag} is @code{true}, Maxima displays expressions
1868 with negative exponents using quotients.  See also @mrefdot{%edispflag}
1870 Example:
1872 @example
1873 (%i1) exptdispflag:true;
1874 (%o1)                         true
1875 (%i2) 10^-x;
1876                                 1
1877 (%o2)                          ---
1878                                  x
1879                                10
1880 (%i3) exptdispflag:false;
1881 (%o3)                         false
1882 (%i4) 10^-x;
1883                                 - x
1884 (%o4)                         10
1885 @end example
1887 @opencatbox{Categories:}
1888 @category{Expressions}
1889 @category{Display flags and variables}
1890 @closecatbox
1891 @end defvr
1893 @c -----------------------------------------------------------------------------
1894 @anchor{grind}
1895 @deffn  {Function} grind (@var{expr})
1897 The function @code{grind} prints @var{expr} to the console in a form suitable
1898 for input to Maxima.  @code{grind} always returns @code{done}.
1900 When @var{expr} is the name of a function or macro, @code{grind} prints the
1901 function or macro definition instead of just the name.
1903 See also @mrefcomma{string} which returns a string instead of printing its
1904 output.  @code{grind} attempts to print the expression in a manner which makes
1905 it slightly easier to read than the output of @code{string}.
1907 @code{grind} evaluates its argument.
1909 Examples:
1911 @c ===beg===
1912 @c aa + 1729;
1913 @c grind (%);
1914 @c [aa, 1729, aa + 1729];
1915 @c grind (%);
1916 @c matrix ([aa, 17], [29, bb]);
1917 @c grind (%);
1918 @c set (aa, 17, 29, bb);
1919 @c grind (%);
1920 @c exp (aa / (bb + 17)^29);
1921 @c grind (%);
1922 @c expr: expand ((aa + bb)^10);
1923 @c grind (expr);
1924 @c string (expr);
1925 @c cholesky (A):= block ([n : length (A), L : copymatrix (A),
1926 @c   p : makelist (0, i, 1, length (A))], 
1927 @c   for i thru n do for j : i thru n do
1928 @c   (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1), 
1929 @c   if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]), 
1930 @c   for i thru n do L[i, i] : 1 / p[i],
1931 @c   for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
1932 @c grind (cholesky);
1933 @c string (fundef (cholesky));
1934 @c ===end===
1935 @example
1936 @group
1937 (%i1) aa + 1729;
1938 (%o1)                       aa + 1729
1939 @end group
1940 @group
1941 (%i2) grind (%);
1942 aa+1729$
1943 (%o2)                         done
1944 @end group
1945 @group
1946 (%i3) [aa, 1729, aa + 1729];
1947 (%o3)                 [aa, 1729, aa + 1729]
1948 @end group
1949 @group
1950 (%i4) grind (%);
1951 [aa,1729,aa+1729]$
1952 (%o4)                         done
1953 @end group
1954 @group
1955 (%i5) matrix ([aa, 17], [29, bb]);
1956                            [ aa  17 ]
1957 (%o5)                      [        ]
1958                            [ 29  bb ]
1959 @end group
1960 @group
1961 (%i6) grind (%);
1962 matrix([aa,17],[29,bb])$
1963 (%o6)                         done
1964 @end group
1965 @group
1966 (%i7) set (aa, 17, 29, bb);
1967 (%o7)                   @{17, 29, aa, bb@}
1968 @end group
1969 @group
1970 (%i8) grind (%);
1971 @{17,29,aa,bb@}$
1972 (%o8)                         done
1973 @end group
1974 @group
1975 (%i9) exp (aa / (bb + 17)^29);
1976                                 aa
1977                             -----------
1978                                      29
1979                             (bb + 17)
1980 (%o9)                     %e
1981 @end group
1982 @group
1983 (%i10) grind (%);
1984 %e^(aa/(bb+17)^29)$
1985 (%o10)                        done
1986 @end group
1987 @group
1988 (%i11) expr: expand ((aa + bb)^10);
1989          10           9        2   8         3   7         4   6
1990 (%o11) bb   + 10 aa bb  + 45 aa  bb  + 120 aa  bb  + 210 aa  bb
1991          5   5         6   4         7   3        8   2
1992  + 252 aa  bb  + 210 aa  bb  + 120 aa  bb  + 45 aa  bb
1993         9        10
1994  + 10 aa  bb + aa
1995 @end group
1996 @group
1997 (%i12) grind (expr);
1998 bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6
1999      +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2
2000      +10*aa^9*bb+aa^10$
2001 (%o12)                        done
2002 @end group
2003 @group
2004 (%i13) string (expr);
2005 (%o13) bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6\
2006 +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2+10*aa^9*\
2007 bb+aa^10
2008 @end group
2009 @group
2010 (%i14) cholesky (A):= block ([n : length (A), L : copymatrix (A),
2011   p : makelist (0, i, 1, length (A))],
2012   for i thru n do for j : i thru n do
2013   (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
2014   if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
2015   for i thru n do L[i, i] : 1 / p[i],
2016   for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
2017 define: warning: redefining the built-in function cholesky
2018 @end group
2019 @group
2020 (%i15) grind (cholesky);
2021 cholesky(A):=block(
2022          [n:length(A),L:copymatrix(A),
2023           p:makelist(0,i,1,length(A))],
2024          for i thru n do
2025              (for j from i thru n do
2026                   (x:L[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),
2027                    if i = j then p[i]:1/sqrt(x)
2028                        else L[j,i]:x*p[i])),
2029          for i thru n do L[i,i]:1/p[i],
2030          for i thru n do (for j from i+1 thru n do L[i,j]:0),L)$
2031 (%o15)                        done
2032 @end group
2033 @group
2034 (%i16) string (fundef (cholesky));
2035 (%o16) cholesky(A):=block([n:length(A),L:copymatrix(A),p:makelis\
2036 t(0,i,1,length(A))],for i thru n do (for j from i thru n do (x:L\
2037 [i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),if i = j then p[i]:1/sqrt(x\
2038 ) else L[j,i]:x*p[i])),for i thru n do L[i,i]:1/p[i],for i thru \
2039 n do (for j from i+1 thru n do L[i,j]:0),L)
2040 @end group
2041 @end example
2043 @opencatbox{Categories:}
2044 @category{Display functions}
2045 @closecatbox
2046 @end deffn
2048 @defvr {Option variable} grind
2050 When the variable @code{grind} is @code{true}, the output of @code{string} and
2051 @mref{stringout} has the same format as that of @code{grind}; otherwise no
2052 attempt is made to specially format the output of those functions.  The default
2053 value of the variable @code{grind} is @code{false}.
2055 @code{grind} can also be specified as an argument of @mrefdot{playback}  When
2056 @code{grind} is present, @code{playback} prints input expressions in the same
2057 format as the @code{grind} function.  Otherwise, no attempt is made to specially
2058 format input expressions.
2060 @opencatbox{Categories:}
2061 @category{Display flags and variables}
2062 @closecatbox
2063 @end defvr
2065 @c -----------------------------------------------------------------------------
2066 @anchor{ibase}
2067 @defvr {Option variable} ibase
2068 Default value: @code{10}
2070 @code{ibase} is the base for integers read by Maxima.
2072 @code{ibase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2073 When @code{ibase} is greater than 10,
2074 the numerals comprise the decimal numerals 0 through 9
2075 plus letters of the alphabet @code{A}, @code{B}, @code{C}, @dots{},
2076 as needed to make @code{ibase} digits in all.
2077 Letters are interpreted as digits only if the first digit is 0 through 9.
2079 Uppercase and lowercase letters are not distinguished.
2080 The numerals for base 36, the largest acceptable base,
2081 comprise 0 through 9 and @code{A} through @code{Z}.
2083 Whatever the value of @code{ibase},
2084 when an integer is terminated by a decimal point,
2085 it is interpreted in base 10.
2087 See also @mrefdot{obase}
2089 Examples:
2091 @code{ibase} less than 10 (for example binary numbers).
2093 @c ===beg===
2094 @c ibase : 2 $
2095 @c obase;
2096 @c 1111111111111111;
2097 @c ===end===
2098 @example
2099 (%i1) ibase : 2 $
2100 @group
2101 (%i2) obase;
2102 (%o2)                          10
2103 @end group
2104 @group
2105 (%i3) 1111111111111111;
2106 (%o3)                         65535
2107 @end group
2108 @end example
2110 @code{ibase} greater than 10.
2111 Letters are interpreted as digits only if the first digit is 0
2112 through 9 which means that hexadecimal numbers might need to
2113 be prepended by a 0.
2115 @c ===beg===
2116 @c ibase : 16 $
2117 @c obase;
2118 @c 1000;
2119 @c abcd;
2120 @c symbolp (abcd);
2121 @c 0abcd;
2122 @c symbolp (0abcd);
2123 @c ===end===
2124 @example
2125 (%i1) ibase : 16 $
2126 @group
2127 (%i2) obase;
2128 (%o2)                          10
2129 @end group
2130 @group
2131 (%i3) 1000;
2132 (%o3)                         4096
2133 @end group
2134 @group
2135 (%i4) abcd;
2136 (%o4)                         abcd
2137 @end group
2138 @group
2139 (%i5) symbolp (abcd);
2140 (%o5)                         true
2141 @end group
2142 @group
2143 (%i6) 0abcd;
2144 (%o6)                         43981
2145 @end group
2146 @group
2147 (%i7) symbolp (0abcd);
2148 (%o7)                         false
2149 @end group
2150 @end example
2152 When an integer is terminated by a decimal point,
2153 it is interpreted in base 10.
2155 @c ===beg===
2156 @c ibase : 36 $
2157 @c obase;
2158 @c 1234;
2159 @c 1234.;
2160 @c ===end===
2161 @example
2162 (%i1) ibase : 36 $
2163 @group
2164 (%i2) obase;
2165 (%o2)                          10
2166 @end group
2167 @group
2168 (%i3) 1234;
2169 (%o3)                         49360
2170 @end group
2171 @group
2172 (%i4) 1234.;
2173 (%o4)                         1234
2174 @end group
2175 @end example
2177 @opencatbox{Categories:}
2178 @category{Console interaction}
2179 @closecatbox
2180 @end defvr
2182 @c -----------------------------------------------------------------------------
2183 @anchor{ldisp}
2184 @deffn {Function} ldisp (@var{expr_1}, @dots{}, @var{expr_n})
2186 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2187 printed output.  @code{ldisp} assigns an intermediate expression label to each
2188 argument and returns the list of labels.
2190 See also @mrefcomma{disp} @mrefcomma{display} and @mrefdot{ldisplay}
2192 Examples:
2194 @example
2195 (%i1) e: (a+b)^3;
2196                                    3
2197 (%o1)                       (b + a)
2198 (%i2) f: expand (e);
2199                      3        2      2      3
2200 (%o2)               b  + 3 a b  + 3 a  b + a
2201 (%i3) ldisp (e, f);
2202                                    3
2203 (%t3)                       (b + a)
2205                      3        2      2      3
2206 (%t4)               b  + 3 a b  + 3 a  b + a
2208 (%o4)                      [%t3, %t4]
2209 (%i4) %t3;
2210                                    3
2211 (%o4)                       (b + a)
2212 (%i5) %t4;
2213                      3        2      2      3
2214 (%o5)               b  + 3 a b  + 3 a  b + a
2215 @end example
2217 @opencatbox{Categories:}
2218 @category{Display functions}
2219 @closecatbox
2220 @end deffn
2222 @c -----------------------------------------------------------------------------
2223 @anchor{ldisplay}
2224 @deffn {Function} ldisplay (@var{expr_1}, @dots{}, @var{expr_n})
2226 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2227 printed output.  Each expression is printed as an equation of the form
2228 @code{lhs = rhs} in which @code{lhs} is one of the arguments of @code{ldisplay}
2229 and @code{rhs} is its value.  Typically each argument is a variable.
2230 @mref{ldisp} assigns an intermediate expression label to each equation and
2231 returns the list of labels.
2233 See also @mrefcomma{display} @mrefcomma{disp} and @mrefdot{ldisp}
2235 Examples:
2237 @example
2238 (%i1) e: (a+b)^3;
2239                                    3
2240 (%o1)                       (b + a)
2241 (%i2) f: expand (e);
2242                      3        2      2      3
2243 (%o2)               b  + 3 a b  + 3 a  b + a
2244 (%i3) ldisplay (e, f);
2245                                      3
2246 (%t3)                     e = (b + a)
2248                        3        2      2      3
2249 (%t4)             f = b  + 3 a b  + 3 a  b + a
2251 (%o4)                      [%t3, %t4]
2252 (%i4) %t3;
2253                                      3
2254 (%o4)                     e = (b + a)
2255 (%i5) %t4;
2256                        3        2      2      3
2257 (%o5)             f = b  + 3 a b  + 3 a  b + a
2258 @end example
2260 @opencatbox{Categories:}
2261 @category{Display functions}
2262 @closecatbox
2263 @end deffn
2265 @c -----------------------------------------------------------------------------
2266 @anchor{leftjust}
2267 @defvr {Option variable} leftjust
2268 Default value: @code{false}
2270 When @code{leftjust} is @code{true}, equations in 2D-display are drawn left
2271 justified rather than centered.
2273 See also @mref{display2d} to switch between 1D- and 2D-display.
2275 Example:
2277 @example
2278 (%i1) expand((x+1)^3);
2279                         3      2
2280 (%o1)                  x  + 3 x  + 3 x + 1
2281 (%i2) leftjust:true$
2282 (%i3) expand((x+1)^3);
2283        3      2
2284 (%o3) x  + 3 x  + 3 x + 1
2285 @end example
2287 @opencatbox{Categories:}
2288 @category{Display flags and variables}
2289 @closecatbox
2290 @end defvr
2292 @c -----------------------------------------------------------------------------
2293 @anchor{linel}
2294 @defvr {Option variable} linel
2295 Default value: @code{79}
2297 @code{linel} is the assumed width (in characters) of the console display for the
2298 purpose of displaying expressions.  @code{linel} may be assigned any value by
2299 the user, although very small or very large values may be impractical.  Text
2300 printed by built-in Maxima functions, such as error messages and the output of
2301 @mrefcomma{describe} is not affected by @code{linel}.
2303 @opencatbox{Categories:}
2304 @category{Display flags and variables}
2305 @closecatbox
2306 @end defvr
2308 @c -----------------------------------------------------------------------------
2309 @need 800
2310 @anchor{lispdisp}
2311 @defvr {Option variable} lispdisp
2312 Default value: @code{false}
2314 When @code{lispdisp} is @code{true}, Lisp symbols are displayed with a leading
2315 question mark @code{?}.  Otherwise, Lisp symbols are displayed with no leading
2316 mark. This has the same effect for 1-d and 2-d display.
2318 Examples:
2320 @c ===beg===
2321 @c lispdisp: false$
2322 @c ?foo + ?bar;
2323 @c lispdisp: true$
2324 @c ?foo + ?bar;
2325 @c ===end===
2326 @example
2327 (%i1) lispdisp: false$
2328 @group
2329 (%i2) ?foo + ?bar;
2330 (%o2)                       foo + bar
2331 @end group
2332 (%i3) lispdisp: true$
2333 @group
2334 (%i4) ?foo + ?bar;
2335 (%o4)                      ?foo + ?bar
2336 @end group
2337 @end example
2339 @opencatbox{Categories:}
2340 @category{Display flags and variables}
2341 @closecatbox
2342 @end defvr
2344 @c NEEDS CLARIFICATION, EXAMPLES
2346 @c -----------------------------------------------------------------------------
2347 @anchor{negsumdispflag}
2348 @defvr {Option variable} negsumdispflag
2349 Default value: @code{true}
2351 When @code{negsumdispflag} is @code{true}, @code{x - y} displays as @code{x - y}
2352 instead of as @code{- y + x}.  Setting it to @code{false} causes the special
2353 check in display for the difference of two expressions to not be done.  One
2354 application is that thus @code{a + %i*b} and @code{a - %i*b} may both be
2355 displayed the same way.
2357 @opencatbox{Categories:}
2358 @category{Display flags and variables}
2359 @closecatbox
2360 @end defvr
2362 @c -----------------------------------------------------------------------------
2363 @anchor{obase}
2364 @defvr {Option variable} obase
2365 Default value: @code{10}
2367 @code{obase} is the base for integers displayed by Maxima.
2369 @code{obase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2370 When @code{obase} is greater than 10,
2371 the numerals comprise the decimal numerals 0 through 9
2372 plus capital letters of the alphabet A, B, C, @dots{}, as needed.
2373 A leading 0 digit is displayed if the leading digit is otherwise a letter.
2374 The numerals for base 36, the largest acceptable base,
2375 comprise 0 through 9, and A through Z.
2377 See also @mrefdot{ibase}
2379 Examples:
2381 @c ===beg===
2382 @c obase : 2;
2383 @c 2^8 - 1;
2384 @c obase : 8;
2385 @c 8^8 - 1;
2386 @c obase : 16;
2387 @c 16^8 - 1;
2388 @c obase : 36;
2389 @c 36^8 - 1;
2390 @c ===end===
2391 @example
2392 @group
2393 (%i1) obase : 2;
2394 (%o1)                          10
2395 @end group
2396 @group
2397 (%i10) 2^8 - 1;
2398 (%o10)                      11111111
2399 @end group
2400 @group
2401 (%i11) obase : 8;
2402 (%o3)                          10
2403 @end group
2404 @group
2405 (%i4) 8^8 - 1;
2406 (%o4)                       77777777
2407 @end group
2408 @group
2409 (%i5) obase : 16;
2410 (%o5)                          10
2411 @end group
2412 @group
2413 (%i6) 16^8 - 1;
2414 (%o6)                       0FFFFFFFF
2415 @end group
2416 @group
2417 (%i7) obase : 36;
2418 (%o7)                          10
2419 @end group
2420 @group
2421 (%i8) 36^8 - 1;
2422 (%o8)                       0ZZZZZZZZ
2423 @end group
2424 @end example
2426 @opencatbox{Categories:}
2427 @category{Display flags and variables}
2428 @category{Console interaction}
2429 @closecatbox
2430 @end defvr
2432 @c -----------------------------------------------------------------------------
2433 @anchor{pfeformat}
2434 @defvr {Option variable} pfeformat
2435 Default value: @code{false}
2437 When @code{pfeformat} is @code{true}, a ratio of integers is displayed with the
2438 solidus (forward slash) character, and an integer denominator @code{n} is
2439 displayed as a leading multiplicative term @code{1/n}.
2441 Examples:
2443 @example
2444 (%i1) pfeformat: false$
2445 (%i2) 2^16/7^3;
2446                               65536
2447 (%o2)                         -----
2448                                343
2449 (%i3) (a+b)/8;
2450                               b + a
2451 (%o3)                         -----
2452                                 8
2453 (%i4) pfeformat: true$ 
2454 (%i5) 2^16/7^3;
2455 (%o5)                       65536/343
2456 (%i6) (a+b)/8;
2457 (%o6)                      1/8 (b + a)
2458 @end example
2460 @opencatbox{Categories:}
2461 @category{Display flags and variables}
2462 @closecatbox
2463 @end defvr
2465 @c -----------------------------------------------------------------------------
2466 @anchor{powerdisp}
2467 @defvr {Option variable} powerdisp
2468 Default value: @code{false}
2470 When @code{powerdisp} is @code{true},
2471 a sum is displayed with its terms in order of increasing power.
2472 Thus a polynomial is displayed as a truncated power series,
2473 with the constant term first and the highest power last.
2475 By default, terms of a sum are displayed in order of decreasing power.
2477 Example:
2479 @example
2480 (%i1) powerdisp:true;
2481 (%o1)                         true
2482 (%i2) x^2+x^3+x^4;
2483                            2    3    4
2484 (%o2)                     x  + x  + x
2485 (%i3) powerdisp:false;
2486 (%o3)                         false
2487 (%i4) x^2+x^3+x^4;
2488                            4    3    2
2489 (%o4)                     x  + x  + x
2490 @end example
2492 @opencatbox{Categories:}
2493 @category{Display flags and variables}
2494 @closecatbox
2495 @end defvr
2497 @c -----------------------------------------------------------------------------
2498 @anchor{print}
2499 @deffn {Function} print (@var{expr_1}, @dots{}, @var{expr_n})
2501 Evaluates and displays @var{expr_1}, @dots{}, @var{expr_n} one after another,
2502 from left to right, starting at the left edge of the console display.
2504 The value returned by @code{print} is the value of its last argument.
2505 @code{print} does not generate intermediate expression labels.
2507 See also @mrefcomma{display} @mrefcomma{disp} @mrefcomma{ldisplay} and
2508 @mrefdot{ldisp}  Those functions display one expression per line, while
2509 @code{print} attempts to display two or more expressions per line.
2511 To display the contents of a file, see @mrefdot{printfile}
2513 Examples:
2515 @example
2516 (%i1) r: print ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2517       radcan (log (a^10/b)))$
2518             3        2      2      3
2519 (a+b)^3 is b  + 3 a b  + 3 a  b + a  log (a^10/b) is 
2521                                               10 log(a) - log(b) 
2522 (%i2) r;
2523 (%o2)                  10 log(a) - log(b)
2524 (%i3) disp ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2525       radcan (log (a^10/b)))$
2526                            (a+b)^3 is
2528                      3        2      2      3
2529                     b  + 3 a b  + 3 a  b + a
2531                          log (a^10/b) is
2533                        10 log(a) - log(b)
2534 @end example
2536 @opencatbox{Categories:}
2537 @category{Display functions}
2538 @closecatbox
2539 @end deffn
2541 @c -----------------------------------------------------------------------------
2542 @anchor{sqrtdispflag}
2543 @defvr {Option variable} sqrtdispflag
2544 Default value: @code{true}
2546 When @code{sqrtdispflag} is @code{false}, causes @code{sqrt} to display with
2547 exponent 1/2.
2548 @c AND OTHERWISE ... ??
2550 @opencatbox{Categories:}
2551 @category{Mathematical functions}
2552 @category{Display flags and variables}
2553 @closecatbox
2554 @end defvr
2556 @c -----------------------------------------------------------------------------
2557 @anchor{stardisp}
2558 @defvr {Option variable} stardisp
2559 Default value: @code{false}
2561 When @code{stardisp} is @code{true}, multiplication is
2562 displayed with an asterisk @code{*} between operands.
2564 @opencatbox{Categories:}
2565 @category{Display flags and variables}
2566 @closecatbox
2567 @end defvr
2569 @c -----------------------------------------------------------------------------
2570 @anchor{ttyoff}
2571 @defvr {Option variable} ttyoff
2572 Default value: @code{false}
2574 When @code{ttyoff} is @code{true}, output expressions are not displayed.
2575 Output expressions are still computed and assigned labels.  See @mrefdot{labels}
2577 Text printed by built-in Maxima functions, such as error messages and the output
2578 of @mrefcomma{describe} is not affected by @code{ttyoff}.
2580 @opencatbox{Categories:}
2581 @category{Display flags and variables}
2582 @closecatbox
2583 @end defvr