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} __
23 @vrindex Current input expression
26 @code{__} is the input expression currently being evaluated. That is, while an
27 input expression @var{expr} is being evaluated, @code{__} is @var{expr}.
29 @code{__} is assigned the input expression before the input is simplified or
30 evaluated. However, the value of @code{__} is simplified (but not evaluated)
33 @code{__} is recognized by @mref{batch} and @mrefdot{load} In a file processed
34 by @code{batch}, @code{__} has the same meaning as at the interactive prompt.
35 In a file processed by @code{load}, @code{__} is bound to the input expression
36 most recently entered at the interactive prompt or in a batch file; @code{__}
37 is not bound to the input expressions in the file being processed. In
38 particular, when @code{load (@var{filename})} is called from the interactive
39 prompt, @code{__} is bound to @code{load (@var{filename})} while the file is
42 See also @mref{_} and @mrefdot{%}
47 @c print ("I was called as", __);
49 @c g (x) := (print ("Current input expression =", __), 0);
50 @c [aa : 1, bb : 2, cc : 3];
51 @c (aa + bb + cc)/(dd + ee + g(x));
55 (%i1) print ("I was called as", __);
56 I was called as print(I was called as, __)
57 (%o1) print(I was called as, __)
64 (%i3) g (x) := (print ("Current input expression =", __), 0);
65 (%o3) g(x) := (print("Current input expression =", __), 0)
68 (%i4) [aa : 1, bb : 2, cc : 3];
72 (%i5) (aa + bb + cc)/(dd + ee + g(x));
74 Current input expression = --------------
82 @opencatbox{Categories:}
83 @category{Global variables}
87 @c -----------------------------------------------------------------------------
89 @defvr {System variable} _
91 @vrindex Previous input
94 @code{_} is the most recent input expression (e.g., @code{%i1}, @code{%i2},
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)
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{%}
145 ((%SIN) ((MQUOTIENT) $%PI 2))
175 @opencatbox{Categories:}
176 @category{Console interaction}
177 @category{Global variables}
181 @c -----------------------------------------------------------------------------
183 @defvr {System variable} %
185 @vrindex Previous output
188 @code{%} is the output expression (e.g., @code{%o1}, @code{%o2}, @code{%o3},
189 @dots{}) most recently computed by Maxima, whether or not it was displayed.
191 @code{%} is recognized by @mref{batch} and @mrefdot{load} In a file processed
192 by @code{batch}, @code{%} has the same meaning as at the interactive prompt.
193 In a file processed by @code{load}, @code{%} is bound to the output expression
194 most recently computed at the interactive prompt or in a batch file; @code{%}
195 is not bound to output expressions in the file being processed.
197 See also @mrefcomma{_} @mrefcomma{%%} and @mrefdot{%th}
199 @opencatbox{Categories:}
200 @category{Console interaction}
201 @category{Global variables}
205 @c -----------------------------------------------------------------------------
207 @defvr {System variable} %%
209 @vrindex Previous result in compound expression
212 In compound statements, namely @mrefcomma{block} @mrefcomma{lambda} or
213 @code{(@var{s_1}, ..., @var{s_n})}, @code{%%} is the value of the previous
216 At the first statement in a compound statement, or outside of a compound
217 statement, @code{%%} is undefined.
219 @code{%%} is recognized by @mref{batch} and @mrefcomma{load} and it has the
220 same meaning as at the interactive prompt.
226 The following two examples yield the same result.
229 (%i1) block (integrate (x^5, x), ev (%%, x=2) - ev (%%, x=1));
233 (%i2) block ([prev], prev: integrate (x^5, x),
234 ev (prev, x=2) - ev (prev, x=1));
241 A compound statement may comprise other compound statements. Whether a
242 statement be simple or compound, @code{%%} is the value of the previous
246 (%i3) block (block (a^n, %%*42), %%/6);
251 Within a compound statement, the value of @code{%%} may be inspected at a break
252 prompt, which is opened by executing the @mref{break} function. For example,
253 entering @code{%%;} in the following example yields @code{42}.
256 (%i4) block (a: 42, break ())$
258 Entering a Maxima break point. Type 'exit;' to resume.
264 @opencatbox{Categories:}
265 @category{Global variables}
269 @c -----------------------------------------------------------------------------
271 @deffn {Function} %th (@var{i})
273 @fnindex N'th previous output
276 The value of the @var{i}'th previous output expression. That is, if the next
277 expression to be computed is the @var{n}'th output, @code{%th (@var{m})} is the
278 (@var{n} - @var{m})'th output.
280 @code{%th} is recognized by @mref{batch} and @mrefdot{load} In a file processed
281 by @code{batch}, @code{%th} has the same meaning as at the interactive prompt.
282 In a file processed by @code{load}, @code{%th} refers to output expressions most
283 recently computed at the interactive prompt or in a batch file; @code{%th} does
284 not refer to output expressions in the file being processed.
286 See also @mref{%} and @mrefdot{%%}
290 @code{%th} is useful in @code{batch} files or for referring to a group of
291 output expressions. This example sets @code{s} to the sum of the last five
301 (%i6) block (s: 0, for i:1 thru 5 do s: s + %th(i), s);
305 @opencatbox{Categories:}
306 @category{Console interaction}
310 @c -----------------------------------------------------------------------------
312 @deffn {Special symbol} ?
314 @fnindex Fetch documentation
317 As prefix to a function or variable name, @code{?} signifies that the name is a
318 Lisp name, not a Maxima name. For example, @code{?round} signifies the Lisp
319 function @code{ROUND}. See @ref{Lisp and Maxima} for more on this point.
321 The notation @code{? word} (a question mark followed a word, separated by
322 whitespace) is equivalent to @code{describe("word")}. The question mark must
323 occur at the beginning of an input line; otherwise it is not recognized as a
324 request for documentation. See also @mrefdot{describe}
326 @opencatbox{Categories:}
328 @category{Console interaction}
332 @c -----------------------------------------------------------------------------
334 @deffn {Special symbol} ??
336 @fnindex Fetch documentation (inexact search)
339 The notation @code{?? word} (@code{??} followed a word, separated by whitespace)
340 is equivalent to @code{describe("word", inexact)}. The question mark must occur
341 at the beginning of an input line; otherwise it is not recognized as a request
342 for documentation. See also @mrefdot{describe}
344 @opencatbox{Categories:}
346 @category{Console interaction}
350 @c -----------------------------------------------------------------------------
352 @deffn {Input terminator} $
354 @fnindex Input terminator (without display)
357 The dollar sign @code{$} terminates an input expression,
358 and the most recent output @code{%} and an output label, e.g. @code{%o1},
359 are assigned the result, but the result is not displayed.
382 @c -----------------------------------------------------------------------------
384 @deffn {Input terminator} ;
386 @fnindex Input terminator (with display)
389 The semicolon @code{;} terminates an input expression,
390 and the resulting output is displayed.
406 @c -----------------------------------------------------------------------------
408 @defvr {Option variable} inchar
409 Default value: @code{%i}
411 @code{inchar} is the prefix of the labels of expressions entered by the user.
412 Maxima automatically constructs a label for each input expression by
413 concatenating @code{inchar} and @mrefdot{linenum}
415 @code{inchar} may be assigned any string or symbol, not necessarily a single
416 character. Because Maxima internally takes into account only the first char of
417 the prefix, the prefixes @code{inchar}, @mrefcomma{outchar} and
418 @mref{linechar} should have a different first char. Otherwise some commands
419 like @code{kill(inlabels)} do not work as expected.
421 See also @mrefdot{labels}
431 (%i1) inchar: "input";
435 (input2) expand((a+b)^3);
437 (%o2) b + 3 a b + 3 a b + a
441 @opencatbox{Categories:}
442 @category{Display flags and variables}
446 @c -----------------------------------------------------------------------------
448 @defvr {System variable} infolists
449 Default value: @code{[]}
451 @code{infolists} is a list of the names of all of the information
452 lists in Maxima. These are:
456 All bound @code{%i}, @code{%o}, and @code{%t} labels.
458 All bound atoms which are user variables, not Maxima options or switches,
459 created by @mref{:} or @mref{::} or functional binding.
460 @c WHAT IS INTENDED BY "FUNCTIONAL BINDING" HERE ??
462 All user-defined functions, created by @mref{:=} or @mrefdot{define}
464 All arrays, @mref{hashed arrays} and @mref{memoizing functions}.
466 All user-defined macro functions, created by @mrefdot{::=}
468 All options ever reset by the user (whether or not they
469 are later reset to their default values).
471 All user-defined pattern matching and simplification rules, created
472 by @mrefcomma{tellsimp} @mrefcomma{tellsimpafter} @mrefcomma{defmatch} or
475 All atoms which have a user-defined alias, created by the @mrefcomma{alias}@w{}
476 @mrefcomma{ordergreat} @mref{orderless} functions or by declaring the atom as a
477 @mref{noun} with @mrefdot{declare}
479 All atoms which have functional dependencies, created by the
480 @mref{depends}, @mref{dependencies}, or @mref{gradef} functions.
482 All functions which have user-defined derivatives, created by the
483 @mref{gradef} function.
484 @c UMM, WE REALLY NEED TO BE SPECIFIC -- WHAT DOES "ETC" CONTAIN HERE ??
486 All atoms which have any property other than those mentioned above, such as
487 properties established by @mref{atvalue} or @mref{matchdeclare}, etc.,
488 as well as properties established in the @mref{declare} function.
490 @c Is also documented in Structures.texi. But it definitively is an infolist
491 @c so it has to be documented here, too.
492 All structs defined using @mrefdot{defstruct}
493 @item let_rule_packages
494 All user-defined @mref{let} rule packages
495 plus the special package @mrefdot{default_let_rule_package}
496 (@code{default_let_rule_package} is the name of the rule package used when
497 one is not explicitly set by the user.)
500 @opencatbox{Categories:}
501 @category{Declarations and inferences}
502 @category{Global variables}
506 @c REVIEW FOR ACCURACY AND COMPLETENESS
507 @c THIS ITEM IS VERY IMPORTANT !!
510 @c -----------------------------------------------------------------------------
512 @deffn {Function} kill @
513 @fname{kill} (@var{a_1}, @dots{}, @var{a_n}) @
514 @fname{kill} (labels) @
515 @fname{kill} (inlabels, outlabels, linelabels) @
516 @fname{kill} (@var{n}) @
517 @fname{kill} ([@var{m}, @var{n}]) @
518 @fname{kill} (values, functions, arrays, @dots{}) @
520 @fname{kill} (allbut (@var{a_1}, @dots{}, @var{a_n}))
522 Removes all bindings (value, function, array, or rule) from the arguments
523 @var{a_1}, @dots{}, @var{a_n}. An argument @var{a_k} may be a symbol or a
524 single array element. When @var{a_k} is a single array element, @code{kill}
525 unbinds that element without affecting any other elements of the array.
527 Several special arguments are recognized. Different kinds of arguments
528 may be combined, e.g., @code{kill (inlabels, functions, allbut (foo, bar))}.
530 @code{kill (labels)} unbinds all input, output, and intermediate expression
531 labels created so far. @code{kill (inlabels)} unbinds only input labels which
532 begin with the current value of @mrefdot{inchar} Likewise,
533 @code{kill (outlabels)} unbinds only output labels which begin with the current
534 value of @mrefcomma{outchar} and @code{kill (linelabels)} unbinds only
535 intermediate expression labels which begin with the current value of
538 @code{kill (@var{n})}, where @var{n} is an integer,
539 unbinds the @var{n} most recent input and output labels.
541 @code{kill ([@var{m}, @var{n}])} unbinds input and output labels @var{m} through
544 @code{kill (@var{infolist})}, where @var{infolist} is any item in
545 @code{infolists} (such as @mrefcomma{values} @mrefcomma{functions} or
546 @mref{arrays}) unbinds all items in @var{infolist}.
547 See also @mrefdot{infolists}
549 @code{kill (all)} unbinds all items on all infolists. @code{kill (all)} does
550 not reset global variables to their default values; see @mref{reset} on this
553 @code{kill (allbut (@var{a_1}, ..., @var{a_n}))} unbinds all items on all
554 infolists except for @var{a_1}, @dots{}, @var{a_n}.
555 @code{kill (allbut (@var{infolist}))} unbinds all items except for the ones on
556 @var{infolist}, where @var{infolist} is @mrefcomma{values}@w{}
557 @mrefcomma{functions} @mrefcomma{arrays} etc.
559 The memory taken up by a bound property is not released until all symbols are
560 unbound from it. In particular, to release the memory taken up by the value of
561 a symbol, one unbinds the output label which shows the bound value, as well as
562 unbinding the symbol itself.
564 @code{kill} quotes its arguments. The quote-quote operator @code{'@w{}'}
567 @code{kill (@var{symbol})} unbinds all properties of @var{symbol}. In contrast,
568 the functions @mrefcomma{remvalue} @mrefcomma{remfunction}@w{}
569 @mrefcomma{remarray} and @mref{remrule} unbind a specific property.
570 Note that facts declared by @mref{assume} don't require a symbol they apply to,
571 therefore aren't stored as properties of symbols and therefore aren't affected
574 @code{kill} always returns @code{done}, even if an argument has no binding.
576 @opencatbox{Categories:}
577 @category{Evaluation}
578 @category{Console interaction}
579 @category{Session management}
583 @c -----------------------------------------------------------------------------
585 @deffn {Function} labels (@var{symbol})
587 Returns the list of input, output, or intermediate expression labels which begin
588 with @var{symbol}. Typically @var{symbol} is the value of
589 @mrefcomma{inchar} @mrefcomma{outchar} or @mrefdot{linechar}
590 If no labels begin with @var{symbol}, @code{labels} returns an empty list.
592 By default, Maxima displays the result of each user input expression, giving the
593 result an output label. The output display is suppressed by terminating the
594 input with @code{$} (dollar sign) instead of @code{;} (semicolon). An output
595 label is constructed and bound to the result, but not displayed, and the label
596 may be referenced in the same way as displayed output labels. See also
597 @mrefcomma{%} @mrefcomma{%%} and @mrefdot{%th}
599 Intermediate expression labels can be generated by some functions. The option
600 variable @mref{programmode} controls whether @mref{solve} and some other
601 functions generate intermediate expression labels instead of returning a list of
602 expressions. Some other functions, such as @mrefcomma{ldisplay} always generate
603 intermediate expression labels.
605 See also @mrefcomma{inchar} @mrefcomma{outchar} @mrefcomma{linechar} and
608 @opencatbox{Categories:}
609 @category{Display functions}
610 @category{Console interaction}
614 @defvr {System variable} labels
616 The variable @code{labels} is the list of input, output, and intermediate
617 expression labels, including all previous labels if @code{inchar},
618 @code{outchar}, or @code{linechar} were redefined.
620 @opencatbox{Categories:}
621 @category{Display flags and variables}
622 @category{Console interaction}
626 @c -----------------------------------------------------------------------------
628 @defvr {Option variable} linechar
629 Default value: @code{%t}
631 @code{linechar} is the prefix of the labels of intermediate expressions
632 generated by Maxima. Maxima constructs a label for each intermediate expression
633 (if displayed) by concatenating @code{linechar} and @mrefdot{linenum}
635 @code{linechar} may be assigned any string or symbol, not necessarily a single
636 character. Because Maxima internally takes into account only the first char of
637 the prefix, the prefixes @mrefcomma{inchar} @mrefcomma{outchar} and
638 @code{linechar} should have a different first char. Otherwise some commands
639 like @code{kill(inlabels)} do not work as expected.
641 Intermediate expressions might or might not be displayed.
642 See @mref{programmode} and @mrefdot{labels}
644 @opencatbox{Categories:}
645 @category{Display flags and variables}
649 @c EXPAND; SHOW WHAT HAPPENS WHEN linenum IS ASSIGNED A VALUE
651 @c -----------------------------------------------------------------------------
653 @defvr {System variable} linenum
655 The line number of the current pair of input and output expressions.
657 @opencatbox{Categories:}
658 @category{Display flags and variables}
659 @category{Console interaction}
665 @c -----------------------------------------------------------------------------
667 @defvr {System variable} myoptions
668 Default value: @code{[]}
670 @code{myoptions} is the list of all options ever reset by the user,
671 whether or not they get reset to their default value.
673 @opencatbox{Categories:}
674 @category{Global variables}
675 @category{Session management}
676 @category{Console interaction}
680 @c -----------------------------------------------------------------------------
682 @defvr {Option variable} nolabels
683 Default value: @code{false}
685 When @code{nolabels} is @code{true}, input and output result labels (@code{%i}
686 and @code{%o}, respectively) are displayed, but the labels are not bound to
687 results, and the labels are not appended to the @mref{labels} list. Since
688 labels are not bound to results, garbage collection can recover the memory taken
691 Otherwise input and output result labels are bound to results, and the labels
692 are appended to the @code{labels} list.
694 Intermediate expression labels (@code{%t}) are not affected by @code{nolabels};
695 whether @code{nolabels} is @code{true} or @code{false}, intermediate expression
696 labels are bound and appended to the @code{labels} list.
698 See also @mrefcomma{batch} @mrefcomma{load} and @mrefdot{labels}
700 @opencatbox{Categories:}
701 @category{Global flags}
702 @category{Session management}
708 @c -----------------------------------------------------------------------------
710 @defvr {Option variable} optionset
711 Default value: @code{false}
713 When @code{optionset} is @code{true}, Maxima prints out a message whenever a
714 Maxima option is reset. This is useful if the user is doubtful of the spelling
715 of some option and wants to make sure that the variable he assigned a value to
716 was truly an option variable.
721 (%i1) optionset:true;
722 assignment: assigning to option optionset
724 (%i2) gamma_expand:true;
725 assignment: assigning to option gamma_expand
729 @opencatbox{Categories:}
730 @category{Global flags}
731 @category{Session management}
732 @category{Console interaction}
736 @c -----------------------------------------------------------------------------
739 @defvr {Option variable} outchar
740 Default value: @code{%o}
742 @code{outchar} is the prefix of the labels of expressions computed by Maxima.
743 Maxima automatically constructs a label for each computed expression by
744 concatenating @code{outchar} and @mrefdot{linenum}
746 @code{outchar} may be assigned any string or symbol, not necessarily a single
747 character. Because Maxima internally takes into account only the first char of
748 the prefix, the prefixes @mrefcomma{inchar} @code{outchar} and
749 @mref{linechar} should have a different first char. Otherwise some commands
750 like @code{kill(inlabels)} do not work as expected.
752 See also @mref{labels}.
757 @c outchar: "output";
762 (%i1) outchar: "output";
766 (%i2) expand((a+b)^3);
768 (output2) b + 3 a b + 3 a b + a
772 @opencatbox{Categories:}
773 @category{Display flags and variables}
777 @c -----------------------------------------------------------------------------
779 @deffn {Function} playback @
780 @fname{playback} () @
781 @fname{playback} (@var{n}) @
782 @fname{playback} ([@var{m}, @var{n}]) @
783 @fname{playback} ([@var{m}]) @
784 @fname{playback} (input) @
785 @fname{playback} (slow) @
786 @fname{playback} (time) @
787 @fname{playback} (grind)
789 Displays input, output, and intermediate expressions, without recomputing them.
790 @code{playback} only displays the expressions bound to labels; any other output
791 (such as text printed by @mref{print} or @mrefcomma{describe} or error messages)
792 is not displayed. See also @mrefdot{labels}
794 @code{playback} quotes its arguments. The quote-quote operator @code{'@w{}'}
795 defeats quotation. @code{playback} always returns @code{done}.
797 @code{playback ()} (with no arguments) displays all input, output, and
798 intermediate expressions generated so far. An output expression is displayed
799 even if it was suppressed by the @code{$} terminator when it was originally
802 @code{playback (@var{n})} displays the most recent @var{n} expressions.
803 Each input, output, and intermediate expression counts as one.
805 @code{playback ([@var{m}, @var{n}])} displays input, output, and intermediate
806 expressions with numbers from @var{m} through @var{n}, inclusive.
808 @code{playback ([@var{m}])} is equivalent to
809 @code{playback ([@var{m}, @var{m}])}; this usually prints one pair of input and
812 @code{playback (input)} displays all input expressions generated so far.
814 @code{playback (slow)} pauses between expressions and waits for the user to
815 press @code{enter}. This behavior is similar to @mrefdot{demo}
816 @c WHAT DOES THE FOLLOWING MEAN ???
817 @code{playback (slow)} is useful in conjunction with @code{save} or
818 @mref{stringout} when creating a secondary-storage file in order to pick out
821 @code{playback (time)} displays the computation time for each expression.
822 @c DON'T BOTHER TO MENTION OBSOLETE OPTIONS !!!
823 @c The arguments @code{gctime} and @code{totaltime} have the same effect as @code{time}.
825 @code{playback (grind)} displays input expressions in the same format as the
826 @code{grind} function. Output expressions are not affected by the @code{grind}
827 option. See @mrefdot{grind}
829 Arguments may be combined, e.g., @code{playback ([5, 10], grind, time, slow)}.
830 @c APPEARS TO BE input INTERSECT (UNION OF ALL OTHER ARGUMENTS). CORRECT ???
832 @opencatbox{Categories:}
833 @category{Display functions}
834 @category{Console interaction}
838 @c -----------------------------------------------------------------------------
841 @defvr {Option variable} prompt
842 Default value: @code{_}
844 @code{prompt} is the prompt symbol of the @mref{demo} function,
845 @code{playback (slow)} mode, and the Maxima break loop (as invoked by
848 @opencatbox{Categories:}
849 @category{Global variables}
850 @category{Console interaction}
854 @c -----------------------------------------------------------------------------
856 @deffn {Function} quit ()
858 Terminates the Maxima session. Note that the function must be invoked as
859 @code{quit();} or @code{quit()$}, not @code{quit} by itself.
861 To stop a lengthy computation, type @code{control-C}. The default action is to
862 return to the Maxima prompt. If @code{*debugger-hook*} is @code{nil},
863 @code{control-C} opens the Lisp debugger. See also @ref{Debugging}.
865 @opencatbox{Categories:}
866 @category{Console interaction}
870 @c -----------------------------------------------------------------------------
872 @deffn {Function} read (@var{expr_1}, @dots{}, @var{expr_n})
874 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
875 console and returns the evaluated expression. The expression is terminated with
876 a semicolon @code{;} or dollar sign @code{$}.
878 See also @mref{readonly}
884 (%i2) foo: read ("foo is", foo, " -- enter new value.")$
885 foo is 42 -- enter new value.
892 @opencatbox{Categories:}
893 @category{Console interaction}
897 @c -----------------------------------------------------------------------------
899 @deffn {Function} readonly (@var{expr_1}, @dots{}, @var{expr_n})
901 Prints @var{expr_1}, @dots{}, @var{expr_n}, then reads one expression from the
902 console and returns the expression (without evaluation). The expression is
903 terminated with a @code{;} (semicolon) or @code{$} (dollar sign).
905 See also @mrefdot{read}
911 (%i2) foo: readonly ("Enter an expression:");
916 (%i3) foo: read ("Enter an expression:");
922 @opencatbox{Categories:}
923 @category{Console interaction}
927 @c -----------------------------------------------------------------------------
929 @deffn {Function} reset ()
931 Resets many global variables and options, and some other variables, to their
934 @code{reset} processes the variables on the Lisp list
935 @code{*variable-initial-values*}. The Lisp macro @code{defmvar} puts variables
936 on this list (among other actions). Many, but not all, global variables and
937 options are defined by @code{defmvar}, and some variables defined by
938 @code{defmvar} are not global variables or options.
940 @opencatbox{Categories:}
941 @category{Session management}
945 @c -----------------------------------------------------------------------------
947 @defvr {Option variable} showtime
948 Default value: @code{false}
950 When @code{showtime} is @code{true}, the computation time and elapsed time is
951 printed with each output expression.
953 The computation time is always recorded, so @mref{time} and @mref{playback} can
954 display the computation time even when @code{showtime} is @code{false}.
956 See also @mrefdot{timer}
958 @opencatbox{Categories:}
959 @category{Display flags and variables}
964 @c -----------------------------------------------------------------------------
966 @deffn {Function} to_lisp ()
968 Enters the Lisp system under Maxima. @code{(to-maxima)} returns to Maxima.
972 Define a function and enter the Lisp system under Maxima. The definition is
973 inspected on the property list, then the function definition is extracted,
974 factored and stored in the variable @code{$result}. The variable can be used in Maxima
975 after returning to Maxima.
982 Type (to-maxima) to restart, ($quit) to quit Maxima.
983 MAXIMA> (symbol-plist '$f)
984 (MPROPS (NIL MEXPR ((LAMBDA) ((MLIST) $X)
985 ((MPLUS) ((MEXPT) $X 2) $X))))
986 MAXIMA> (setq $result ($factor (caddr (mget '$f 'mexpr))))
987 ((MTIMES SIMP FACTORED) $X ((MPLUS SIMP IRREDUCIBLE) 1 $X))
995 @opencatbox{Categories:}
996 @category{Console interaction}
1000 @c -----------------------------------------------------------------------------
1001 @anchor{eval_string_lisp}
1002 @deffn {Function} eval_string_lisp (@var{str})
1004 Sequentially read lisp forms from the string @var{str} and evaluate them.
1005 Any values produced from the last form are returned as a Maxima list.
1010 @c eval_string_lisp ("");
1011 @c eval_string_lisp ("(values)");
1012 @c eval_string_lisp ("69");
1013 @c eval_string_lisp ("1 2 3");
1014 @c eval_string_lisp ("(values 1 2 3)");
1015 @c eval_string_lisp ("(defun $foo (x) (* 2 x))");
1020 (%i1) eval_string_lisp ("");
1024 (%i2) eval_string_lisp ("(values)");
1028 (%i3) eval_string_lisp ("69");
1032 (%i4) eval_string_lisp ("1 2 3");
1036 (%i5) eval_string_lisp ("(values 1 2 3)");
1040 (%i6) eval_string_lisp ("(defun $foo (x) (* 2 x))");
1049 See also @ref{eval_string}.
1051 @opencatbox{Categories:}
1052 @category{Debugging}
1053 @category{Evaluation}
1058 @c -----------------------------------------------------------------------------
1060 @defvr {System variable} values
1061 Initial value: @code{[]}
1063 @code{values} is a list of all bound user variables (not Maxima options or
1064 switches). The list comprises symbols bound by @mrefcomma{:} or @mrefdot{::}
1066 If the value of a variable is removed with the commands @code{kill},
1067 @mrefcomma{remove} or @mref{remvalue} the variable is deleted from
1070 See @mref{functions} for a list of user defined functions.
1074 First, @code{values} shows the symbols @code{a}, @code{b}, and @code{c}, but
1075 not @code{d}, it is not bound to a value, and not the user function @code{f}.
1076 The values are removed from the variables. @code{values} is the empty list.
1079 @c [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1081 @c [kill(a), remove(b,value), remvalue(c)];
1086 (%i1) [a:99, b:: a-90, c:a-b, d, f(x):=x^2];
1088 (%o1) [99, 9, 90, d, f(x) := x ]
1095 (%i3) [kill(a), remove(b,value), remvalue(c)];
1096 (%o3) [done, done, [c]]
1104 @opencatbox{Categories:}
1105 @category{Evaluation}
1106 @category{Global variables}
1110 @c -----------------------------------------------------------------------------
1111 @node Functions and Variables for Display, , Functions and Variables for Command Line, Command Line
1112 @section Functions and Variables for Display
1113 @c -----------------------------------------------------------------------------
1115 @c -----------------------------------------------------------------------------
1117 @defvr {Option variable} %edispflag
1118 Default value: @code{false}
1120 When @code{%edispflag} is @code{true}, Maxima displays @code{%e} to a negative
1121 exponent as a quotient. For example, @code{%e^-x} is displayed as
1122 @code{1/%e^x}. See also @mrefdot{exptdispflag}
1137 (%i2) %edispflag:true$
1147 @opencatbox{Categories:}
1148 @category{Exponential and logarithm functions}
1149 @category{Display flags and variables}
1153 @c -----------------------------------------------------------------------------
1155 @defvr {Option variable} absboxchar
1156 Default value: @code{!}
1158 @code{absboxchar} is the character used to draw absolute value
1159 signs around expressions which are more than one line tall.
1169 @opencatbox{Categories:}
1170 @category{Display flags and variables}
1174 @c AFTER REVIEWING src/displa.lisp, IT LOOKS LIKE THIS VARIABLE HAS NO EFFECT
1175 @c CUT IT ON THE NEXT PASS
1176 @c @defvar cursordisp
1177 @c Default value: @code{true}
1179 @c When @code{cursordisp} is @code{true}, expressions are drawn by
1180 @c the displayer in logical sequence. This only works with a console
1181 @c which can do cursor movement. If @code{false}, expressions are
1182 @c printed line by line.
1184 @c @code{cursordisp} is always @code{false} when a @code{writefile} is in
1189 @c -----------------------------------------------------------------------------
1190 @anchor{declare_index_properties}
1191 @deffn {Function} declare_index_properties (@var{a}, [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1192 @deffnx {Function} declare_index_properties ([@var{a}, @var{b}, @var{c}, ...], [@var{p_1}, @var{p_2}, @var{p_3}, ...])
1193 @deffnx {Symbol} postsubscript
1194 @deffnx {Symbol} postsuperscript
1195 @deffnx {Symbol} presuperscript
1196 @deffnx {Symbol} presubscript
1198 Declares the properties of indices applied to the symbol @var{a}
1199 or each of the of symbols @var{a}, @var{b}, @var{c}, ....
1200 If multiple symbols are given,
1201 the whole list of properties applies to each symbol.
1203 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1204 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1205 There may be any number of index properties, in any order.
1207 Each property @var{p_k} must one of these four recognized properties:
1208 @code{postsubscript}, @code{postsuperscript}, @code{presuperscript}, or @code{presubscript},
1209 to denote indices which are displayed, respectively,
1210 to the right and below, to the right and above, to the left and above, or to the left and below.
1212 Index properties apply only to the 2-dimensional display of indexed variables
1213 (i.e., when @mref{display2d} is @code{true})
1214 and TeX output via @code{tex}.
1215 Otherwise, index properties are ignored.
1216 Index properties do not change the input of indexed variables,
1217 do not change the algebraic properties of indexed variables,
1218 and do not change the 1-dimensional display of indexed variables.
1220 @code{declare_index_properties} quotes (does not evaluate) its arguments.
1222 @code{remove_index_properties} removes index properties.
1223 @code{kill} also removes index properties (and all other properties).
1225 @code{get_index_properties} retrieves index properties.
1229 Given a symbol with indices, @code{@var{a}[@var{i_1}, @var{i_2}, @var{i_3}, ...]},
1230 the @code{k}-th property @var{p_k} applies to the @code{k}-th index @var{i_k}.
1231 There may be any number of index properties, in any order.
1234 @c declare_index_properties (A, [presubscript, postsubscript]);
1235 @c declare_index_properties (B, [postsuperscript, postsuperscript,
1236 @c presuperscript]);
1237 @c declare_index_properties (C, [postsuperscript, presubscript,
1238 @c presubscript, presuperscript]);
1245 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1249 (%i2) declare_index_properties (B, [postsuperscript, postsuperscript,
1254 (%i3) declare_index_properties (C, [postsuperscript, presubscript,
1255 presubscript, presuperscript]);
1269 (%i6) C[w, x, y, z];
1276 Index properties apply only to the 2-dimensional display of indexed variables and TeX output.
1277 Otherwise, index properties are ignored.
1280 @c declare_index_properties (A, [presubscript, postsubscript]);
1283 @c display2d: false $
1285 @c display2d: true $
1287 @c stringdisp: true $
1288 @c string (A[w, x]);
1292 (%i1) declare_index_properties (A, [presubscript, postsubscript]);
1301 (%i3) tex (A[w, x]);
1302 $$@{@}_@{w@}A_@{x@}$$
1305 (%i4) display2d: false $
1310 (%i6) display2d: true $
1312 (%i7) grind (A[w, x]);
1316 (%i8) stringdisp: true $
1318 (%i9) string (A[w, x]);
1323 @opencatbox{Categories:}
1324 @category{Display flags and variables}
1328 @c -----------------------------------------------------------------------------
1329 @anchor{get_index_properties}
1330 @deffn {Function} get_index_properties (@var{a})
1332 Returns the properties for @var{a} established by @code{declare_index_properties}.
1334 See also @mrefdot{remove_index_properties}
1336 @opencatbox{Categories:}
1337 @category{Display flags and variables}
1341 @c -----------------------------------------------------------------------------
1342 @anchor{remove_index_properties}
1343 @deffn {Function} remove_index_properties (@var{a}, @var{b}, @var{c}, ...)
1345 Removes the properties established by @code{declare_index_properties}.
1346 All index properties are removed from each symbol @var{a}, @var{b}, @var{c}, ....
1348 @code{remove_index_properties} quotes (does not evaluate) its arguments.
1350 @opencatbox{Categories:}
1351 @category{Display flags and variables}
1355 @c -----------------------------------------------------------------------------
1356 @anchor{display_index_separator}
1357 @defvr {Symbol property} display_index_separator
1359 When a symbol @var{A} has index display properties declared via @code{declare_index_properties},
1360 the value of the property @code{display_index_separator}
1361 is the string or other expression which is displayed between indices.
1363 The value of @code{display_index_separator}
1364 is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1365 where @var{S} is a string or other expression.
1366 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1368 The display index separator @var{S} can be a string, including an empty string,
1369 or @code{false}, indicating the default separator, or any expression.
1370 If not a string and not @code{false}, the property value is coerced to a string via @code{string}.
1372 If no display index separator is assigned, the default separator is used.
1373 The default separator is a comma.
1374 There is no way to change the default separator.
1376 Each symbol has its own value of @code{display_index_separator}.
1378 See also @mref{put}, @mref{get}, and @mrefdot{declare_index_properties}
1382 When a symbol @var{A} has index display properties,
1383 the value of the property @code{display_index_separator}
1384 is the string or other expression which is displayed between indices.
1385 The value is assigned by @code{put(@var{A}, @var{S}, display_index_separator)},
1388 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1389 @c presubscript, presubscript]);
1390 @c put (A, ";", display_index_separator);
1395 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1396 presubscript, presubscript]);
1400 (%i2) put (A, ";", display_index_separator);
1404 (%i3) A[w, x, y, z];
1411 The assigned value is retrieved by @code{get(@var{A}, display_index_separator)}.
1414 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1415 @c presubscript, presubscript]);
1416 @c put (A, ";", display_index_separator);
1417 @c get (A, display_index_separator);
1421 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1422 presubscript, presubscript]);
1426 (%i2) put (A, ";", display_index_separator);
1430 (%i3) get (A, display_index_separator);
1435 The display index separator @var{S} can be a string, including an empty string,
1436 or @code{false}, indicating the default separator, or any expression.
1439 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1440 @c presubscript, presubscript]);
1442 @c put (A, "-", display_index_separator);
1444 @c put (A, " ", display_index_separator);
1446 @c put (A, "", display_index_separator);
1448 @c put (A, false, display_index_separator);
1450 @c put (A, 'foo, display_index_separator);
1455 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1456 presubscript, presubscript]);
1460 (%i2) A[w, x, y, z];
1466 (%i3) put (A, "-", display_index_separator);
1470 (%i4) A[w, x, y, z];
1476 (%i5) put (A, " ", display_index_separator);
1480 (%i6) A[w, x, y, z];
1486 (%i7) put (A, "", display_index_separator);
1490 (%i8) A[w, x, y, z];
1496 (%i9) put (A, false, display_index_separator);
1500 (%i10) A[w, x, y, z];
1506 (%i11) put (A, 'foo, display_index_separator);
1510 (%i12) A[w, x, y, z];
1517 If no display index separator is assigned, the default separator is used.
1518 The default separator is a comma.
1521 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1522 @c presubscript, presubscript]);
1527 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1528 presubscript, presubscript]);
1532 (%i2) A[w, x, y, z];
1539 Each symbol has its own value of @code{display_index_separator}.
1542 @c declare_index_properties (A, [postsuperscript, postsuperscript,
1543 @c presubscript, presubscript]);
1544 @c put (A, " ", display_index_separator);
1545 @c declare_index_properties (B, [presuperscript, presuperscript,
1546 @c postsubscript, postsubscript]);
1547 @c put (B, ";", display_index_separator);
1548 @c A[w, x, y, z] + B[w, x, y, z];
1552 (%i1) declare_index_properties (A, [postsuperscript, postsuperscript,
1553 presubscript, presubscript]);
1557 (%i2) put (A, " ", display_index_separator);
1561 (%i3) declare_index_properties (B, [postsuperscript, postsuperscript, presubscript, presubscript]);
1565 (%i4) put (B, ";", display_index_separator);
1569 (%i5) A[w, x, y, z] + B[w, x, y, z];
1576 @opencatbox{Categories:}
1577 @category{Display flags and variables}
1581 @c -----------------------------------------------------------------------------
1583 @deffn {Function} disp (@var{expr_1}, @var{expr_2}, @dots{})
1585 is like @mref{display} but only the value of the arguments are displayed rather
1586 than equations. This is useful for complicated arguments which don't have names
1587 or where only the value of the argument is of interest and not the name.
1589 See also @mref{ldisp} and @mrefdot{print}
1596 @c disp(x, b[1,2], sin(1.0));
1602 (%i3) disp(x, b[1,2], sin(1.0));
1614 @opencatbox{Categories:}
1615 @category{Display functions}
1619 @c -----------------------------------------------------------------------------
1621 @deffn {Function} display (@var{expr_1}, @var{expr_2}, @dots{})
1623 Displays equations whose left side is @var{expr_i} unevaluated, and whose right
1624 side is the value of the expression centered on the line. This function is
1625 useful in blocks and @mref{for} statements in order to have intermediate results
1626 displayed. The arguments to @code{display} are usually atoms, subscripted
1627 variables, or function calls.
1629 See also @mrefcomma{ldisplay} @mrefcomma{disp} and @mrefdot{ldisp}
1636 @c display(x, b[1,2], sin(1.0));
1642 (%i3) display(x, b[1,2], sin(1.0));
1649 sin(1.0) = 0.8414709848078965
1655 @opencatbox{Categories:}
1656 @category{Display functions}
1660 @c -----------------------------------------------------------------------------
1662 @defvr {Option variable} display2d
1663 Default value: @code{true}
1665 When @code{display2d} is @code{true},
1666 the console display is an attempt to present mathematical expressions
1667 as they might appear in books and articles,
1668 using only letters, numbers, and some punctuation characters.
1669 This display is sometimes called the "pretty printer" display.
1671 When @code{display2d} is @code{true},
1672 Maxima attempts to honor the global variable for line length, @code{linel}.
1673 When an atom (symbol, number, or string) would otherwise cause a line to exceed @code{linel},
1674 the atom may be printed in pieces on successive lines,
1675 with a continuation character (backslash, @code{\}) at the end of the leading piece;
1676 however, in some cases, such atoms are printed without a line break,
1677 and the length of the line is greater than @code{linel}.
1679 When @code{display2d} is @code{false},
1680 the console display is a 1-dimensional or linear form
1681 which is the same as the output produced by @code{grind}.
1683 When @code{display2d} is @code{false},
1684 the value of @mref{stringdisp} is ignored,
1685 and strings are always displayed with quote marks.
1687 When @code{display2d} is @code{false},
1688 Maxima attempts to honor @code{linel},
1689 but atoms are not broken across lines,
1690 and the actual length of an output line may exceed @code{linel}.
1692 See also @mref{leftjust} to switch between a left justified and a centered
1693 display of equations.
1710 (%i2) display2d:false$
1717 @opencatbox{Categories:}
1718 @category{Display flags and variables}
1722 @c -----------------------------------------------------------------------------
1723 @anchor{display_format_internal}
1724 @defvr {Option variable} display_format_internal
1725 Default value: @code{false}
1727 When @code{display_format_internal} is @code{true}, expressions are displayed
1728 without being transformed in ways that hide the internal mathematical
1729 representation. The display then corresponds to what @mref{inpart} returns
1730 rather than @mrefdot{part}
1736 a-b; a - b a + (- 1) b
1749 @opencatbox{Categories:}
1750 @category{Display flags and variables}
1754 @c -----------------------------------------------------------------------------
1755 @anchor{with_default_2d_display}
1756 @deffn {Function} with_default_2d_display (expr)
1758 While maxima by default realizes 2d Output using ASCII-Art some frontend
1759 change that to TeX, MathML or a specific XML dialect that better suits
1760 the needs for this specific frontend. @code{with_default_2d_display}
1761 temporarily switches maxima to the default 2D ASCII Art formatter for
1762 outputting the result of @code{expr}.
1764 See also @mref{set_alt_display} and @mrefdot{display2d}
1766 @opencatbox{Categories:}
1767 @category{Display functions}
1771 @c IS THIS FUNCTION STILL USEFUL ???
1772 @c REPHRASE, NEEDS EXAMPLES
1774 @c -----------------------------------------------------------------------------
1776 @deffn {Function} dispterms (@var{expr})
1778 Displays @var{expr} in parts one below the other. That is, first the operator
1779 of @var{expr} is displayed, then each term in a sum, or factor in a product, or
1780 part of a more general expression is displayed separately. This is useful if
1781 @var{expr} is too large to be otherwise displayed. For example if @code{P1},
1782 @code{P2}, @dots{} are very large expressions then the display program may run
1783 out of storage space in trying to display @code{P1 + P2 + ...} all at once.
1784 However, @code{dispterms (P1 + P2 + ...)} displays @code{P1}, then below it
1785 @code{P2}, etc. When not using @code{dispterms}, if an exponential expression
1786 is too wide to be displayed as @code{A^B} it appears as @code{expt (A, B)} (or
1787 as @code{ncexpt (A, B)} in the case of @code{A^^B}).
1792 (%i1) dispterms(2*a*sin(x)+%e^x);
1804 @opencatbox{Categories:}
1805 @category{Display functions}
1809 @c -----------------------------------------------------------------------------
1812 @deffn {Special symbol} expt (@var{a}, @var{b})
1813 @deffnx {Special symbol} ncexpt (@var{a}, @var{b})
1815 If an exponential expression is too wide to be displayed as
1816 @code{@var{a}^@var{b}} it appears as @code{expt (@var{a}, @var{b})} (or as
1817 @code{ncexpt (@var{a}, @var{b})} in the case of @code{@var{a}^^@var{b}}).
1819 @c THIS SEEMS LIKE A BUG TO ME. expt, ncexpt SHOULD BE RECOGNIZED SINCE MAXIMA
1820 @c ITSELF PRINTS THEM SOMETIMES. THESE SHOULD JUST SIMPLIFY TO ^ AND ^^,
1822 @code{expt} and @code{ncexpt} are not recognized in input.
1825 @c -----------------------------------------------------------------------------
1826 @anchor{exptdispflag}
1827 @defvr {Option variable} exptdispflag
1828 Default value: @code{true}
1830 When @code{exptdispflag} is @code{true}, Maxima displays expressions
1831 with negative exponents using quotients. See also @mrefdot{%edispflag}
1836 (%i1) exptdispflag:true;
1843 (%i3) exptdispflag:false;
1850 @opencatbox{Categories:}
1851 @category{Expressions}
1852 @category{Display flags and variables}
1856 @c -----------------------------------------------------------------------------
1858 @deffn {Function} grind (@var{expr})
1860 The function @code{grind} prints @var{expr} to the console in a form suitable
1861 for input to Maxima. @code{grind} always returns @code{done}.
1863 When @var{expr} is the name of a function or macro, @code{grind} prints the
1864 function or macro definition instead of just the name.
1866 See also @mrefcomma{string} which returns a string instead of printing its
1867 output. @code{grind} attempts to print the expression in a manner which makes
1868 it slightly easier to read than the output of @code{string}.
1870 @code{grind} evaluates its argument.
1877 @c [aa, 1729, aa + 1729];
1879 @c matrix ([aa, 17], [29, bb]);
1881 @c set (aa, 17, 29, bb);
1883 @c exp (aa / (bb + 17)^29);
1885 @c expr: expand ((aa + bb)^10);
1888 @c cholesky (A):= block ([n : length (A), L : copymatrix (A),
1889 @c p : makelist (0, i, 1, length (A))],
1890 @c for i thru n do for j : i thru n do
1891 @c (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
1892 @c if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
1893 @c for i thru n do L[i, i] : 1 / p[i],
1894 @c for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
1895 @c grind (cholesky);
1896 @c string (fundef (cholesky));
1909 (%i3) [aa, 1729, aa + 1729];
1910 (%o3) [aa, 1729, aa + 1729]
1918 (%i5) matrix ([aa, 17], [29, bb]);
1925 matrix([aa,17],[29,bb])$
1929 (%i7) set (aa, 17, 29, bb);
1930 (%o7) @{17, 29, aa, bb@}
1938 (%i9) exp (aa / (bb + 17)^29);
1951 (%i11) expr: expand ((aa + bb)^10);
1953 (%o11) bb + 10 aa bb + 45 aa bb + 120 aa bb + 210 aa bb
1955 + 252 aa bb + 210 aa bb + 120 aa bb + 45 aa bb
1960 (%i12) grind (expr);
1961 bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6
1962 +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2
1967 (%i13) string (expr);
1968 (%o13) bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6\
1969 +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2+10*aa^9*\
1973 (%i14) cholesky (A):= block ([n : length (A), L : copymatrix (A),
1974 p : makelist (0, i, 1, length (A))],
1975 for i thru n do for j : i thru n do
1976 (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
1977 if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
1978 for i thru n do L[i, i] : 1 / p[i],
1979 for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
1980 define: warning: redefining the built-in function cholesky
1983 (%i15) grind (cholesky);
1985 [n:length(A),L:copymatrix(A),
1986 p:makelist(0,i,1,length(A))],
1988 (for j from i thru n do
1989 (x:L[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),
1990 if i = j then p[i]:1/sqrt(x)
1991 else L[j,i]:x*p[i])),
1992 for i thru n do L[i,i]:1/p[i],
1993 for i thru n do (for j from i+1 thru n do L[i,j]:0),L)$
1997 (%i16) string (fundef (cholesky));
1998 (%o16) cholesky(A):=block([n:length(A),L:copymatrix(A),p:makelis\
1999 t(0,i,1,length(A))],for i thru n do (for j from i thru n do (x:L\
2000 [i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),if i = j then p[i]:1/sqrt(x\
2001 ) else L[j,i]:x*p[i])),for i thru n do L[i,i]:1/p[i],for i thru \
2002 n do (for j from i+1 thru n do L[i,j]:0),L)
2006 @opencatbox{Categories:}
2007 @category{Display functions}
2011 @defvr {Option variable} grind
2013 When the variable @code{grind} is @code{true}, the output of @code{string} and
2014 @mref{stringout} has the same format as that of @code{grind}; otherwise no
2015 attempt is made to specially format the output of those functions. The default
2016 value of the variable @code{grind} is @code{false}.
2018 @code{grind} can also be specified as an argument of @mrefdot{playback} When
2019 @code{grind} is present, @code{playback} prints input expressions in the same
2020 format as the @code{grind} function. Otherwise, no attempt is made to specially
2021 format input expressions.
2023 @opencatbox{Categories:}
2024 @category{Display flags and variables}
2028 @c -----------------------------------------------------------------------------
2030 @defvr {Option variable} ibase
2031 Default value: @code{10}
2033 @code{ibase} is the base for integers read by Maxima.
2035 @code{ibase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2036 When @code{ibase} is greater than 10,
2037 the numerals comprise the decimal numerals 0 through 9
2038 plus letters of the alphabet @code{A}, @code{B}, @code{C}, @dots{},
2039 as needed to make @code{ibase} digits in all.
2040 Letters are interpreted as digits only if the first digit is 0 through 9.
2042 Uppercase and lowercase letters are not distinguished.
2043 The numerals for base 36, the largest acceptable base,
2044 comprise 0 through 9 and @code{A} through @code{Z}.
2046 Whatever the value of @code{ibase},
2047 when an integer is terminated by a decimal point,
2048 it is interpreted in base 10.
2050 See also @mrefdot{obase}
2054 @code{ibase} less than 10 (for example binary numbers).
2059 @c 1111111111111111;
2068 (%i3) 1111111111111111;
2073 @code{ibase} greater than 10.
2074 Letters are interpreted as digits only if the first digit is 0
2075 through 9 which means that hexadecimal numbers might need to
2076 be prepended by a 0.
2102 (%i5) symbolp (abcd);
2110 (%i7) symbolp (0abcd);
2115 When an integer is terminated by a decimal point,
2116 it is interpreted in base 10.
2140 @opencatbox{Categories:}
2141 @category{Console interaction}
2145 @c -----------------------------------------------------------------------------
2147 @deffn {Function} ldisp (@var{expr_1}, @dots{}, @var{expr_n})
2149 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2150 printed output. @code{ldisp} assigns an intermediate expression label to each
2151 argument and returns the list of labels.
2153 See also @mrefcomma{disp} @mrefcomma{display} and @mrefdot{ldisplay}
2161 (%i2) f: expand (e);
2163 (%o2) b + 3 a b + 3 a b + a
2169 (%t4) b + 3 a b + 3 a b + a
2177 (%o5) b + 3 a b + 3 a b + a
2180 @opencatbox{Categories:}
2181 @category{Display functions}
2185 @c -----------------------------------------------------------------------------
2187 @deffn {Function} ldisplay (@var{expr_1}, @dots{}, @var{expr_n})
2189 Displays expressions @var{expr_1}, @dots{}, @var{expr_n} to the console as
2190 printed output. Each expression is printed as an equation of the form
2191 @code{lhs = rhs} in which @code{lhs} is one of the arguments of @code{ldisplay}
2192 and @code{rhs} is its value. Typically each argument is a variable.
2193 @mref{ldisp} assigns an intermediate expression label to each equation and
2194 returns the list of labels.
2196 See also @mrefcomma{display} @mrefcomma{disp} and @mrefdot{ldisp}
2204 (%i2) f: expand (e);
2206 (%o2) b + 3 a b + 3 a b + a
2207 (%i3) ldisplay (e, f);
2212 (%t4) f = b + 3 a b + 3 a b + a
2220 (%o5) f = b + 3 a b + 3 a b + a
2223 @opencatbox{Categories:}
2224 @category{Display functions}
2228 @c -----------------------------------------------------------------------------
2230 @defvr {Option variable} leftjust
2231 Default value: @code{false}
2233 When @code{leftjust} is @code{true}, equations in 2D-display are drawn left
2234 justified rather than centered.
2236 See also @mref{display2d} to switch between 1D- and 2D-display.
2241 (%i1) expand((x+1)^3);
2243 (%o1) x + 3 x + 3 x + 1
2244 (%i2) leftjust:true$
2245 (%i3) expand((x+1)^3);
2247 (%o3) x + 3 x + 3 x + 1
2250 @opencatbox{Categories:}
2251 @category{Display flags and variables}
2255 @c -----------------------------------------------------------------------------
2257 @defvr {Option variable} linel
2258 Default value: @code{79}
2260 @code{linel} is the assumed width (in characters) of the console display for the
2261 purpose of displaying expressions. @code{linel} may be assigned any value by
2262 the user, although very small or very large values may be impractical. Text
2263 printed by built-in Maxima functions, such as error messages and the output of
2264 @mrefcomma{describe} is not affected by @code{linel}.
2266 @opencatbox{Categories:}
2267 @category{Display flags and variables}
2271 @c -----------------------------------------------------------------------------
2274 @defvr {Option variable} lispdisp
2275 Default value: @code{false}
2277 When @code{lispdisp} is @code{true}, Lisp symbols are displayed with a leading
2278 question mark @code{?}. Otherwise, Lisp symbols are displayed with no leading
2279 mark. This has the same effect for 1-d and 2-d display.
2290 (%i1) lispdisp: false$
2295 (%i3) lispdisp: true$
2302 @opencatbox{Categories:}
2303 @category{Display flags and variables}
2307 @c NEEDS CLARIFICATION, EXAMPLES
2309 @c -----------------------------------------------------------------------------
2310 @anchor{negsumdispflag}
2311 @defvr {Option variable} negsumdispflag
2312 Default value: @code{true}
2314 When @code{negsumdispflag} is @code{true}, @code{x - y} displays as @code{x - y}
2315 instead of as @code{- y + x}. Setting it to @code{false} causes the special
2316 check in display for the difference of two expressions to not be done. One
2317 application is that thus @code{a + %i*b} and @code{a - %i*b} may both be
2318 displayed the same way.
2320 @opencatbox{Categories:}
2321 @category{Display flags and variables}
2325 @c -----------------------------------------------------------------------------
2327 @defvr {Option variable} obase
2328 Default value: @code{10}
2330 @code{obase} is the base for integers displayed by Maxima.
2332 @code{obase} may be assigned any integer between 2 and 36 (decimal), inclusive.
2333 When @code{obase} is greater than 10,
2334 the numerals comprise the decimal numerals 0 through 9
2335 plus capital letters of the alphabet A, B, C, @dots{}, as needed.
2336 A leading 0 digit is displayed if the leading digit is otherwise a letter.
2337 The numerals for base 36, the largest acceptable base,
2338 comprise 0 through 9, and A through Z.
2340 See also @mrefdot{ibase}
2389 @opencatbox{Categories:}
2390 @category{Display flags and variables}
2391 @category{Console interaction}
2395 @c -----------------------------------------------------------------------------
2397 @defvr {Option variable} pfeformat
2398 Default value: @code{false}
2400 When @code{pfeformat} is @code{true}, a ratio of integers is displayed with the
2401 solidus (forward slash) character, and an integer denominator @code{n} is
2402 displayed as a leading multiplicative term @code{1/n}.
2407 (%i1) pfeformat: false$
2416 (%i4) pfeformat: true$
2423 @opencatbox{Categories:}
2424 @category{Display flags and variables}
2428 @c -----------------------------------------------------------------------------
2430 @defvr {Option variable} powerdisp
2431 Default value: @code{false}
2433 When @code{powerdisp} is @code{true},
2434 a sum is displayed with its terms in order of increasing power.
2435 Thus a polynomial is displayed as a truncated power series,
2436 with the constant term first and the highest power last.
2438 By default, terms of a sum are displayed in order of decreasing power.
2443 (%i1) powerdisp:true;
2448 (%i3) powerdisp:false;
2455 @opencatbox{Categories:}
2456 @category{Display flags and variables}
2460 @c -----------------------------------------------------------------------------
2462 @deffn {Function} print (@var{expr_1}, @dots{}, @var{expr_n})
2464 Evaluates and displays @var{expr_1}, @dots{}, @var{expr_n} one after another,
2465 from left to right, starting at the left edge of the console display.
2467 The value returned by @code{print} is the value of its last argument.
2468 @code{print} does not generate intermediate expression labels.
2470 See also @mrefcomma{display} @mrefcomma{disp} @mrefcomma{ldisplay} and
2471 @mrefdot{ldisp} Those functions display one expression per line, while
2472 @code{print} attempts to display two or more expressions per line.
2474 To display the contents of a file, see @mrefdot{printfile}
2479 (%i1) r: print ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2480 radcan (log (a^10/b)))$
2482 (a+b)^3 is b + 3 a b + 3 a b + a log (a^10/b) is
2486 (%o2) 10 log(a) - log(b)
2487 (%i3) disp ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
2488 radcan (log (a^10/b)))$
2492 b + 3 a b + 3 a b + a
2499 @opencatbox{Categories:}
2500 @category{Display functions}
2504 @c -----------------------------------------------------------------------------
2505 @anchor{sqrtdispflag}
2506 @defvr {Option variable} sqrtdispflag
2507 Default value: @code{true}
2509 When @code{sqrtdispflag} is @code{false}, causes @code{sqrt} to display with
2511 @c AND OTHERWISE ... ??
2513 @opencatbox{Categories:}
2514 @category{Mathematical functions}
2515 @category{Display flags and variables}
2519 @c -----------------------------------------------------------------------------
2521 @defvr {Option variable} stardisp
2522 Default value: @code{false}
2524 When @code{stardisp} is @code{true}, multiplication is
2525 displayed with an asterisk @code{*} between operands.
2527 @opencatbox{Categories:}
2528 @category{Display flags and variables}
2532 @c -----------------------------------------------------------------------------
2534 @defvr {Option variable} ttyoff
2535 Default value: @code{false}
2537 When @code{ttyoff} is @code{true}, output expressions are not displayed.
2538 Output expressions are still computed and assigned labels. See @mrefdot{labels}
2540 Text printed by built-in Maxima functions, such as error messages and the output
2541 of @mrefcomma{describe} is not affected by @code{ttyoff}.
2543 @opencatbox{Categories:}
2544 @category{Display flags and variables}