2 * Introduction to Command Line::
3 * Functions and Variables for Command Line::
4 * Functions and Variables for Display::
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 @c end concepts Command Line
14 @c -----------------------------------------------------------------------------
15 @node Functions and Variables for Command Line, Functions and Variables for Display, Introduction to Command Line, Command Line
16 @section Functions and Variables for Command Line
17 @c -----------------------------------------------------------------------------
19 @c -----------------------------------------------------------------------------
21 @defvr {System variable} __
22 @vrindex Current input expression
24 @code{__} is the input expression currently being evaluated. That is, while an
25 input expression @var{expr} is being evaluated, @code{__} is @var{expr}.
27 @code{__} is assigned the input expression before the input is simplified or
28 evaluated. However, the value of @code{__} is simplified (but not evaluated)
31 @code{__} is recognized by @mref{batch} and @mrefdot{load} In a file processed
32 by @code{batch}, @code{__} has the same meaning as at the interactive prompt.
33 In a file processed by @code{load}, @code{__} is bound to the input expression
34 most recently entered at the interactive prompt or in a batch file; @code{__}
35 is not bound to the input expressions in the file being processed. In
36 particular, when @code{load (@var{filename})} is called from the interactive
37 prompt, @code{__} is bound to @code{load (@var{filename})} while the file is
40 See also @mref{_} and @mrefdot{%}
45 @c print ("I was called as", __);
47 @c g (x) := (print ("Current input expression =", __), 0);
48 @c [aa : 1, bb : 2, cc : 3];
49 @c (aa + bb + cc)/(dd + ee + g(x));
53 (%i1) print ("I was called as", __);
54 I was called as print(I was called as, __)
55 (%o1) print(I was called as, __)
62 (%i3) g (x) := (print ("Current input expression =", __), 0);
63 (%o3) g(x) := (print("Current input expression =", __), 0)
66 (%i4) [aa : 1, bb : 2, cc : 3];
70 (%i5) (aa + bb + cc)/(dd + ee + g(x));
72 Current input expression = --------------
80 @opencatbox{Categories:}
81 @category{Global variables}
85 @c -----------------------------------------------------------------------------
87 @defvr {System variable} _
88 @vrindex Previous input
90 @code{_} is the most recent input expression (e.g., @code{%i1}, @code{%i2},
93 @code{_} is assigned the input expression before the input is simplified or
94 evaluated. However, the value of @code{_} is simplified (but not evaluated)
97 @code{_} is recognized by @mref{batch} and @mrefdot{load} In a file processed
98 by @code{batch}, @code{_} has the same meaning as at the interactive prompt.
99 In a file processed by @code{load}, @code{_} is bound to the input expression
100 most recently evaluated at the interactive prompt or in a batch file; @code{_}
101 is not bound to the input expressions in the file being processed.
103 See also @mref{__} and @mrefdot{%}
141 ((%SIN) ((MQUOTIENT) $%PI 2))
171 @opencatbox{Categories:}
172 @category{Console interaction}
173 @category{Global variables}
177 @c -----------------------------------------------------------------------------
179 @defvr {System variable} %
180 @vrindex Previous output
182 @code{%} is the output expression (e.g., @code{%o1}, @code{%o2}, @code{%o3},
183 @dots{}) most recently computed by Maxima, whether or not it was displayed.
185 @code{%} is recognized by @mref{batch} and @mrefdot{load} In a file processed
186 by @code{batch}, @code{%} has the same meaning as at the interactive prompt.
187 In a file processed by @code{load}, @code{%} is bound to the output expression
188 most recently computed at the interactive prompt or in a batch file; @code{%}
189 is not bound to output expressions in the file being processed.
191 See also @mrefcomma{_} @mrefcomma{%%} and @mrefdot{%th}
193 @opencatbox{Categories:}
194 @category{Console interaction}
195 @category{Global variables}
199 @c -----------------------------------------------------------------------------
201 @defvr {System variable} %%
202 @vrindex Previous result in compound expression
204 In compound statements, namely @mrefcomma{block} @mrefcomma{lambda} or
205 @code{(@var{s_1}, ..., @var{s_n})}, @code{%%} is the value of the previous
208 At the first statement in a compound statement, or outside of a compound
209 statement, @code{%%} is undefined.
211 @code{%%} is recognized by @mref{batch} and @mrefcomma{load} and it has the
212 same meaning as at the interactive prompt.
218 The following two examples yield the same result.
221 (%i1) block (integrate (x^5, x), ev (%%, x=2) - ev (%%, x=1));
225 (%i2) block ([prev], prev: integrate (x^5, x),
226 ev (prev, x=2) - ev (prev, x=1));
233 A compound statement may comprise other compound statements. Whether a
234 statement be simple or compound, @code{%%} is the value of the previous
238 (%i3) block (block (a^n, %%*42), %%/6);
243 Within a compound statement, the value of @code{%%} may be inspected at a break
244 prompt, which is opened by executing the @mref{break} function. For example,
245 entering @code{%%;} in the following example yields @code{42}.
248 (%i4) block (a: 42, break ())$
250 Entering a Maxima break point. Type 'exit;' to resume.
256 @opencatbox{Categories:}
257 @category{Global variables}
261 @c -----------------------------------------------------------------------------
263 @fnindex N'th previous output
264 @deffn {Function} %th (@var{i})
266 The value of the @var{i}'th previous output expression. That is, if the next
267 expression to be computed is the @var{n}'th output, @code{%th (@var{m})} is the
268 (@var{n} - @var{m})'th output.
270 @code{%th} is recognized by @mref{batch} and @mrefdot{load} In a file processed
271 by @code{batch}, @code{%th} has the same meaning as at the interactive prompt.
272 In a file processed by @code{load}, @code{%th} refers to output expressions most
273 recently computed at the interactive prompt or in a batch file; @code{%th} does
274 not refer to output expressions in the file being processed.
276 See also @mref{%} and @mrefdot{%%}
280 @code{%th} is useful in @code{batch} files or for referring to a group of
281 output expressions. This example sets @code{s} to the sum of the last five
291 (%i6) block (s: 0, for i:1 thru 5 do s: s + %th(i), s);
295 @opencatbox{Categories:}
296 @category{Console interaction}
300 @c -----------------------------------------------------------------------------
302 @fnindex Fetch documentation
303 @deffn {Special symbol} ?
305 As prefix to a function or variable name, @code{?} signifies that the name is a
306 Lisp name, not a Maxima name. For example, @code{?round} signifies the Lisp
307 function @code{ROUND}. See @ref{Lisp and Maxima} for more on this point.
309 The notation @code{? word} (a question mark followed a word, separated by
310 whitespace) is equivalent to @code{describe("word")}. The question mark must
311 occur at the beginning of an input line; otherwise it is not recognized as a
312 request for documentation. See also @mrefdot{describe}
314 @opencatbox{Categories:}
316 @category{Console interaction}
320 @c -----------------------------------------------------------------------------
322 @fnindex Fetch documentation (inexact search)
323 @deffn {Special symbol} ??
325 The notation @code{?? word} (@code{??} followed a word, separated by whitespace)
326 is equivalent to @code{describe("word", inexact)}. The question mark must occur
327 at the beginning of an input line; otherwise it is not recognized as a request
328 for documentation. See also @mrefdot{describe}
330 @opencatbox{Categories:}
332 @category{Console interaction}
336 @c -----------------------------------------------------------------------------
338 @fnindex Input terminator (without display)
339 @deffn {Input terminator} $
341 The dollar sign @code{$} terminates an input expression,
342 and the most recent output @code{%} and an output label, e.g. @code{%o1},
343 are assigned the result, but the result is not displayed.
366 @c -----------------------------------------------------------------------------
368 @deffn {Input terminator} ;
370 The semicolon @code{;} terminates an input expression,
371 and the resulting output is displayed.
387 @c -----------------------------------------------------------------------------
389 @defvr {Option variable} inchar
390 Default value: @code{%i}
392 @code{inchar} is the prefix of the labels of expressions entered by the user.
393 Maxima automatically constructs a label for each input expression by
394 concatenating @code{inchar} and @mrefdot{linenum}
396 @code{inchar} may be assigned any string or symbol, not necessarily a single
397 character. Because Maxima internally takes into account only the first char of
398 the prefix, the prefixes @code{inchar}, @mrefcomma{outchar} and
399 @mref{linechar} should have a different first char. Otherwise some commands
400 like @code{kill(inlabels)} do not work as expected.
402 See also @mrefdot{labels}
412 (%i1) inchar: "input";
416 (input2) expand((a+b)^3);
418 (%o2) b + 3 a b + 3 a b + a
422 @opencatbox{Categories:}
423 @category{Display flags and variables}
427 @c -----------------------------------------------------------------------------
429 @defvr {System variable} infolists
430 Default value: @code{[]}
432 @code{infolists} is a list of the names of all of the information
433 lists in Maxima. These are:
437 All bound @code{%i}, @code{%o}, and @code{%t} labels.
439 All bound atoms which are user variables, not Maxima options or switches,
440 created by @mref{:} or @mref{::} or functional binding.
441 @c WHAT IS INTENDED BY "FUNCTIONAL BINDING" HERE ??
443 All user-defined functions, created by @mref{:=} or @mrefdot{define}
445 All arrays, @mref{hashed arrays} and @mref{memoizing functions}.
447 All user-defined macro functions, created by @mrefdot{::=}
449 All options ever reset by the user (whether or not they
450 are later reset to their default values).
452 All user-defined pattern matching and simplification rules, created
453 by @mrefcomma{tellsimp} @mrefcomma{tellsimpafter} @mrefcomma{defmatch} or
456 All atoms which have a user-defined alias, created by the @mrefcomma{alias}@w{}
457 @mrefcomma{ordergreat} @mref{orderless} functions or by declaring the atom as a
458 @mref{noun} with @mrefdot{declare}
460 All atoms which have functional dependencies, created by the
461 @mref{depends}, @mref{dependencies}, or @mref{gradef} functions.
463 All functions which have user-defined derivatives, created by the
464 @mref{gradef} function.
465 @c UMM, WE REALLY NEED TO BE SPECIFIC -- WHAT DOES "ETC" CONTAIN HERE ??
467 All atoms which have any property other than those mentioned above, such as
468 properties established by @mref{atvalue} or @mref{matchdeclare}, etc.,
469 as well as properties established in the @mref{declare} function.
471 @c Is also documented in Structures.texi. But it definitively is an infolist
472 @c so it has to be documented here, too.
473 All structs defined using @mrefdot{defstruct}
474 @item let_rule_packages
475 All user-defined @mref{let} rule packages
476 plus the special package @mrefdot{default_let_rule_package}
477 (@code{default_let_rule_package} is the name of the rule package used when
478 one is not explicitly set by the user.)
481 @opencatbox{Categories:}
482 @category{Declarations and inferences}
483 @category{Global variables}
487 @c REVIEW FOR ACCURACY AND COMPLETENESS
488 @c THIS ITEM IS VERY IMPORTANT !!
491 @c -----------------------------------------------------------------------------
493 @deffn {Function} kill @
494 @fname{kill} (@var{a_1}, @dots{}, @var{a_n}) @
495 @fname{kill} (labels) @
496 @fname{kill} (inlabels, outlabels, linelabels) @
497 @fname{kill} (@var{n}) @
498 @fname{kill} ([@var{m}, @var{n}]) @
499 @fname{kill} (values, functions, arrays, @dots{}) @
501 @fname{kill} (allbut (@var{a_1}, @dots{}, @var{a_n}))
503 Removes all bindings (value, function, array, or rule) from the arguments
504 @var{a_1}, @dots{}, @var{a_n}. An argument @var{a_k} may be a symbol or a
505 single array element. When @var{a_k} is a single array element, @code{kill}
506 unbinds that element without affecting any other elements of the array.
508 Several special arguments are recognized. Different kinds of arguments
509 may be combined, e.g., @code{kill (inlabels, functions, allbut (foo, bar))}.
511 @code{kill (labels)} unbinds all input, output, and intermediate expression
512 labels created so far. @code{kill (inlabels)} unbinds only input labels which
513 begin with the current value of @mrefdot{inchar} Likewise,
514 @code{kill (outlabels)} unbinds only output labels which begin with the current
515 value of @mrefcomma{outchar} and @code{kill (linelabels)} unbinds only
516 intermediate expression labels which begin with the current value of
519 @code{kill (@var{n})}, where @var{n} is an integer,
520 unbinds the @var{n} most recent input and output labels.
522 @code{kill ([@var{m}, @var{n}])} unbinds input and output labels @var{m} through
525 @code{kill (@var{infolist})}, where @var{infolist} is any item in
526 @code{infolists} (such as @mrefcomma{values} @mrefcomma{functions} or
527 @mref{arrays}) unbinds all items in @var{infolist}.
528 See also @mrefdot{infolists}
530 @code{kill (all)} unbinds all items on all infolists. @code{kill (all)} does
531 not reset global variables to their default values; see @mref{reset} on this
534 @code{kill (allbut (@var{a_1}, ..., @var{a_n}))} unbinds all items on all
535 infolists except for @var{a_1}, @dots{}, @var{a_n}.
536 @code{kill (allbut (@var{infolist}))} unbinds all items except for the ones on
537 @var{infolist}, where @var{infolist} is @mrefcomma{values}@w{}
538 @mrefcomma{functions} @mrefcomma{arrays} etc.
540 The memory taken up by a bound property is not released until all symbols are
541 unbound from it. In particular, to release the memory taken up by the value of
542 a symbol, one unbinds the output label which shows the bound value, as well as
543 unbinding the symbol itself.
545 @code{kill} quotes its arguments. The quote-quote operator @code{'@w{}'}
548 @code{kill (@var{symbol})} unbinds all properties of @var{symbol}. In contrast,
549 the functions @mrefcomma{remvalue} @mrefcomma{remfunction}@w{}
550 @mrefcomma{remarray} and @mref{remrule} unbind a specific property.
551 Note that facts declared by @mref{assume} don't require a symbol they apply to,
552 therefore aren't stored as properties of symbols and therefore aren't affected
555 @code{kill} always returns @code{done}, even if an argument has no binding.
557 @opencatbox{Categories:}
558 @category{Evaluation}
559 @category{Console interaction}
560 @category{Session management}
564 @c -----------------------------------------------------------------------------
566 @deffn {Function} labels (@var{symbol})
568 Returns the list of input, output, or intermediate expression labels which begin
569 with @var{symbol}. Typically @var{symbol} is the value of
570 @mrefcomma{inchar} @mrefcomma{outchar} or @mrefdot{linechar}
571 If no labels begin with @var{symbol}, @code{labels} returns an empty list.
573 By default, Maxima displays the result of each user input expression, giving the
574 result an output label. The output display is suppressed by terminating the
575 input with @code{$} (dollar sign) instead of @code{;} (semicolon). An output
576 label is constructed and bound to the result, but not displayed, and the label
577 may be referenced in the same way as displayed output labels. See also
578 @mrefcomma{%} @mrefcomma{%%} and @mrefdot{%th}
580 Intermediate expression labels can be generated by some functions. The option
581 variable @mref{programmode} controls whether @mref{solve} and some other
582 functions generate intermediate expression labels instead of returning a list of
583 expressions. Some other functions, such as @mrefcomma{ldisplay} always generate
584 intermediate expression labels.
586 See also @mrefcomma{inchar} @mrefcomma{outchar} @mrefcomma{linechar} and
589 @opencatbox{Categories:}
590 @category{Display functions}
591 @category{Console interaction}
595 @defvr {System variable} labels
597 The variable @code{labels} is the list of input, output, and intermediate
598 expression labels, including all previous labels if @code{inchar},
599 @code{outchar}, or @code{linechar} were redefined.
601 @opencatbox{Categories:}
602 @category{Display flags and variables}
603 @category{Console interaction}
607 @c -----------------------------------------------------------------------------
609 @defvr {Option variable} linechar
610 Default value: @code{%t}
612 @code{linechar} is the prefix of the labels of intermediate expressions
613 generated by Maxima. Maxima constructs a label for each intermediate expression
614 (if displayed) by concatenating @code{linechar} and @mrefdot{linenum}
616 @code{linechar} may be assigned any string or symbol, not necessarily a single
617 character. Because Maxima internally takes into account only the first char of
618 the prefix, the prefixes @mrefcomma{inchar} @mrefcomma{outchar} and
619 @code{linechar} should have a different first char. Otherwise some commands
620 like @code{kill(inlabels)} do not work as expected.
622 Intermediate expressions might or might not be displayed.
623 See @mref{programmode} and @mrefdot{labels}
625 @opencatbox{Categories:}
626 @category{Display flags and variables}
630 @c EXPAND; SHOW WHAT HAPPENS WHEN linenum IS ASSIGNED A VALUE
632 @c -----------------------------------------------------------------------------
634 @defvr {System variable} linenum
636 The line number of the current pair of input and output expressions.
638 @opencatbox{Categories:}
639 @category{Display flags and variables}
640 @category{Console interaction}
646 @c -----------------------------------------------------------------------------
648 @defvr {System variable} myoptions
649 Default value: @code{[]}
651 @code{myoptions} is the list of all options ever reset by the user,
652 whether or not they get reset to their default value.
654 @opencatbox{Categories:}
655 @category{Global variables}
656 @category{Session management}
657 @category{Console interaction}
661 @c -----------------------------------------------------------------------------
663 @defvr {Option variable} nolabels
664 Default value: @code{false}
666 When @code{nolabels} is @code{true}, input and output result labels (@code{%i}
667 and @code{%o}, respectively) are displayed, but the labels are not bound to
668 results, and the labels are not appended to the @mref{labels} list. Since
669 labels are not bound to results, garbage collection can recover the memory taken
672 Otherwise input and output result labels are bound to results, and the labels
673 are appended to the @code{labels} list.
675 Intermediate expression labels (@code{%t}) are not affected by @code{nolabels};
676 whether @code{nolabels} is @code{true} or @code{false}, intermediate expression
677 labels are bound and appended to the @code{labels} list.
679 See also @mrefcomma{batch} @mrefcomma{load} and @mrefdot{labels}
681 @opencatbox{Categories:}
682 @category{Global flags}
683 @category{Session management}
689 @c -----------------------------------------------------------------------------
691 @defvr {Option variable} optionset
692 Default value: @code{false}
694 When @code{optionset} is @code{true}, Maxima prints out a message whenever a
695 Maxima option is reset. This is useful if the user is doubtful of the spelling
696 of some option and wants to make sure that the variable he assigned a value to
697 was truly an option variable.
702 (%i1) optionset:true;
703 assignment: assigning to option optionset
705 (%i2) gamma_expand:true;
706 assignment: assigning to option gamma_expand
710 @opencatbox{Categories:}
711 @category{Global flags}
712 @category{Session management}
713 @category{Console interaction}
717 @c -----------------------------------------------------------------------------
720 @defvr {Option variable} outchar
721 Default value: @code{%o}
723 @code{outchar} is the prefix of the labels of expressions computed by Maxima.
724 Maxima automatically constructs a label for each computed expression by
725 concatenating @code{outchar} and @mrefdot{linenum}
727 @code{outchar} may be assigned any string or symbol, not necessarily a single
728 character. Because Maxima internally takes into account only the first char of
729 the prefix, the prefixes @mrefcomma{inchar} @code{outchar} and
730 @mref{linechar} should have a different first char. Otherwise some commands
731 like @code{kill(inlabels)} do not work as expected.
733 See also @mref{labels}.
738 @c outchar: "output";
743 (%i1) outchar: "output";
747 (%i2) expand((a+b)^3);
749 (output2) b + 3 a b + 3 a b + a
753 @opencatbox{Categories:}
754 @category{Display flags and variables}
758 @c -----------------------------------------------------------------------------
760 @deffn {Function} playback @
761 @fname{playback} () @
762 @fname{playback} (@var{n}) @
763 @fname{playback} ([@var{m}, @var{n}]) @
764 @fname{playback} ([@var{m}]) @
765 @fname{playback} (input) @
766 @fname{playback} (slow) @
767 @fname{playback} (time) @
768 @fname{playback} (grind)
770 Displays input, output, and intermediate expressions, without recomputing them.
771 @code{playback} only displays the expressions bound to labels; any other output
772 (such as text printed by @mref{print} or @mrefcomma{describe} or error messages)
773 is not displayed. See also @mrefdot{labels}
775 @code{playback} quotes its arguments. The quote-quote operator @code{'@w{}'}
776 defeats quotation. @code{playback} always returns @code{done}.
778 @code{playback ()} (with no arguments) displays all input, output, and
779 intermediate expressions generated so far. An output expression is displayed
780 even if it was suppressed by the @code{$} terminator when it was originally
783 @code{playback (@var{n})} displays the most recent @var{n} expressions.
784 Each input, output, and intermediate expression counts as one.
786 @code{playback ([@var{m}, @var{n}])} displays input, output, and intermediate
787 expressions with numbers from @var{m} through @var{n}, inclusive.
789 @code{playback ([@var{m}])} is equivalent to
790 @code{playback ([@var{m}, @var{m}])}; this usually prints one pair of input and
793 @code{playback (input)} displays all input expressions generated so far.
795 @code{playback (slow)} pauses between expressions and waits for the user to
796 press @code{enter}. This behavior is similar to @mrefdot{demo}
797 @c WHAT DOES THE FOLLOWING MEAN ???
798 @code{playback (slow)} is useful in conjunction with @code{save} or
799 @mref{stringout} when creating a secondary-storage file in order to pick out
802 @code{playback (time)} displays the computation time for each expression.
803 @c DON'T BOTHER TO MENTION OBSOLETE OPTIONS !!!
804 @c The arguments @code{gctime} and @code{totaltime} have the same effect as @code{time}.
806 @code{playback (grind)} displays input expressions in the same format as the
807 @code{grind} function. Output expressions are not affected by the @code{grind}
808 option. See @mrefdot{grind}
810 Arguments may be combined, e.g., @code{playback ([5, 10], grind, time, slow)}.
811 @c APPEARS TO BE input INTERSECT (UNION OF ALL OTHER ARGUMENTS). CORRECT ???
813 @opencatbox{Categories:}
814 @category{Display functions}
815 @category{Console interaction}
819 @c -----------------------------------------------------------------------------
822 @defvr {Option variable} prompt
823 Default value: @code{_}
825 @code{prompt} is the prompt symbol of the @mref{demo} function,
826 @code{playback (slow)} mode, and the Maxima break loop (as invoked by
829 @opencatbox{Categories:}
830 @category{Global variables}
831 @category{Console interaction}
835 @c -----------------------------------------------------------------------------
837 @deffn {Function} quit ([@var{exit-code}])
839 Terminates the Maxima session. Note that the function must be invoked as
840 @code{quit();} or @code{quit()$}, not @code{quit} by itself.
841 @code{quit} supports returning an exit code to the shell for Lisps and
842 OSes that support exit codes. The default exit code is 0 (usually
843 indicating no errors encountered). Thus @code{quit(1)} indicates to the
844 shell that maxima exited with some kind of failure. This is useful in
845 scripts where maxima can indicate to the shell that maxima failed to
846 compute something or some other bad thing happened.
848 To stop a lengthy computation, type @code{control-C}. The default action is to
849 return to the Maxima prompt. If @code{*debugger-hook*} is @code{nil},
850 @code{control-C} opens the Lisp debugger. See also @ref{Debugging}.
852 @opencatbox{Categories:}
853 @category{Console interaction}
857 @c -----------------------------------------------------------------------------
859 @deffn {Function} read (@var{expr_1}, @dots{}, @var{expr_n})
861 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
862 console and returns the evaluated expression. The expression is terminated with
863 a semicolon @code{;} or dollar sign @code{$}.
865 See also @mref{readonly}
871 (%i2) foo: read ("foo is", foo, " -- enter new value.")$
872 foo is 42 -- enter new value.
879 @opencatbox{Categories:}
880 @category{Console interaction}
884 @c -----------------------------------------------------------------------------
886 @deffn {Function} readonly (@var{expr_1}, @dots{}, @var{expr_n})
888 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
889 console and returns the expression (without evaluation). The expression is
890 terminated with a @code{;} (semicolon) or @code{$} (dollar sign).
892 See also @mrefdot{read}
898 (%i2) foo: readonly ("Enter an expression:");
903 (%i3) foo: read ("Enter an expression:");
909 @opencatbox{Categories:}
910 @category{Console interaction}
914 @c -----------------------------------------------------------------------------
916 @deffn {Function} reset ()
918 Resets many global variables and options, and some other variables, to their
921 @code{reset} processes the variables on the Lisp list
922 @code{*variable-initial-values*}. The Lisp macro @code{defmvar} puts variables
923 on this list (among other actions). Many, but not all, global variables and
924 options are defined by @code{defmvar}, and some variables defined by
925 @code{defmvar} are not global variables or options.
927 @opencatbox{Categories:}
928 @category{Session management}
932 @c -----------------------------------------------------------------------------
934 @defvr {Option variable} showtime
935 Default value: @code{false}
937 When @code{showtime} is @code{true}, the computation time and elapsed time is
938 printed with each output expression.
940 The computation time is always recorded, so @mref{time} and @mref{playback} can
941 display the computation time even when @code{showtime} is @code{false}.
943 See also @mrefdot{timer}
945 @opencatbox{Categories:}
946 @category{Display flags and variables}
951 @c -----------------------------------------------------------------------------
953 @deffn {Function} to_lisp ()
955 Enters the Lisp system under Maxima. @code{(to-maxima)} returns to Maxima.
959 Define a function and enter the Lisp system under Maxima. The definition is
960 inspected on the property list, then the function definition is extracted,
961 factored and stored in the variable @code{$result}. The variable can be used in Maxima
962 after returning to Maxima.
969 Type (to-maxima) to restart, ($quit) to quit Maxima.
970 MAXIMA> (symbol-plist '$f)
971 (MPROPS (NIL MEXPR ((LAMBDA) ((MLIST) $X)
972 ((MPLUS) ((MEXPT) $X 2) $X))))
973 MAXIMA> (setq $result ($factor (caddr (mget '$f 'mexpr))))
974 ((MTIMES SIMP FACTORED) $X ((MPLUS SIMP IRREDUCIBLE) 1 $X))
982 @opencatbox{Categories:}
983 @category{Console interaction}
987 @c -----------------------------------------------------------------------------
988 @anchor{eval_string_lisp}
989 @deffn {Function} eval_string_lisp (@var{str})
991 Sequentially read lisp forms from the string @var{str} and evaluate them.
992 Any values produced from the last form are returned as a Maxima list.
997 @c eval_string_lisp ("");
998 @c eval_string_lisp ("(values)");
999 @c eval_string_lisp ("69");
1000 @c eval_string_lisp ("1 2 3");
1001 @c eval_string_lisp ("(values 1 2 3)");
1002 @c eval_string_lisp ("(defun $foo (x) (* 2 x))");
1007 (%i1) eval_string_lisp ("");
1011 (%i2) eval_string_lisp ("(values)");
1015 (%i3) eval_string_lisp ("69");
1019 (%i4) eval_string_lisp ("1 2 3");
1023 (%i5) eval_string_lisp ("(values 1 2 3)");
1027 (%i6) eval_string_lisp ("(defun $foo (x) (* 2 x))");
1036 See also @ref{eval_string}.
1038 @opencatbox{Categories:}
1039 @category{Debugging}
1040 @category{Evaluation}
1045 @c -----------------------------------------------------------------------------
1047 @defvr {System variable} values
1048 Initial value: @code{[]}
1050 @code{values} is a list of all bound user variables (not Maxima options or
1051 switches). The list comprises symbols bound by @mrefcomma{:} or @mrefdot{::}
1053 If the value of a variable is removed with the commands @code{kill},
1054 @mrefcomma{remove} or @mref{remvalue} the variable is deleted from
1057 See @mref{functions} for a list of user defined functions.
1061 First, @code{values} shows the symbols @code{a}, @code{b}, and @code{c}, but
1062 not @code{d}, it is not bound to a value, and not the user function @code{f}.
1063 The values are removed from the variables. @code{values} is the empty list.
1066 @c [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1068 @c [kill(a), remove(b,value), remvalue(c)];
1073 (%i1) [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1075 (%o1) [99, 9, 90, d, f(x) := x ]
1082 (%i3) [kill(a), remove(b,value), remvalue(c)];
1083 (%o3) [done, done, [c]]
1091 @opencatbox{Categories:}
1092 @category{Evaluation}
1093 @category{Global variables}
1097 @c -----------------------------------------------------------------------------
1098 @node Functions and Variables for Display, , Functions and Variables for Command Line, Command Line
1099 @section Functions and Variables for Display
1100 @c -----------------------------------------------------------------------------
1102 @c -----------------------------------------------------------------------------
1104 @defvr {Option variable} %edispflag
1105 Default value: @code{false}
1107 When @code{%edispflag} is @code{true}, Maxima displays @code{%e} to a negative
1108 exponent as a quotient. For example, @code{%e^-x} is displayed as
1109 @code{1/%e^x}. See also @mrefdot{exptdispflag}
1124 (%i2) %edispflag:true$
1134 @opencatbox{Categories:}
1135 @category{Exponential and logarithm functions}
1136 @category{Display flags and variables}
1140 @c -----------------------------------------------------------------------------
1142 @defvr {Option variable} absboxchar
1143 Default value: @code{!}
1145 @code{absboxchar} is the character used to draw absolute value
1146 signs around expressions which are more than one line tall.
1148 @code{absboxchar} is only used when @code{display2d_unicode} is @code{false}.
1153 (%i1) display2d_unicode: false $
1159 @opencatbox{Categories:}
1160 @category{Display flags and variables}
1164 @c AFTER REVIEWING src/displa.lisp, IT LOOKS LIKE THIS VARIABLE HAS NO EFFECT
1165 @c CUT IT ON THE NEXT PASS
1166 @c @defvar cursordisp
1167 @c Default value: @code{true}
1169 @c When @code{cursordisp} is @code{true}, expressions are drawn by
1170 @c the displayer in logical sequence. This only works with a console
1171 @c which can do cursor movement. If @code{false}, expressions are
1172 @c printed line by line.
1174 @c @code{cursordisp} is always @code{false} when a @code{writefile} is in
1179 @c -----------------------------------------------------------------------------
1180 @anchor{declare_index_properties}
1181 @deffn {Function} declare_index_properties (@var{a}, [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1182 @deffnx {Function} declare_index_properties ([@var{a}, @var{b}, @var{c}, ...], [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1183 @deffnx {Symbol} postsubscript
1184 @deffnx {Symbol} postsuperscript
1185 @deffnx {Symbol} presuperscript
1186 @deffnx {Symbol} presubscript
1188 Declares the properties of indices applied to the symbol @var{a}
1189 or each of the of symbols @var{a}, @var{b}, @var{c}, ....
1190 If multiple symbols are given,
1191 the whole list of properties applies to each symbol.
1193 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1194 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1195 There may be any number of index properties, in any order.
1197 Each property @var{p_k} must one of these four recognized properties:
1198 @code{postsubscript}, @code{postsuperscript}, @code{presuperscript}, or @code{presubscript},
1199 to denote indices which are displayed, respectively,
1200 to the right and below, to the right and above, to the left and above, or to the left and below.
1202 Index properties apply only to the 2-dimensional display of indexed variables
1203 (i.e., when @mref{display2d} is @code{true})
1204 and TeX output via @code{tex}.
1205 Otherwise, index properties are ignored.
1206 Index properties do not change the input of indexed variables,
1207 do not change the algebraic properties of indexed variables,
1208 and do not change the 1-dimensional display of indexed variables.
1210 @code{declare_index_properties} quotes (does not evaluate) its arguments.
1212 @code{remove_index_properties} removes index properties.
1213 @code{kill} also removes index properties (and all other properties).
1215 @code{get_index_properties} retrieves index properties.
1219 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1220 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1221 There may be any number of index properties, in any order.
1224 @c declare_index_properties (A, [presubscript, postsubscript]);
1225 @c declare_index_properties (B, [postsuperscript, postsuperscript,
1226 @c presuperscript]);
1227 @c declare_index_properties (C, [postsuperscript, presubscript,
1228 @c presubscript, presuperscript]);
1235 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1239 (%i2) declare_index_properties (B, [postsuperscript, postsuperscript,
1244 (%i3) declare_index_properties (C, [postsuperscript, presubscript,
1245 presubscript, presuperscript]);
1259 (%i6) C[w, x, y, z];
1266 Index properties apply only to the 2-dimensional display of indexed variables and TeX output.
1267 Otherwise, index properties are ignored.
1270 @c declare_index_properties (A, [presubscript, postsubscript]);
1273 @c display2d: false $
1275 @c display2d: true $
1277 @c stringdisp: true $
1278 @c string (A[w, x]);
1282 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1291 (%i3) tex (A[w, x]);
1292 $$@{@}_@{w@}A_@{x@}$$
1295 (%i4) display2d: false $
1300 (%i6) display2d: true $
1302 (%i7) grind (A[w, x]);
1306 (%i8) stringdisp: true $
1308 (%i9) string (A[w, x]);
1313 @opencatbox{Categories:}
1314 @category{Display flags and variables}
1318 @c -----------------------------------------------------------------------------
1319 @anchor{get_index_properties}
1320 @deffn {Function} get_index_properties (@var{a})
1322 Returns the properties for @var{a} established by @code{declare_index_properties}.
1324 See also @mrefdot{remove_index_properties}
1326 @opencatbox{Categories:}
1327 @category{Display flags and variables}
1331 @c -----------------------------------------------------------------------------
1332 @anchor{remove_index_properties}
1333 @deffn {Function} remove_index_properties (@var{a}, @var{b}, @var{c}, ...)
1335 Removes the properties established by @code{declare_index_properties}.
1336 All index properties are removed from each symbol @var{a}, @var{b}, @var{c}, ....
1338 @code{remove_index_properties} quotes (does not evaluate) its arguments.
1340 @opencatbox{Categories:}
1341 @category{Display flags and variables}
1345 @c -----------------------------------------------------------------------------
1346 @anchor{display_index_separator}
1347 @defvr {Symbol property} display_index_separator
1349 When a symbol @var{A} has index display properties declared via @code{declare_index_properties},
1350 the value of the property @code{display_index_separator}
1351 is the string or other expression which is displayed between indices.
1353 The value of @code{display_index_separator}
1354 is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1355 where @var{S} is a string or other expression.
1356 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1358 The display index separator @var{S} can be a string, including an empty string,
1359 or @code{false}, indicating the default separator, or any expression.
1360 If not a string and not @code{false}, the property value is coerced to a string via @code{string}.
1362 If no display index separator is assigned, the default separator is used.
1363 The default separator is a comma.
1364 There is no way to change the default separator.
1366 Each symbol has its own value of @code{display_index_separator}.
1368 See also @mref{put}, @mref{get}, and @mrefdot{declare_index_properties}
1372 When a symbol @var{A} has index display properties,
1373 the value of the property @code{display_index_separator}
1374 is the string or other expression which is displayed between indices.
1375 The value is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1378 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1379 @c presubscript, presubscript]);
1380 @c put (A, ";", display_index_separator);
1385 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1386 presubscript, presubscript]);
1390 (%i2) put (A, ";", display_index_separator);
1394 (%i3) A[w, x, y, z];
1401 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1404 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1405 @c presubscript, presubscript]);
1406 @c put (A, ";", display_index_separator);
1407 @c get (A, display_index_separator);
1411 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1412 presubscript, presubscript]);
1416 (%i2) put (A, ";", display_index_separator);
1420 (%i3) get (A, display_index_separator);
1425 The display index separator @var{S} can be a string, including an empty string,
1426 or @code{false}, indicating the default separator, or any expression.
1429 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1430 @c presubscript, presubscript]);
1432 @c put (A, "-", display_index_separator);
1434 @c put (A, " ", display_index_separator);
1436 @c put (A, "", display_index_separator);
1438 @c put (A, false, display_index_separator);
1440 @c put (A, 'foo, display_index_separator);
1445 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1446 presubscript, presubscript]);
1450 (%i2) A[w, x, y, z];
1456 (%i3) put (A, "-", display_index_separator);
1460 (%i4) A[w, x, y, z];
1466 (%i5) put (A, " ", display_index_separator);
1470 (%i6) A[w, x, y, z];
1476 (%i7) put (A, "", display_index_separator);
1480 (%i8) A[w, x, y, z];
1486 (%i9) put (A, false, display_index_separator);
1490 (%i10) A[w, x, y, z];
1496 (%i11) put (A, 'foo, display_index_separator);
1500 (%i12) A[w, x, y, z];
1507 If no display index separator is assigned, the default separator is used.
1508 The default separator is a comma.
1511 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1512 @c presubscript, presubscript]);
1517 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1518 presubscript, presubscript]);
1522 (%i2) A[w, x, y, z];
1529 Each symbol has its own value of @code{display_index_separator}.
1532 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1533 @c presubscript, presubscript]);
1534 @c put (A, " ", display_index_separator);
1535 @c declare_index_properties (B, [presuperscript, presuperscript,
1536 @c postsubscript, postsubscript]);
1537 @c put (B, ";", display_index_separator);
1538 @c A[w, x, y, z] + B[w, x, y, z];
1542 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1543 presubscript, presubscript]);
1547 (%i2) put (A, " ", display_index_separator);
1551 (%i3) declare_index_properties (B, [postsuperscript, postsuperscript, presubscript, presubscript]);
1555 (%i4) put (B, ";", display_index_separator);
1559 (%i5) A[w, x, y, z] + B[w, x, y, z];
1566 @opencatbox{Categories:}
1567 @category{Display flags and variables}
1571 @c -----------------------------------------------------------------------------
1573 @deffn {Function} disp (@var{expr_1}, @var{expr_2}, @dots{})
1575 is like @mref{display} but only the value of the arguments are displayed rather
1576 than equations. This is useful for complicated arguments which don't have names
1577 or where only the value of the argument is of interest and not the name.
1579 See also @mref{ldisp} and @mrefdot{print}
1586 @c disp(x, b[1,2], sin(1.0));
1592 (%i3) disp(x, b[1,2], sin(1.0));
1604 @opencatbox{Categories:}
1605 @category{Display functions}
1609 @c -----------------------------------------------------------------------------
1611 @deffn {Function} display (@var{expr_1}, @var{expr_2}, @dots{})
1613 Displays equations whose left side is @var{expr_i} unevaluated, and whose right
1614 side is the value of the expression centered on the line. This function is
1615 useful in blocks and @mref{for} statements in order to have intermediate results
1616 displayed. The arguments to @code{display} are usually atoms, subscripted
1617 variables, or function calls.
1619 See also @mrefcomma{ldisplay} @mrefcomma{disp} and @mrefdot{ldisp}
1626 @c display(x, b[1,2], sin(1.0));
1632 (%i3) display(x, b[1,2], sin(1.0));
1639 sin(1.0) = 0.8414709848078965
1645 @opencatbox{Categories:}
1646 @category{Display functions}
1650 @c -----------------------------------------------------------------------------
1652 @defvr {Option variable} display2d
1653 Default value: @code{true}
1655 When @code{display2d} is @code{true},
1656 the console display is an attempt to present mathematical expressions
1657 as they might appear in books and articles,
1658 using only letters, numbers, and some punctuation characters.
1659 This display is sometimes called the "pretty printer" display.
1661 When @code{display2d} is @code{true},
1662 Maxima attempts to honor the global variable for line length, @code{linel}.
1663 When an atom (symbol, number, or string) would otherwise cause a line to exceed @code{linel},
1664 the atom may be printed in pieces on successive lines,
1665 with a continuation character (backslash, @code{\}) at the end of the leading piece;
1666 however, in some cases, such atoms are printed without a line break,
1667 and the length of the line is greater than @code{linel}.
1669 When @code{display2d} is @code{false},
1670 the console display is a 1-dimensional or linear form
1671 which is the same as the output produced by @code{grind}.
1673 When @code{display2d} is @code{false},
1674 the value of @mref{stringdisp} is ignored,
1675 and strings are always displayed with quote marks.
1677 When @code{display2d} is @code{false},
1678 Maxima attempts to honor @code{linel},
1679 but atoms are not broken across lines,
1680 and the actual length of an output line may exceed @code{linel}.
1682 See also @mref{leftjust} to switch between a left justified and a centered
1683 display of equations.
1700 (%i2) display2d:false$
1707 @opencatbox{Categories:}
1708 @category{Display flags and variables}
1712 @c -----------------------------------------------------------------------------
1713 @anchor{display_format_internal}
1714 @defvr {Option variable} display_format_internal
1715 Default value: @code{false}
1717 When @code{display_format_internal} is @code{true}, expressions are displayed
1718 without being transformed in ways that hide the internal mathematical
1719 representation. The display then corresponds to what @mref{inpart} returns
1720 rather than @mrefdot{part}
1726 a-b; a - b a + (- 1) b
1739 @opencatbox{Categories:}
1740 @category{Display flags and variables}
1744 @c -----------------------------------------------------------------------------
1745 @anchor{with_default_2d_display}
1746 @deffn {Function} with_default_2d_display (expr)
1748 While maxima by default realizes 2d Output using ASCII-Art some frontend
1749 change that to TeX, MathML or a specific XML dialect that better suits
1750 the needs for this specific frontend. @code{with_default_2d_display}
1751 temporarily switches maxima to the default 2D ASCII Art formatter for
1752 outputting the result of @code{expr}.
1754 See also @mref{set_alt_display} and @mrefdot{display2d}
1756 @opencatbox{Categories:}
1757 @category{Display functions}
1761 @c -----------------------------------------------------------------------------
1762 @anchor{display2d_unicode}
1763 @defvr {Option variable} display2d_unicode
1764 Default value: @code{true}
1766 When @code{display2d_unicode} is @code{true},
1767 the 2-d pretty printer (enabled by the global flag @code{display2d}) uses Unicode drawing characters [1] to display
1768 integrals, summations, products, matrices, ratios, derivatives,
1769 @code{box} expressions, @code{at} expressions, and absolute value expressions.
1771 Otherwise, the pretty printer uses only ASCII characters to display every kind of expression.
1773 In addition to displaying expressions in console interaction (as @code{%o} labeled expressions),
1774 the 2-d pretty printer is invoked to display expressions for @code{print},
1775 and @code{printf} with the @code{~m} format specifier.
1780 Expressions displayed by 2-d pretty printer using Unicode drawing characters
1781 (@code{display2d_unicode} equal to @code{true}),
1784 @image{figures/maxima-unicode-display-variety-1}
1786 Same expressions, displayed using only ASCII characters
1787 (@code{display2d_unicode} equal to @code{false}),
1790 @image{figures/maxima-unicode-display-variety-1-ascii}
1796 [1] @url{https://en.wikipedia.org/wiki/Box-drawing_character}
1798 @opencatbox{Categories:}
1799 @category{Display flags and variables}
1804 @c IS THIS FUNCTION STILL USEFUL ???
1805 @c REPHRASE, NEEDS EXAMPLES
1807 @c -----------------------------------------------------------------------------
1809 @deffn {Function} dispterms (@var{expr})
1811 Displays @var{expr} in parts one below the other. That is, first the operator
1812 of @var{expr} is displayed, then each term in a sum, or factor in a product, or
1813 part of a more general expression is displayed separately. This is useful if
1814 @var{expr} is too large to be otherwise displayed. For example if @code{P1},
1815 @code{P2}, @dots{} are very large expressions then the display program may run
1816 out of storage space in trying to display @code{P1 + P2 + ...} all at once.
1817 However, @code{dispterms (P1 + P2 + ...)} displays @code{P1}, then below it
1818 @code{P2}, etc. When not using @code{dispterms}, if an exponential expression
1819 is too wide to be displayed as @code{A^B} it appears as @code{expt (A, B)} (or
1820 as @code{ncexpt (A, B)} in the case of @code{A^^B}).
1825 (%i1) dispterms(2*a*sin(x)+%e^x);
1837 @opencatbox{Categories:}
1838 @category{Display functions}
1842 @c -----------------------------------------------------------------------------
1845 @deffn {Special symbol} expt (@var{a}, @var{b})
1846 @deffnx {Special symbol} ncexpt (@var{a}, @var{b})
1848 If an exponential expression is too wide to be displayed as
1849 @code{@var{a}^@var{b}} it appears as @code{expt (@var{a}, @var{b})} (or as
1850 @code{ncexpt (@var{a}, @var{b})} in the case of @code{@var{a}^^@var{b}}).
1852 @c THIS SEEMS LIKE A BUG TO ME. expt, ncexpt SHOULD BE RECOGNIZED SINCE MAXIMA
1853 @c ITSELF PRINTS THEM SOMETIMES. THESE SHOULD JUST SIMPLIFY TO ^ AND ^^,
1855 @code{expt} and @code{ncexpt} are not recognized in input.
1858 @c -----------------------------------------------------------------------------
1859 @anchor{exptdispflag}
1860 @defvr {Option variable} exptdispflag
1861 Default value: @code{true}
1863 When @code{exptdispflag} is @code{true}, Maxima displays expressions
1864 with negative exponents using quotients. See also @mrefdot{%edispflag}
1869 (%i1) exptdispflag:true;
1876 (%i3) exptdispflag:false;
1883 @opencatbox{Categories:}
1884 @category{Expressions}
1885 @category{Display flags and variables}
1889 @c -----------------------------------------------------------------------------
1891 @deffn {Function} grind (@var{expr})
1893 The function @code{grind} prints @var{expr} to the console in a form suitable
1894 for input to Maxima. @code{grind} always returns @code{done}.
1896 When @var{expr} is the name of a function or macro, @code{grind} prints the
1897 function or macro definition instead of just the name.
1899 See also @mrefcomma{string} which returns a string instead of printing its
1900 output. @code{grind} attempts to print the expression in a manner which makes
1901 it slightly easier to read than the output of @code{string}.
1903 @code{grind} evaluates its argument.
1910 @c [aa, 1729, aa + 1729];
1912 @c matrix ([aa, 17], [29, bb]);
1914 @c set (aa, 17, 29, bb);
1916 @c exp (aa / (bb + 17)^29);
1918 @c expr: expand ((aa + bb)^10);
1921 @c cholesky (A):= block ([n : length (A), L : copymatrix (A),
1922 @c p : makelist (0, i, 1, length (A))],
1923 @c for i thru n do for j : i thru n do
1924 @c (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
1925 @c if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
1926 @c for i thru n do L[i, i] : 1 / p[i],
1927 @c for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
1928 @c grind (cholesky);
1929 @c string (fundef (cholesky));
1942 (%i3) [aa, 1729, aa + 1729];
1943 (%o3) [aa, 1729, aa + 1729]
1951 (%i5) matrix ([aa, 17], [29, bb]);
1958 matrix([aa,17],[29,bb])$
1962 (%i7) set (aa, 17, 29, bb);
1963 (%o7) @{17, 29, aa, bb@}
1971 (%i9) exp (aa / (bb + 17)^29);
1984 (%i11) expr: expand ((aa + bb)^10);
1986 (%o11) bb + 10 aa bb + 45 aa bb + 120 aa bb + 210 aa bb
1988 + 252 aa bb + 210 aa bb + 120 aa bb + 45 aa bb
1993 (%i12) grind (expr);
1994 bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6
1995 +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2
2000 (%i13) string (expr);
2001 (%o13) bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6\
2002 +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2+10*aa^9*\
2006 (%i14) cholesky (A):= block ([n : length (A), L : copymatrix (A),
2007 p : makelist (0, i, 1, length (A))],
2008 for i thru n do for j : i thru n do
2009 (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
2010 if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
2011 for i thru n do L[i, i] : 1 / p[i],
2012 for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
2013 define: warning: redefining the built-in function cholesky
2016 (%i15) grind (cholesky);
2018 [n:length(A),L:copymatrix(A),
2019 p:makelist(0,i,1,length(A))],
2021 (for j from i thru n do
2022 (x:L[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),
2023 if i = j then p[i]:1/sqrt(x)
2024 else L[j,i]:x*p[i])),
2025 for i thru n do L[i,i]:1/p[i],
2026 for i thru n do (for j from i+1 thru n do L[i,j]:0),L)$
2030 (%i16) string (fundef (cholesky));
2031 (%o16) cholesky(A):=block([n:length(A),L:copymatrix(A),p:makelis\
2032 t(0,i,1,length(A))],for i thru n do (for j from i thru n do (x:L\
2033 [i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),if i = j then p[i]:1/sqrt(x\
2034 ) else L[j,i]:x*p[i])),for i thru n do L[i,i]:1/p[i],for i thru \
2035 n do (for j from i+1 thru n do L[i,j]:0),L)
2039 @opencatbox{Categories:}
2040 @category{Display functions}
2044 @defvr {Option variable} grind
2046 When the variable @code{grind} is @code{true}, the output of @code{string} and
2047 @mref{stringout} has the same format as that of @code{grind}; otherwise no
2048 attempt is made to specially format the output of those functions. The default
2049 value of the variable @code{grind} is @code{false}.
2051 @code{grind} can also be specified as an argument of @mrefdot{playback} When
2052 @code{grind} is present, @code{playback} prints input expressions in the same
2053 format as the @code{grind} function. Otherwise, no attempt is made to specially
2054 format input expressions.
2056 @opencatbox{Categories:}
2057 @category{Display flags and variables}
2061 @c -----------------------------------------------------------------------------
2063 @defvr {Option variable} ibase
2064 Default value: @code{10}
2066 @code{ibase} is the base for integers read by Maxima.
2068 @code{ibase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2069 When @code{ibase} is greater than 10,
2070 the numerals comprise the decimal numerals 0 through 9
2071 plus letters of the alphabet @code{A}, @code{B}, @code{C}, @dots{},
2072 as needed to make @code{ibase} digits in all.
2073 Letters are interpreted as digits only if the first digit is 0 through 9.
2075 Uppercase and lowercase letters are not distinguished.
2076 The numerals for base 36, the largest acceptable base,
2077 comprise 0 through 9 and @code{A} through @code{Z}.
2079 Whatever the value of @code{ibase},
2080 when an integer is terminated by a decimal point,
2081 it is interpreted in base 10.
2083 See also @mrefdot{obase}
2087 @code{ibase} less than 10 (for example binary numbers).
2092 @c 1111111111111111;
2101 (%i3) 1111111111111111;
2106 @code{ibase} greater than 10.
2107 Letters are interpreted as digits only if the first digit is 0
2108 through 9 which means that hexadecimal numbers might need to
2109 be prepended by a 0.
2135 (%i5) symbolp (abcd);
2143 (%i7) symbolp (0abcd);
2148 When an integer is terminated by a decimal point,
2149 it is interpreted in base 10.
2173 @opencatbox{Categories:}
2174 @category{Console interaction}
2178 @c -----------------------------------------------------------------------------
2180 @deffn {Function} ldisp (@var{expr_1}, @dots{}, @var{expr_n})
2182 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2183 printed output. @code{ldisp} assigns an intermediate expression label to each
2184 argument and returns the list of labels.
2186 See also @mrefcomma{disp} @mrefcomma{display} and @mrefdot{ldisplay}
2194 (%i2) f: expand (e);
2196 (%o2) b + 3 a b + 3 a b + a
2202 (%t4) b + 3 a b + 3 a b + a
2210 (%o5) b + 3 a b + 3 a b + a
2213 @opencatbox{Categories:}
2214 @category{Display functions}
2218 @c -----------------------------------------------------------------------------
2220 @deffn {Function} ldisplay (@var{expr_1}, @dots{}, @var{expr_n})
2222 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2223 printed output. Each expression is printed as an equation of the form
2224 @code{lhs = rhs} in which @code{lhs} is one of the arguments of @code{ldisplay}
2225 and @code{rhs} is its value. Typically each argument is a variable.
2226 @mref{ldisp} assigns an intermediate expression label to each equation and
2227 returns the list of labels.
2229 See also @mrefcomma{display} @mrefcomma{disp} and @mrefdot{ldisp}
2237 (%i2) f: expand (e);
2239 (%o2) b + 3 a b + 3 a b + a
2240 (%i3) ldisplay (e, f);
2245 (%t4) f = b + 3 a b + 3 a b + a
2253 (%o5) f = b + 3 a b + 3 a b + a
2256 @opencatbox{Categories:}
2257 @category{Display functions}
2261 @c -----------------------------------------------------------------------------
2263 @defvr {Option variable} leftjust
2264 Default value: @code{false}
2266 When @code{leftjust} is @code{true}, equations in 2D-display are drawn left
2267 justified rather than centered.
2269 See also @mref{display2d} to switch between 1D- and 2D-display.
2274 (%i1) expand((x+1)^3);
2276 (%o1) x + 3 x + 3 x + 1
2277 (%i2) leftjust:true$
2278 (%i3) expand((x+1)^3);
2280 (%o3) x + 3 x + 3 x + 1
2283 @opencatbox{Categories:}
2284 @category{Display flags and variables}
2288 @c -----------------------------------------------------------------------------
2290 @defvr {Option variable} linel
2291 Default value: @code{79}
2293 @code{linel} is the assumed width (in characters) of the console display for the
2294 purpose of displaying expressions. @code{linel} may be assigned any value by
2295 the user, although very small or very large values may be impractical. Text
2296 printed by built-in Maxima functions, such as error messages and the output of
2297 @mrefcomma{describe} is not affected by @code{linel}.
2299 @opencatbox{Categories:}
2300 @category{Display flags and variables}
2304 @c -----------------------------------------------------------------------------
2307 @defvr {Option variable} lispdisp
2308 Default value: @code{false}
2310 When @code{lispdisp} is @code{true}, Lisp symbols are displayed with a leading
2311 question mark @code{?}. Otherwise, Lisp symbols are displayed with no leading
2312 mark. This has the same effect for 1-d and 2-d display.
2323 (%i1) lispdisp: false$
2328 (%i3) lispdisp: true$
2335 @opencatbox{Categories:}
2336 @category{Display flags and variables}
2340 @c NEEDS CLARIFICATION, EXAMPLES
2342 @c -----------------------------------------------------------------------------
2343 @anchor{negsumdispflag}
2344 @defvr {Option variable} negsumdispflag
2345 Default value: @code{true}
2347 When @code{negsumdispflag} is @code{true}, @code{x - y} displays as @code{x - y}
2348 instead of as @code{- y + x}. Setting it to @code{false} causes the special
2349 check in display for the difference of two expressions to not be done. One
2350 application is that thus @code{a + %i*b} and @code{a - %i*b} may both be
2351 displayed the same way.
2353 @opencatbox{Categories:}
2354 @category{Display flags and variables}
2358 @c -----------------------------------------------------------------------------
2360 @defvr {Option variable} obase
2361 Default value: @code{10}
2363 @code{obase} is the base for integers displayed by Maxima.
2365 @code{obase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2366 When @code{obase} is greater than 10,
2367 the numerals comprise the decimal numerals 0 through 9
2368 plus capital letters of the alphabet A, B, C, @dots{}, as needed.
2369 A leading 0 digit is displayed if the leading digit is otherwise a letter.
2370 The numerals for base 36, the largest acceptable base,
2371 comprise 0 through 9, and A through Z.
2373 See also @mrefdot{ibase}
2422 @opencatbox{Categories:}
2423 @category{Display flags and variables}
2424 @category{Console interaction}
2428 @c -----------------------------------------------------------------------------
2430 @defvr {Option variable} pfeformat
2431 Default value: @code{false}
2433 When @code{pfeformat} is @code{true}, a ratio of integers is displayed with the
2434 solidus (forward slash) character, and an integer denominator @code{n} is
2435 displayed as a leading multiplicative term @code{1/n}.
2440 (%i1) pfeformat: false$
2449 (%i4) pfeformat: true$
2456 @opencatbox{Categories:}
2457 @category{Display flags and variables}
2461 @c -----------------------------------------------------------------------------
2463 @defvr {Option variable} powerdisp
2464 Default value: @code{false}
2466 When @code{powerdisp} is @code{true},
2467 a sum is displayed with its terms in order of increasing power.
2468 Thus a polynomial is displayed as a truncated power series,
2469 with the constant term first and the highest power last.
2471 By default, terms of a sum are displayed in order of decreasing power.
2476 (%i1) powerdisp:true;
2481 (%i3) powerdisp:false;
2488 @opencatbox{Categories:}
2489 @category{Display flags and variables}
2493 @c -----------------------------------------------------------------------------
2495 @deffn {Function} print (@var{expr_1}, @dots{}, @var{expr_n})
2497 Evaluates and displays @var{expr_1}, @dots{}, @var{expr_n} one after another,
2498 from left to right, starting at the left edge of the console display.
2500 The value returned by @code{print} is the value of its last argument.
2501 @code{print} does not generate intermediate expression labels.
2503 See also @mrefcomma{display} @mrefcomma{disp} @mrefcomma{ldisplay} and
2504 @mrefdot{ldisp} Those functions display one expression per line, while
2505 @code{print} attempts to display two or more expressions per line.
2507 To display the contents of a file, see @mrefdot{printfile}
2512 (%i1) r: print ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2513 radcan (log (a^10/b)))$
2515 (a+b)^3 is b + 3 a b + 3 a b + a log (a^10/b) is
2519 (%o2) 10 log(a) - log(b)
2520 (%i3) disp ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2521 radcan (log (a^10/b)))$
2525 b + 3 a b + 3 a b + a
2532 @opencatbox{Categories:}
2533 @category{Display functions}
2537 @c -----------------------------------------------------------------------------
2538 @anchor{sqrtdispflag}
2539 @defvr {Option variable} sqrtdispflag
2540 Default value: @code{true}
2542 When @code{sqrtdispflag} is @code{false}, causes @code{sqrt} to display with
2544 @c AND OTHERWISE ... ??
2546 @opencatbox{Categories:}
2547 @category{Mathematical functions}
2548 @category{Display flags and variables}
2552 @c -----------------------------------------------------------------------------
2554 @defvr {Option variable} stardisp
2555 Default value: @code{false}
2557 When @code{stardisp} is @code{true}, multiplication is
2558 displayed with an asterisk @code{*} between operands.
2560 @opencatbox{Categories:}
2561 @category{Display flags and variables}
2565 @c -----------------------------------------------------------------------------
2567 @defvr {Option variable} ttyoff
2568 Default value: @code{false}
2570 When @code{ttyoff} is @code{true}, output expressions are not displayed.
2571 Output expressions are still computed and assigned labels. See @mrefdot{labels}
2573 Text printed by built-in Maxima functions, such as error messages and the output
2574 of @mrefcomma{describe} is not affected by @code{ttyoff}.
2576 @opencatbox{Categories:}
2577 @category{Display flags and variables}