[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 9. Input and Output

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.1 Comments

A comment in Maxima input is any text between `/*` and `*/`.

The Maxima parser treats a comment as whitespace for the purpose of finding tokens in the input stream; a token always ends at a comment. An input such as `a/* foo */b` contains two tokens, `a` and `b`, and not a single token `ab`. Comments are otherwise ignored by Maxima; neither the content nor the location of comments is stored in parsed input expressions.

Comments can be nested to arbitrary depth. The `/*` and `*/` delimiters form matching pairs. There must be the same number of `/*` as there are `*/`.

Examples:

    (%i1) /* aa is a variable of interest */  aa : 1234;
    (%o1)                         1234
    (%i2) /* Value of bb depends on aa */  bb : aa^2;
    (%o2)                        1522756
    (%i3) /* User-defined infix operator */  infix ("b");
    (%o3)                           b
    (%i4) /* Parses same as a b c, not abc */  a/* foo */b/* bar */c;
    (%o4)                         a b c
    (%i5) /* Comments /* can be nested /* to any depth */ */ */  1 + xyz;
    (%o5)                        xyz + 1

Categories: Syntax

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.2 Files

A file is simply an area on a particular storage device which contains data or text. Files on the disks are figuratively grouped into "directories". A directory is just a list of files. Commands which deal with files are: `save`, `load`,

`loadfile`, `stringout`, `batch`, `demo`, `writefile`, `closefile`, and `appendfile`.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.3 Functions and Variables for Input and Output

System variable: __

  `__` is the input expression currently being evaluated. That is, while an input expression expr is being evaluated, `__` is expr.

  `__` is assigned the input expression before the input is simplified or evaluated. However, the value of `__` is simplified (but not evaluated) when it is displayed.

  `__` is recognized by `batch` and `load`. In a file processed by `batch`, `__` has the same meaning as at the interactive prompt. In a file processed by `load`, `__` is bound to the input expression most recently entered at the interactive prompt or in a batch file; `__` is not bound to the input expressions in the file being processed. In particular, when `load (filename)` is called from the interactive prompt, `__` is bound to `load (filename)` while the file is being processed.

  See also `_` and `%`.

  Examples:

      (%i1) print ("I was called as", __);
      I was called as print(I was called as, __)
      (%o1)              print(I was called as, __)
      (%i2) foo (__);
      (%o2)                     foo(foo(__))
      (%i3) g (x) := (print ("Current input expression =", __), 0);
      (%o3) g(x) := (print("Current input expression =", __), 0)
      (%i4) [aa : 1, bb : 2, cc : 3];
      (%o4)                       [1, 2, 3]
      (%i5) (aa + bb + cc)/(dd + ee + g(x));
                                  cc + bb + aa
      Current input expression = --------------
                                 g(x) + ee + dd
                                      6
      (%o5)                        -------
                                   ee + dd

  Categories: Global variables

System variable: _

  `_` is the most recent input expression (e.g., `%i1`, `%i2`, `%i3`, ...).

  `_` is assigned the input expression before the input is simplified or evaluated. However, the value of `_` is simplified (but not evaluated) when it is displayed.

  `_` is recognized by `batch` and `load`. In a file processed by `batch`, `_` has the same meaning as at the interactive prompt. In a file processed by `load`, `_` is bound to the input expression most recently evaluated at the interactive prompt or in a batch file; `_` is not bound to the input expressions in the file being processed.

  See also `__` and `%`.

  Examples:

      (%i1) 13 + 29;
      (%o1)                          42
      (%i2) :lisp $_
      ((MPLUS) 13 29)
      (%i2) _;
      (%o2)                          42
      (%i3) sin (%pi/2);
      (%o3)                           1
      (%i4) :lisp $_
      ((%SIN) ((MQUOTIENT) $%PI 2))
      (%i4) _;
      (%o4)                           1
      (%i5) a: 13$
      (%i6) b: 29$
      (%i7) a + b;
      (%o7)                          42
      (%i8) :lisp $_
      ((MPLUS) $A $B)
      (%i8) _;
      (%o8)                         b + a
      (%i9) a + b;
      (%o9)                          42
      (%i10) ev (_);
      (%o10)                         42

  Categories: Console interaction · Global variables

System variable: %

  `%` is the output expression (e.g., `%o1`, `%o2`, `%o3`, ...) most recently computed by Maxima, whether or not it was displayed.

  `%` is recognized by `batch` and `load`. In a file processed by `batch`, `%` has the same meaning as at the interactive prompt. In a file processed by `load`, `%` is bound to the output expression most recently computed at the interactive prompt or in a batch file; `%` is not bound to output expressions in the file being processed.

  See also `_`, `%%`, and `%th`.

  Categories: Console interaction · Global variables

System variable: %%

  In compound statements, namely `block`, `lambda`, or `(s_1, ..., s_n)`, `%%` is the value of the previous statement. For example,

      block (integrate (x^5, x), ev (%%, x=2) - ev (%%, x=1));
      block ([prev], prev: integrate (x^5, x),
                     ev (prev, x=2) - ev (prev, x=1));

  yield the same result, namely `21/2`.

  A compound statement may comprise other compound statements. Whether a statement be simple or compound, `%%` is the value of the previous statement. For example,

      block (block (a^n, %%*42), %%/6)

  yields `7*a^n`.

  Within a compound statement, the value of `%%` may be inspected at a break prompt, which is opened by executing the `break` function. For example, at the break prompt opened by

      block (a: 42, break ())$

  entering `%%;` yields `42`.

  At the first statement in a compound statement, or outside of a compound statement, `%%` is undefined.

  `%%` is recognized by `batch` and `load`, and it has the same meaning as at the interactive prompt.

  See also `%`.

  Categories: Global variables

Option variable: %edispflag

  Default value: `false`

  When `%edispflag` is `true`, Maxima displays `%e` to a negative exponent as a quotient. For example, `%e^-x` is displayed as `1/%e^x`.

  Example:

      (%i1) %e^-10;
                                     - 10
      (%o1)                        %e
      (%i2) %edispflag:true$
      (%i3) %e^-10;
                                     1
      (%o3)                         ----
                                      10
                                    %e

  Categories: Exponential and logarithm functions · Display flags and variables

Function: %th (i)

  The value of the i'th previous output expression. That is, if the next expression to be computed is the n'th output, `%th (m)` is the (n - m)'th output.

  `%th` is useful in `batch` files or for referring to a group of output expressions. For example,

      block (s: 0, for i:1 thru 10 do s: s + %th (i))$

  sets `s` to the sum of the last ten output expressions.

  `%th` is recognized by `batch` and `load`. In a file processed by `batch`, `%th` has the same meaning as at the interactive prompt. In a file processed by `load`, `%th` refers to output expressions most recently computed at the interactive prompt or in a batch file; `%th` does not refer to output expressions in the file being processed.

  See also `%`.

  Categories: Console interaction

Special symbol: ?

  As prefix to a function or variable name, `?` signifies that the name is a Lisp name, not a Maxima name. For example, `?round` signifies the Lisp function `ROUND`. See Lisp and Maxima for more on this point.

  The notation `? word` (a question mark followed a word, separated by whitespace) is equivalent to `describe("word")`. The question mark must occur at the beginning of an input line; otherwise it is not recognized as a request for documentation.

  Categories: Help · Console interaction

Special symbol: ??

  The notation `?? word` (`??` followed a word, separated by whitespace) is equivalent to `describe("word", inexact)`. The question mark must occur at the beginning of an input line; otherwise it is not recognized as a request for documentation.

  Categories: Help · Console interaction

Option variable: absboxchar

  Default value: `!`

  `absboxchar` is the character used to draw absolute value signs around expressions which are more than one line tall.

  Categories: Display flags and variables

Option variable: file_output_append

  Default value: `false`

  `file_output_append` governs whether file output functions append or truncate their output file. When `file_output_append` is `true`, such functions append to their output file. Otherwise, the output file is truncated.

  `save`, `stringout`, and `with_stdout` respect `file_output_append`. Other functions which write output files do not respect `file_output_append`. In particular, plotting and translation functions always truncate their output file, and `tex` and `appendfile` always append.

  Categories: File output · Global flags

Function: appendfile (filename)

  Appends a console transcript to filename. `appendfile` is the same as `writefile`, except that the transcript file, if it exists, is always appended.

  `closefile` closes the transcript file opened by `appendfile` or `writefile`.

  Categories: File output · Console interaction

Function: batch (filename)

  Reads Maxima expressions from filename and evaluates them. `batch` searches for filename in the list `file_search_maxima`. See `file_search`.

  filename comprises a sequence of Maxima expressions, each terminated with `;` or `$`. The special variable `%` and the function `%th` refer to previous results within the file. The file may include `:lisp` constructs. Spaces, tabs, and newlines in the file are ignored. A suitable input file may be created by a text editor or by the `stringout` function.

  `batch` reads each input expression from filename, displays the input to the console, computes the corresponding output expression, and displays the output expression. Input labels are assigned to the input expressions and output labels are assigned to the output expressions. `batch` evaluates every input expression in the file unless there is an error. If user input is requested (by `asksign` or `askinteger`, for example) `batch` pauses to collect the requisite input and then continue.

  It may be possible to halt `batch` by typing `control-C` at the console. The effect of `control-C` depends on the underlying Lisp implementation.

  `batch` has several uses, such as to provide a reservoir for working command lines, to give error-free demonstrations, or to help organize one's thinking in solving complex problems.

  `batch` evaluates its argument. `batch` has no return value.

  See also `load`, `batchload`, and `demo`.

  Categories: Session management · File input

Function: batchload (filename)

  Reads Maxima expressions from filename and evaluates them, without displaying the input or output expressions and without assigning labels to output expressions. Printed output (such as produced by `print` or `describe`) is displayed, however.

  The special variable `%` and the function `%th` refer to previous results from the interactive interpreter, not results within the file. The file cannot include `:lisp` constructs.

  `batchload` returns the path of filename, as a string. `batchload` evaluates its argument.

  See also `batch` and `load`.

  Categories: Session management · File input

Function: closefile ()

  Closes the transcript file opened by `writefile` or `appendfile`.

  Categories: File output · Console interaction

Function: collapse (expr)

  Collapses expr by causing all of its common (i.e., equal) subexpressions to share (i.e., use the same cells), thereby saving space. (`collapse` is a subroutine used by the `optimize` command.) Thus, calling `collapse` may be useful after loading in a `save` file. You can collapse several expressions together by using `collapse ([expr_1, ..., expr_n])`. Similarly, you can collapse the elements of the array `A` by doing `collapse (listarray ('A))`.

  Categories: Expressions

Function: concat (arg_1, arg_2, ...)

  Concatenates its arguments. The arguments must evaluate to atoms. The return value is a symbol if the first argument is a symbol and a string otherwise.

  `concat` evaluates its arguments. The single quote `'` prevents evaluation.

      (%i1) y: 7$
      (%i2) z: 88$
      (%i3) concat (y, z/2);
      (%o3)                          744
      (%i4) concat ('y, z/2);
      (%o4)                          y44

  A symbol constructed by `concat` may be assigned a value and appear in expressions. The `::` (double colon) assignment operator evaluates its left-hand side.

      (%i5) a: concat ('y, z/2);
      (%o5)                          y44
      (%i6) a:: 123;
      (%o6)                          123
      (%i7) y44;
      (%o7)                          123
      (%i8) b^a;
                                     y44
      (%o8)                         b
      (%i9) %, numer;
                                     123
      (%o9)                         b

  Note that although `concat (1, 2)` looks like a number, it is a string.

      (%i10) concat (1, 2) + 3;
      (%o10)                       12 + 3

  Categories: Expressions · Strings

Function: sconcat (arg_1, arg_2, ...)

  Concatenates its arguments into a string. Unlike `concat`, the arguments do not need to be atoms.

      (%i1) sconcat ("xx[", 3, "]:", expand ((x+y)^3));
      (%o1)               xx[3]:y^3+3*x*y^2+3*x^2*y+x^3

  Categories: Expressions · Strings

Function: disp (expr_1, expr_2, ...)

  is like `display` but only the value of the arguments are displayed rather than equations. This is useful for complicated arguments which don't have names or where only the value of the argument is of interest and not the name.

  Examples:

      (%i1) b[1,2]:x-x^2$
      (%i2) x:123$
      (%i3) disp(x, b[1,2], sin(1.0));
                                     123

                                        2
                                   x - x

                              .8414709848078965

      (%o3)                         done

  Categories: Display functions

Function: dispcon (tensor_1, tensor_2, ...)
Function: dispcon (all)

  Displays the contraction properties of its arguments as were given to `defcon`. `dispcon (all)` displays all the contraction properties which were defined.

  Categories: Display functions

Function: display (expr_1, expr_2, ...)

  Displays equations whose left side is expr_i unevaluated, and whose right side is the value of the expression centered on the line. This function is useful in blocks and `for` statements in order to have intermediate results displayed. The arguments to `display` are usually atoms, subscripted variables, or function calls. See also `disp`.

  Examples:

      (%i1) b[1,2]:x-x^2$
      (%i2) x:123$
      (%i3) display(x, b[1,2], sin(1.0));
                                   x = 123

                                            2
                               b     = x - x
                                1, 2

                        sin(1.0) = .8414709848078965

      (%o3)                         done

  Categories: Display functions

Option variable: display2d

  Default value: `true`

  When `display2d` is `false`, the console display is a string (1-dimensional) form rather than a display (2-dimensional) form.

  Example:

      (%i1) x/(x^2+1);
                                     x
      (%o1)                        ------
                                    2
                                   x  + 1
      (%i2) display2d:false$
      (%i3) x/(x^2+1);
      (%o3) x/(x^2+1)

  Categories: Display flags and variables

Option variable: display_format_internal

  Default value: `false`

  When `display_format_internal` is `true`, expressions are displayed without being transformed in ways that hide the internal mathematical representation. The display then corresponds to what `inpart` returns rather than `part`.

  Examples:

      User     part       inpart
      a-b;      a - b     a + (- 1) b

                 a            - 1
      a/b;       -         a b
                 b
                             1/2
      sqrt(x);   sqrt(x)    x

                4 X        4
      X*4/3;    ---        - X
                 3         3

  Categories: Display flags and variables

Function: dispterms (expr)

  Displays expr in parts one below the other. That is, first the operator of expr is displayed, then each term in a sum, or factor in a product, or part of a more general expression is displayed separately. This is useful if expr is too large to be otherwise displayed. For example if `P1`, `P2`, ... are very large expressions then the display program may run out of storage space in trying to display `P1 + P2 + ...` all at once. However, `dispterms (P1 + P2 + ...)` displays `P1`, then below it `P2`, etc. When not using `dispterms`, if an exponential expression is too wide to be displayed as `A^B` it appears as `expt (A, B)` (or as `ncexpt (A, B)` in the case of `A^^B`).

  Categories: Display functions

Option variable: error_size

  Default value: 10

  `error_size` modifies error messages according to the size of expressions which appear in them. If the size of an expression (as determined by the Lisp function `ERROR-SIZE`) is greater than `error_size`, the expression is replaced in the message by a symbol, and the symbol is assigned the expression. The symbols are taken from the list `error_syms`.

  Otherwise, the expression is smaller than `error_size`, and the expression is displayed in the message.

  See also `error` and `error_syms`.

  Example:

  The size of `U`, as determined by `ERROR-SIZE`, is 24.

      (%i1) U: (C^D^E + B + A)/(cos(X-1) + 1)$

      (%i2) error_size: 20$

      (%i3) error ("Example expression is", U);

      Example expression is errexp1
       -- an error.  Quitting.  To debug this try debugmode(true);
      (%i4) errexp1;
                                  E
                                 D
                                C   + B + A
      (%o4)                    --------------
                               cos(X - 1) + 1
      (%i5) error_size: 30$

      (%i6) error ("Example expression is", U);

                               E
                              D
                             C   + B + A
      Example expression is --------------
                            cos(X - 1) + 1
       -- an error.  Quitting.  To debug this try debugmode(true);

  Categories: Debugging · Display flags and variables

Option variable: error_syms

  Default value: `[errexp1, errexp2, errexp3]`

  In error messages, expressions larger than `error_size` are replaced by symbols, and the symbols are set to the expressions. The symbols are taken from the list `error_syms`. The first too-large expression is replaced by `error_syms[1]`, the second by `error_syms[2]`, and so on.

  If there are more too-large expressions than there are elements of `error_syms`, symbols are constructed automatically, with the n-th symbol equivalent to `concat ('errexp, n)`.

  See also `error` and `error_size`.

  Categories: Debugging · Display flags and variables

Function: expt (a, b)

  If an exponential expression is too wide to be displayed as `a^b` it appears as `expt (a, b)` (or as `ncexpt (a, b)` in the case of `a^^b`).

  `expt` and `ncexpt` are not recognized in input.

Option variable: exptdispflag

  Default value: `true`

  When `exptdispflag` is `true`, Maxima displays expressions with negative exponents using quotients, e.g., `X^(-1)` as `1/X`.

  Categories: Expressions · Display flags and variables

Function: filename_merge (path, filename)

  Constructs a modified path from path and filename. If the final component of path is of the form `###.something`, the component is replaced with `filename.something`. Otherwise, the final component is simply replaced by filename.

  The result is a Lisp pathname object.

  Categories: File input · File output

Function: file_search (filename)
Function: file_search (filename, pathlist)

  `file_search` searches for the file filename and returns the path to the file (as a string) if it can be found; otherwise `file_search` returns `false`. `file_search (filename)` searches in the default search directories, which are specified by the `file_search_maxima`, `file_search_lisp`, and `file_search_demo` variables.

  `file_search` first checks if the actual name passed exists, before attempting to match it to "wildcard" file search patterns. See `file_search_maxima` concerning file search patterns.

  The argument filename can be a path and file name, or just a file name, or, if a file search directory includes a file search pattern, just the base of the file name (without an extension). For example,

      file_search ("/home/wfs/special/zeta.mac");
      file_search ("zeta.mac");
      file_search ("zeta");

  all find the same file, assuming the file exists and `/home/wfs/special/###.mac` is in `file_search_maxima`.

  `file_search (filename, pathlist)` searches only in the directories specified by pathlist, which is a list of strings. The argument pathlist supersedes the default search directories, so if the path list is given, `file_search` searches only the ones specified, and not any of the default search directories. Even if there is only one directory in pathlist, it must still be given as a one-element list.

  The user may modify the default search directories. See `file_search_maxima`.

  `file_search` is invoked by `load` with `file_search_maxima` and `file_search_lisp` as the search directories.

  Categories: File input

Option variable: file_search_maxima
Option variable: file_search_lisp
Option variable: file_search_demo
Option variable: file_search_usage
Option variable: file_search_tests

  These variables specify lists of directories to be searched by `load`, `demo`, and some other Maxima functions. The default values of these variables name various directories in the Maxima installation.

  The user can modify these variables, either to replace the default values or to append additional directories. For example,

      file_search_maxima: ["/usr/local/foo/###.mac",
          "/usr/local/bar/###.mac"]$

  replaces the default value of `file_search_maxima`, while

      file_search_maxima: append (file_search_maxima,
          ["/usr/local/foo/###.mac", "/usr/local/bar/###.mac"])$

  appends two additional directories. It may be convenient to put such an expression in the file `maxima-init.mac` so that the file search path is assigned automatically when Maxima starts.

  Multiple filename extensions and multiple paths can be specified by special "wildcard" constructions. The string `###` expands into the sought-after name, while a comma-separated list enclosed in curly braces `{foo,bar,baz}` expands into multiple strings. For example, supposing the sought-after name is `neumann`,

      "/home/{wfs,gcj}/###.{lisp,mac}"

  expands into `/home/wfs/neumann.lisp`, `/home/gcj/neumann.lisp`, `/home/wfs/neumann.mac`, and `/home/gcj/neumann.mac`.

  Categories: File input · Global variables

Function: file_type (filename)

  Returns a guess about the content of filename, based on the filename extension. filename need not refer to an actual file; no attempt is made to open the file and inspect the content.

  The return value is a symbol, either `object`, `lisp`, or `maxima`. If the extension starts with `m` or `d`, `file_type` returns `maxima`. If the extension starts with `l`, `file_type` returns `lisp`. If none of the above, `file_type` returns `object`.

  Categories: File input

Function: grind (expr)
Option variable: grind

  The function `grind` prints expr to the console in a form suitable for input to Maxima. `grind` always returns `done`.

  When expr is the name of a function or macro, `grind` prints the function or macro definition instead of just the name.

  See also `string`, which returns a string instead of printing its output. `grind` attempts to print the expression in a manner which makes it slightly easier to read than the output of `string`.

  When the variable `grind` is `true`, the output of `string` and `stringout` has the same format as that of `grind`; otherwise no attempt is made to specially format the output of those functions. The default value of the variable `grind` is `false`.

  `grind` can also be specified as an argument of `playback`. When `grind` is present, `playback` prints input expressions in the same format as the `grind` function. Otherwise, no attempt is made to specially format input expressions.

  `grind` evaluates its argument.

  Examples:

      (%i1) aa + 1729;
      (%o1)                       aa + 1729
      (%i2) grind (%);
      aa+1729$
      (%o2)                         done
      (%i3) [aa, 1729, aa + 1729];
      (%o3)                 [aa, 1729, aa + 1729]
      (%i4) grind (%);
      [aa,1729,aa+1729]$
      (%o4)                         done
      (%i5) matrix ([aa, 17], [29, bb]);
                                 [ aa  17 ]
      (%o5)                      [        ]
                                 [ 29  bb ]
      (%i6) grind (%);
      matrix([aa,17],[29,bb])$
      (%o6)                         done
      (%i7) set (aa, 17, 29, bb);
      (%o7)                   {17, 29, aa, bb}
      (%i8) grind (%);
      {17,29,aa,bb}$
      (%o8)                         done
      (%i9) exp (aa / (bb + 17)^29);
                                      aa
                                  -----------
                                           29
                                  (bb + 17)
      (%o9)                     %e
      (%i10) grind (%);
      %e^(aa/(bb+17)^29)$
      (%o10)                        done
      (%i11) expr: expand ((aa + bb)^10);
               10           9        2   8         3   7         4   6
      (%o11) bb   + 10 aa bb  + 45 aa  bb  + 120 aa  bb  + 210 aa  bb
               5   5         6   4         7   3        8   2
       + 252 aa  bb  + 210 aa  bb  + 120 aa  bb  + 45 aa  bb
              9        10
       + 10 aa  bb + aa
      (%i12) grind (expr);
      bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6
           +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2
           +10*aa^9*bb+aa^10$
      (%o12)                        done
      (%i13) string (expr);
      (%o13) bb^10+10*aa*bb^9+45*aa^2*bb^8+120*aa^3*bb^7+210*aa^4*bb^6\
      +252*aa^5*bb^5+210*aa^6*bb^4+120*aa^7*bb^3+45*aa^8*bb^2+10*aa^9*\
      bb+aa^10
      (%i14) cholesky (A):= block ([n : length (A), L : copymatrix (A),
        p : makelist (0, i, 1, length (A))], for i thru n do
        for j : i thru n do
        (x : L[i, j], x : x - sum (L[j, k] * L[i, k], k, 1, i - 1),
        if i = j then p[i] : 1 / sqrt(x) else L[j, i] : x * p[i]),
        for i thru n do L[i, i] : 1 / p[i],
        for i thru n do for j : i + 1 thru n do L[i, j] : 0, L)$
      (%i15) grind (cholesky);
      cholesky(A):=block(
               [n:length(A),L:copymatrix(A),
                p:makelist(0,i,1,length(A))],
               for i thru n do
                   (for j from i thru n do
                        (x:L[i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),
                         if i = j then p[i]:1/sqrt(x)
                             else L[j,i]:x*p[i])),
               for i thru n do L[i,i]:1/p[i],
               for i thru n do (for j from i+1 thru n do L[i,j]:0),L)$
      (%o15)                        done
      (%i16) string (fundef (cholesky));
      (%o16) cholesky(A):=block([n:length(A),L:copymatrix(A),p:makelis\
      t(0,i,1,length(A))],for i thru n do (for j from i thru n do (x:L\
      [i,j],x:x-sum(L[j,k]*L[i,k],k,1,i-1),if i = j then p[i]:1/sqrt(x\
      ) else L[j,i]:x*p[i])),for i thru n do L[i,i]:1/p[i],for i thru \
      n do (for j from i+1 thru n do L[i,j]:0),L)

  Categories: Display functions · Display flags and variables

Option variable: ibase

  Default value: 10

  `ibase` is the base for integers read by Maxima.

  `ibase` may be assigned any integer between 2 and 36 (decimal), inclusive. When `ibase` is greater than 10, the numerals comprise the decimal numerals 0 through 9 plus letters of the alphabet A, B, C, ..., as needed to make `ibase` digits in all. Letters are interpreted as digits only if the first digit is 0 through 9. Uppercase and lowercase letters are not distinguished. The numerals for base 36, the largest acceptable base, comprise 0 through 9 and A through Z.

  Whatever the value of `ibase`, when an integer is terminated by a decimal point, it is interpreted in base 10.

  See also `obase`.

  Examples:

  `ibase` less than 10.

      (%i1) ibase : 2 $
      (%i2) obase;
      (%o2)                          10
      (%i3) 1111111111111111;
      (%o3)                         65535

  `ibase` greater than 10. Letters are interpreted as digits only if the first digit is 0 through 9.

      (%i1) ibase : 16 $
      (%i2) obase;
      (%o2)                          10
      (%i3) 1000;
      (%o3)                         4096
      (%i4) abcd;
      (%o4)                         abcd
      (%i5) symbolp (abcd);
      (%o5)                         true
      (%i6) 0abcd;
      (%o6)                         43981
      (%i7) symbolp (0abcd);
      (%o7)                         false

  When an integer is terminated by a decimal point, it is interpreted in base 10.

      (%i1) ibase : 36 $
      (%i2) obase;
      (%o2)                          10
      (%i3) 1234;
      (%o3)                         49360
      (%i4) 1234.;
      (%o4)                         1234

  Categories: Console interaction

Option variable: inchar

  Default value: `%i`

  `inchar` is the prefix of the labels of expressions entered by the user. Maxima automatically constructs a label for each input expression by concatenating `inchar` and `linenum`.

  `inchar` may be assigned any string or symbol, not necessarily a single character. Because Maxima internally takes into account only the first char of the prefix, the prefixes `inchar`, `outchar`, and `linechar` should have a different first char. Otherwise some commands like `kill(inlables)` do not work as expected.

      (%i1) inchar: "input";
      (%o1)                                input
      (input1) expand ((a+b)^3);
                                  3        2      2      3
      (%o1)                      b  + 3 a b  + 3 a  b + a
      (input2)

  See also `labels`.

  Categories: Display flags and variables

Function: ldisp (expr_1, ..., expr_n)

  Displays expressions expr_1, ..., expr_n to the console as printed output. `ldisp` assigns an intermediate expression label to each argument and returns the list of labels.

  See also `disp`.

      (%i1) e: (a+b)^3;
                                         3
      (%o1)                       (b + a)
      (%i2) f: expand (e);
                           3        2      2      3
      (%o2)               b  + 3 a b  + 3 a  b + a
      (%i3) ldisp (e, f);
                                         3
      (%t3)                       (b + a)

                           3        2      2      3
      (%t4)               b  + 3 a b  + 3 a  b + a

      (%o4)                      [%t3, %t4]
      (%i4) %t3;
                                         3
      (%o4)                       (b + a)
      (%i5) %t4;
                           3        2      2      3
      (%o5)               b  + 3 a b  + 3 a  b + a

  Categories: Display functions

Function: ldisplay (expr_1, ..., expr_n)

  Displays expressions expr_1, ..., expr_n to the console as printed output. Each expression is printed as an equation of the form `lhs = rhs` in which `lhs` is one of the arguments of `ldisplay` and `rhs` is its value. Typically each argument is a variable. `ldisp` assigns an intermediate expression label to each equation and returns the list of labels.

  See also `display`.

      (%i1) e: (a+b)^3;
                                         3
      (%o1)                       (b + a)
      (%i2) f: expand (e);
                           3        2      2      3
      (%o2)               b  + 3 a b  + 3 a  b + a
      (%i3) ldisplay (e, f);
                                           3
      (%t3)                     e = (b + a)

                             3        2      2      3
      (%t4)             f = b  + 3 a b  + 3 a  b + a

      (%o4)                      [%t3, %t4]
      (%i4) %t3;
                                           3
      (%o4)                     e = (b + a)
      (%i5) %t4;
                             3        2      2      3
      (%o5)             f = b  + 3 a b  + 3 a  b + a

  Categories: Display functions

Option variable: linechar

  Default value: `%t`

  `linechar` is the prefix of the labels of intermediate expressions generated by Maxima. Maxima constructs a label for each intermediate expression (if displayed) by concatenating `linechar` and `linenum`.

  `linechar` may be assigned any string or symbol, not necessarily a single character. Because Maxima internally takes into account only the first char of the prefix, the prefixes `inchar`, `outchar`, and `linechar` should have a different first char. Otherwise some commands like `kill(inlables)` do not work as expected.

  Intermediate expressions might or might not be displayed. See `programmode` and `labels`.

  Categories: Display flags and variables

Option variable: linel

  Default value: 79

  `linel` is the assumed width (in characters) of the console display for the purpose of displaying expressions. `linel` may be assigned any value by the user, although very small or very large values may be impractical. Text printed by built-in Maxima functions, such as error messages and the output of `describe`, is not affected by `linel`.

  Categories: Display flags and variables

Option variable: lispdisp

  Default value: `false`

  When `lispdisp` is `true`, Lisp symbols are displayed with a leading question mark `?`. Otherwise, Lisp symbols are displayed with no leading mark.

  Examples:

      (%i1) lispdisp: false$
      (%i2) ?foo + ?bar;
      (%o2)                       foo + bar
      (%i3) lispdisp: true$
      (%i4) ?foo + ?bar;
      (%o4)                      ?foo + ?bar

  Categories: Display flags and variables

Function: load (filename)

  Evaluates expressions in filename, thus bringing variables, functions, and other objects into Maxima. The binding of any existing object is clobbered by the binding recovered from filename. To find the file, `load` calls `file_search` with `file_search_maxima` and `file_search_lisp` as the search directories. If `load` succeeds, it returns the name of the file. Otherwise `load` prints an error message.

  `load` works equally well for Lisp code and Maxima code. Files created by `save`, `translate_file`, and `compile_file`, which create Lisp code, and `stringout`, which creates Maxima code, can all be processed by `load`. `load` calls `loadfile` to load Lisp files and `batchload` to load Maxima files.

  `load` does not recognize `:lisp` constructs in Maxima files, and while processing filename, the global variables `_`, `__`, `%`, and `%th` have whatever bindings they had when `load` was called.

  See also `loadfile`, `batch`, `batchload`, and `demo`. `loadfile` processes Lisp files; `batch`, `batchload`, and `demo` process Maxima files.

  See `file_search` for more detail about the file search mechanism.

  `load` evaluates its argument.

  Categories: Session management · File input

Function: loadfile (filename)

  Evaluates Lisp expressions in filename. `loadfile` does not invoke `file_search`, so `filename` must include the file extension and as much of the path as needed to find the file.

  `loadfile` can process files created by `save`, `translate_file`, and `compile_file`. The user may find it more convenient to use `load` instead of `loadfile`.

  Categories: Session management · File input

Option variable: loadprint

  Default value: `true`

  `loadprint` tells whether to print a message when a file is loaded.

  - When `loadprint` is `true`, always print a message.
  - When `loadprint` is `'loadfile`, print a message only if a file is loaded by the function `loadfile`.
  - When `loadprint` is `'autoload`, print a message only if a file is automatically loaded. See `setup_autoload`.
  - When `loadprint` is `false`, never print a message.

  Categories: File input · Global flags

Option variable: obase

  Default value: 10

  `obase` is the base for integers displayed by Maxima.

  `obase` may be assigned any integer between 2 and 36 (decimal), inclusive. When `obase` is greater than 10, the numerals comprise the decimal numerals 0 through 9 plus capital letters of the alphabet A, B, C, ..., as needed. A leading 0 digit is displayed if the leading digit is otherwise a letter. The numerals for base 36, the largest acceptable base, comprise 0 through 9, and A through Z.

  See also `ibase`.

  Examples:

      (%i1) obase : 2;
      (%o1)                          10
      (%i2) 2^8 - 1;
      (%o10)                      11111111
      (%i3) obase : 8;
      (%o3)                          10
      (%i4) 8^8 - 1;
      (%o4)                       77777777
      (%i5) obase : 16;
      (%o5)                          10
      (%i6) 16^8 - 1;
      (%o6)                       0FFFFFFFF
      (%i7) obase : 36;
      (%o7)                          10
      (%i8) 36^8 - 1;
      (%o8)                       0ZZZZZZZZ

  Categories: Display flags and variables · Console interaction

Option variable: outchar

  Default value: `%o`

  `outchar` is the prefix of the labels of expressions computed by Maxima. Maxima automatically constructs a label for each computed expression by concatenating `outchar` and `linenum`.

  `outchar` may be assigned any string or symbol, not necessarily a single character. Because Maxima internally takes into account only the first char of the prefix, the prefixes `inchar`, `outchar`, and `linechar` should have a different first char. Otherwise some commands like `kill(inlables)` do not work as expected.

      (%i1) outchar: "output";
      (output1)                           output
      (%i2) expand ((a+b)^3);
                                  3        2      2      3
      (output2)                  b  + 3 a b  + 3 a  b + a
      (%i3)

  See also `labels`.

  Categories: Display flags and variables

Option variable: packagefile

  Default value: `false`

  Package designers who use `save` or `translate` to create packages (files) for others to use may want to set `packagefile: true` to prevent information from being added to Maxima's information-lists (e.g. `values`, `functions`) except where necessary when the file is loaded in. In this way, the contents of the package will not get in the user's way when he adds his own data. Note that this will not solve the problem of possible name conflicts. Also note that the flag simply affects what is output to the package file. Setting the flag to `true` is also useful for creating Maxima init files.

  Categories: Translation flags and variables

Option variable: pfeformat

  Default value: `false`

  When `pfeformat` is `true`, a ratio of integers is displayed with the solidus (forward slash) character, and an integer denominator `n` is displayed as a leading multiplicative term `1/n`.

      (%i1) pfeformat: false$
      (%i2) 2^16/7^3;
                                    65536
      (%o2)                         -----
                                     343
      (%i3) (a+b)/8;
                                    b + a
      (%o3)                         -----
                                      8
      (%i4) pfeformat: true$
      (%i5) 2^16/7^3;
      (%o5)                       65536/343
      (%i6) (a+b)/8;
      (%o6)                      1/8 (b + a)

  Categories: Display flags and variables

Function: print (expr_1, ..., expr_n)

  Evaluates and displays expr_1, ..., expr_n one after another, from left to right, starting at the left edge of the console display.

  The value returned by `print` is the value of its last argument. `print` does not generate intermediate expression labels.

  See also `display`, `disp`, `ldisplay`, and `ldisp`. Those functions display one expression per line, while `print` attempts to display two or more expressions per line.

  To display the contents of a file, see `printfile`.

      (%i1) r: print ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
            radcan (log (a^10/b)))$
                  3        2      2      3
      (a+b)^3 is b  + 3 a b  + 3 a  b + a  log (a^10/b) is

                                                    10 log(a) - log(b)
      (%i2) r;
      (%o2)                  10 log(a) - log(b)
      (%i3) disp ("(a+b)^3 is", expand ((a+b)^3), "log (a^10/b) is",
            radcan (log (a^10/b)))$
                                 (a+b)^3 is

                           3        2      2      3
                          b  + 3 a b  + 3 a  b + a

                               log (a^10/b) is

                             10 log(a) - log(b)

  Categories: Display functions

Function: printfile (path)

  Prints the file named by path to the console. path may be a string or a symbol; if it is a symbol, it is converted to a string.

  If path names a file which is accessible from the current working directory, that file is printed to the console. Otherwise, `printfile` attempts to locate the file by appending path to each of the elements of `file_search_usage` via `filename_merge`.

  `printfile` returns path if it names an existing file, or otherwise the result of a successful filename merge.

  Categories: File input · Console interaction

Function: tcl_output (list, i0, skip)
Function: tcl_output (list, i0)
Function: tcl_output ([list_1, ..., list_n], i)

  Prints elements of a list enclosed by curly braces `{ }`, suitable as part of a program in the Tcl/Tk language.

  `tcl_output (list, i0, skip)` prints list, beginning with element i0 and printing elements `i0 + skip`, `i0 + 2 skip`, etc.

  `tcl_output (list, i0)` is equivalent to `tcl_output (list, i0, 2)`.

  `tcl_output ([list_1, ..., list_n], i)` prints the i'th elements of list_1, ..., list_n.

  Examples:

      (%i1) tcl_output ([1, 2, 3, 4, 5, 6], 1, 3)$

       {1.000000000     4.000000000
       }
      (%i2) tcl_output ([1, 2, 3, 4, 5, 6], 2, 3)$

       {2.000000000     5.000000000
       }
      (%i3) tcl_output ([3/7, 5/9, 11/13, 13/17], 1)$

       {((RAT SIMP) 3 7) ((RAT SIMP) 11 13)
       }
      (%i4) tcl_output ([x1, y1, x2, y2, x3, y3], 2)$

       {$Y1 $Y2 $Y3
       }
      (%i5) tcl_output ([[1, 2, 3], [11, 22, 33]], 1)$

       {SIMP 1.000000000     11.00000000
       }

Function: read (expr_1, ..., expr_n)

  Prints expr_1, ..., expr_n, then reads one expression from the console and returns the evaluated expression. The expression is terminated with a semicolon `;` or dollar sign `$`.

  See also `readonly`.

      (%i1) foo: 42$
      (%i2) foo: read ("foo is", foo, " -- enter new value.")$
      foo is 42  -- enter new value.
      (a+b)^3;
      (%i3) foo;
                                           3
      (%o3)                         (b + a)

  Categories: Console interaction

Function: readonly (expr_1, ..., expr_n)

  Prints expr_1, ..., expr_n, then reads one expression from the console and returns the expression (without evaluation). The expression is terminated with a `;` (semicolon) or `$` (dollar sign).

      (%i1) aa: 7$
      (%i2) foo: readonly ("Enter an expression:");
      Enter an expression:
      2^aa;
                                        aa
      (%o2)                            2
      (%i3) foo: read ("Enter an expression:");
      Enter an expression:
      2^aa;
      (%o3)                            128

  See also `read`.

  Categories: Console interaction

Function: reveal (expr, depth)

  Replaces parts of expr at the specified integer depth with descriptive summaries.

  - Sums and differences are replaced by `Sum(n)` where n is the number of operands of the sum.
  - Products are replaced by `Product(n)` where n is the number of operands of the product.
  - Exponentials are replaced by `Expt`.
  - Quotients are replaced by `Quotient`.
  - Unary negation is replaced by `Negterm`.

  When depth is greater than or equal to the maximum depth of expr, `reveal (expr, depth)` returns expr unmodified.

  `reveal` evaluates its arguments. `reveal` returns the summarized expression.

  Example:

      (%i1) e: expand ((a - b)^2)/expand ((exp(a) + exp(b))^2);
                                2            2
                               b  - 2 a b + a
      (%o1)               -------------------------
                              b + a     2 b     2 a
                          2 %e      + %e    + %e
      (%i2) reveal (e, 1);
      (%o2)                       Quotient
      (%i3) reveal (e, 2);
                                   Sum(3)
      (%o3)                        ------
                                   Sum(3)
      (%i4) reveal (e, 3);
                           Expt + Negterm + Expt
      (%o4)               ------------------------
                          Product(2) + Expt + Expt
      (%i5) reveal (e, 4);
                             2                 2
                            b  - Product(3) + a
      (%o5)         ------------------------------------
                               Product(2)     Product(2)
                    2 Expt + %e           + %e
      (%i6) reveal (e, 5);
                               2            2
                              b  - 2 a b + a
      (%o6)              --------------------------
                             Sum(2)     2 b     2 a
                         2 %e       + %e    + %e
      (%i7) reveal (e, 6);
                                2            2
                               b  - 2 a b + a
      (%o7)               -------------------------
                              b + a     2 b     2 a
                          2 %e      + %e    + %e

  Categories: Expressions · Display functions

Option variable: rmxchar

  Default value: `]`

  `rmxchar` is the character drawn on the right-hand side of a matrix.

  See also `lmxchar`.

  Categories: Display flags and variables

Function: save (filename, name_1, name_2, name_3, ...)
Function: save (filename, values, functions, labels, ...)
Function: save (filename, [m, n])
Function: save (filename, name_1=expr_1, ...)
Function: save (filename, all)
Function: save (filename, name_1=expr_1, name_2=expr_2, ...)

  Stores the current values of name_1, name_2, name_3, ..., in filename. The arguments are the names of variables, functions, or other objects. If a name has no value or function associated with it, it is ignored. `save` returns filename.

  `save` stores data in the form of Lisp expressions. The data stored by `save` may be recovered by `load (filename)`.

  The global flag `file_output_append` governs whether `save` appends or truncates the output file. When `file_output_append` is `true`, `save` appends to the output file. Otherwise, `save` truncates the output file. In either case, `save` creates the file if it does not yet exist.

  The special form `save (filename, values, functions, labels, ...)` stores the items named by `values`, `functions`, `labels`, etc. The names may be any specified by the variable `infolists`. `values` comprises all user-defined variables.

  The special form `save (filename, [m, n])` stores the values of input and output labels m through n. Note that m and n must be literal integers. Input and output labels may also be stored one by one, e.g., `save ("foo.1", %i42, %o42)`. `save (filename, labels)` stores all input and output labels. When the stored labels are recovered, they clobber existing labels.

  The special form `save (filename, name_1=expr_1, name_2=expr_2, ...)` stores the values of expr_1, expr_2, ..., with names name_1, name_2, .... It is useful to apply this form to input and output labels, e.g., `save ("foo.1", aa=%o88)`. The right-hand side of the equality in this form may be any expression, which is evaluated. This form does not introduce the new names into the current Maxima environment, but only stores them in filename.

  These special forms and the general form of `save` may be mixed at will. For example, `save (filename, aa, bb, cc=42, functions, [11, 17])`.

  The special form `save (filename, all)` stores the current state of Maxima. This includes all user-defined variables, functions, arrays, etc., as well as some automatically defined items. The saved items include system variables, such as `file_search_maxima` or `showtime`, if they have been assigned new values by the user; see `myoptions`.

  `save` evaluates filename and quotes all other arguments.

  Categories: Session management · File output

Option variable: savedef

  Default value: `true`

  When `savedef` is `true`, the Maxima version of a user function is preserved when the function is translated. This permits the definition to be displayed by `dispfun` and allows the function to be edited.

  When `savedef` is `false`, the names of translated functions are removed from the `functions` list.

  Categories: Translation flags and variables

Function: show (expr)

  Displays `expr` with the indexed objects in it shown having covariant indices as subscripts, contravariant indices as superscripts. The derivative indices are displayed as subscripts, separated from the covariant indices by a comma.

  Categories: Package itensor · Display functions

Function: showratvars (expr)

  Returns a list of the canonical rational expression (CRE) variables in expression `expr`.

  See also `ratvars`.

  Categories: Rational expressions · Display functions

Option variable: stardisp

  Default value: `false`

  When `stardisp` is `true`, multiplication is displayed with an asterisk `*` between operands.

  Categories: Display flags and variables

Function: string (expr)

  Converts `expr` to Maxima's linear notation just as if it had been typed in.

  The return value of `string` is a string, and thus it cannot be used in a computation.

  Categories: Strings

Option variable: stringdisp

  Default value: `false`

  When `stringdisp` is `true`, strings are displayed enclosed in double quote marks. Otherwise, quote marks are not displayed.

  `stringdisp` is always `true` when displaying a function definition.

  Examples:

      (%i1) stringdisp: false$
      (%i2) "This is an example string.";
      (%o2)              This is an example string.
      (%i3) foo () :=
            print ("This is a string in a function definition.");
      (%o3) foo() :=
                    print("This is a string in a function definition.")
      (%i4) stringdisp: true$
      (%i5) "This is an example string.";
      (%o5)             "This is an example string."

  Categories: Display flags and variables

Function: stringout (filename, expr_1, expr_2, expr_3, ...)
Function: stringout (filename, [m, n])
Function: stringout (filename, input)
Function: stringout (filename, functions)
Function: stringout (filename, values)

  `stringout` writes expressions to a file in the same form the expressions would be typed for input. The file can then be used as input for the `batch` or `demo` commands, and it may be edited for any purpose. `stringout` can be executed while `writefile` is in progress.

  The global flag `file_output_append` governs whether `stringout` appends or truncates the output file. When `file_output_append` is `true`, `stringout` appends to the output file. Otherwise, `stringout` truncates the output file. In either case, `stringout` creates the file if it does not yet exist.

  The general form of `stringout` writes the values of one or more expressions to the output file. Note that if an expression is a variable, only the value of the variable is written and not the name of the variable. As a useful special case, the expressions may be input labels (`%i1`, `%i2`, `%i3`, ...) or output labels (`%o1`, `%o2`, `%o3`, ...).

  If `grind` is `true`, `stringout` formats the output using the `grind` format. Otherwise the `string` format is used. See `grind` and `string`.

  The special form `stringout (filename, [m, n])` writes the values of input labels m through n, inclusive.

  The special form `stringout (filename, input)` writes all input labels to the file.

  The special form `stringout (filename, functions)` writes all user-defined functions (named by the global list `functions`) to the file.

  The special form `stringout (filename, values)` writes all user-assigned variables (named by the global list `values`) to the file. Each variable is printed as an assignment statement, with the name of the variable, a colon, and its value. Note that the general form of `stringout` does not print variables as assignment statements.

  Categories: Session management · File output

Function: tex (expr)
Function: tex (expr, destination)
Function: tex (expr, false)
Function: tex (label)
Function: tex (label, destination)
Function: tex (label, false)

  Prints a representation of an expression suitable for the TeX document preparation system. The result is a fragment of a document, which can be copied into a larger document but not processed by itself.

  `tex (expr)` prints a TeX representation of expr on the console.

  `tex (label)` prints a TeX representation of the expression named by label and assigns it an equation label (to be displayed to the left of the expression). The TeX equation label is the same as the Maxima label.

  destination may be an output stream or file name. When destination is a file name, `tex` appends its output to the file. The functions `openw` and `opena` create output streams.

  `tex (expr, false)` and `tex (label, false)` return their TeX output as a string.

  `tex` evaluates its first argument after testing it to see if it is a label. Quote-quote `''` forces evaluation of the argument, thereby defeating the test and preventing the label.

  See also `texput`.

  Examples:

      (%i1) integrate (1/(1+x^3), x);
                                          2 x - 1
                        2            atan(-------)
                   log(x  - x + 1)        sqrt(3)    log(x + 1)
      (%o1)      - --------------- + ------------- + ----------
                          6             sqrt(3)          3
      (%i2) tex (%o1);
      $$-{{\log \left(x^2-x+1\right)}\over{6}}+{{\arctan \left({{2\,x-1
       }\over{\sqrt{3}}}\right)}\over{\sqrt{3}}}+{{\log \left(x+1\right)
       }\over{3}}\leqno{\tt (\%o1)}$$
      (%o2)                          (\%o1)
      (%i3) tex (integrate (sin(x), x));
      $$-\cos x$$
      (%o3)                           false
      (%i4) tex (%o1, "foo.tex");
      (%o4)                          (\%o1)

  `tex (expr, false)` returns its TeX output as a string.

      (%i1) S : tex (x * y * z, false);
      (%o1) $$x\,y\,z$$
      (%i2) S;
      (%o2) $$x\,y\,z$$

  Categories: TeX output · File output

Function: tex1 (e)

  Returns a string which represents the TeX output for the expressions e. The TeX output is not enclosed in delimiters for an equation or any other environment.

  Examples:

      (%i1) tex1 (sin(x) + cos(x));
      (%o1)                     \sin x+\cos x

Function: texput (a, s)
Function: texput (a, f)
Function: texput (a, s, operator_type)
Function: texput (a, [s_1, s_2], matchfix)
Function: texput (a, [s_1, s_2, s_3], matchfix)

  Assign the TeX output for the atom a, which can be a symbol or the name of an operator.

  `texput (a, s)` causes the `tex` function to interpolate the string s into the TeX output in place of a.

  `texput (a, f)` causes the `tex` function to call the function f to generate TeX output. f must accept one argument, which is an expression which has operator a, and must return a string (the TeX output). f may call `tex1` to generate TeX output for the arguments of the input expression.

  `texput (a, s, operator_type)`, where operator_type is `prefix`, `infix`, `postfix`, `nary`, or `nofix`, causes the `tex` function to interpolate s into the TeX output in place of a, and to place the interpolated text in the appropriate position.

  `texput (a, [s_1, s_2], matchfix)` causes the `tex` function to interpolate s_1 and s_2 into the TeX output on either side of the arguments of a. The arguments (if more than one) are separated by commas.

  `texput (a, [s_1, s_2, s_3], matchfix)` causes the `tex` function to interpolate s_1 and s_2 into the TeX output on either side of the arguments of a, with s_3 separating the arguments.

  Examples:

  Assign TeX output for a variable.

      (%i1) texput (me,"\\mu_e");
      (%o1)                         \mu_e
      (%i2) tex (me);
      $$\mu_e$$
      (%o2)                         false

  Assign TeX output for an ordinary function (not an operator).

      (%i1) texput (lcm, "\\mathrm{lcm}");
      (%o1)                     \mathrm{lcm}
      (%i2) tex (lcm (a, b));
      $$\mathrm{lcm}\left(a , b\right)$$
      (%o2)                         false

  Call a function to generate TeX output.

      (%i1) texfoo (e) := block ([a, b], [a, b] : args (e),
        concat ("\\left[\\stackrel{", tex1 (b), "}{", tex1 (a), "}\\right]"))$
      (%i2) texput (foo, texfoo);
      (%o2)                        texfoo
      (%i3) tex (foo (2^x, %pi));
      $$\left[\stackrel{\pi}{2^{x}}\right]$$
      (%o3)                         false

  Assign TeX output for a prefix operator.

      (%i1) prefix ("grad");
      (%o1)                         grad
      (%i2) texput ("grad", " \\nabla ", prefix);
      (%o2)                        \nabla
      (%i3) tex (grad f);
      $$ \nabla f$$
      (%o3)                         false

  Assign TeX output for an infix operator.

      (%i1) infix ("~");
      (%o1)                           ~
      (%i2) texput ("~", " \\times ", infix);
      (%o2)                        \times
      (%i3) tex (a ~ b);
      $$a \times b$$
      (%o3)                         false

  Assign TeX output for a postfix operator.

      (%i1) postfix ("##");
      (%o1)                          ##
      (%i2) texput ("##", "!!", postfix);
      (%o2)                          !!
      (%i3) tex (x ##);
      $$x!!$$
      (%o3)                         false

  Assign TeX output for a nary operator.

      (%i1) nary ("@@");
      (%o1)                          @@
      (%i2) texput ("@@", " \\circ ", nary);
      (%o2)                         \circ
      (%i3) tex (a @@ b @@ c @@ d);
      $$a \circ b \circ c \circ d$$
      (%o3)                         false

  Assign TeX output for a nofix operator.

      (%i1) nofix ("foo");
      (%o1)                          foo
      (%i2) texput ("foo", "\\mathsc{foo}", nofix);
      (%o2)                     \mathsc{foo}
      (%i3) tex (foo);
      $$\mathsc{foo}$$
      (%o3)                         false

  Assign TeX output for a matchfix operator.

      (%i1) matchfix ("<<", ">>");
      (%o1)                          <<
      (%i2) texput ("<<", [" \\langle ", " \\rangle "], matchfix);
      (%o2)                [ \langle ,  \rangle ]
      (%i3) tex (<<a>>);
      $$ \langle a \rangle $$
      (%o3)                         false
      (%i4) tex (<<a, b>>);
      $$ \langle a , b \rangle $$
      (%o4)                         false
      (%i5) texput ("<<", [" \\langle ", " \\rangle ", " \\, | \\,"],
            matchfix);
      (%o5)           [ \langle ,  \rangle ,  \, | \,]
      (%i6) tex (<<a>>);
      $$ \langle a \rangle $$
      (%o6)                         false
      (%i7) tex (<<a, b>>);
      $$ \langle a \, | \,b \rangle $$
      (%o7)                         false

  Categories: TeX output

Function: get_tex_environment (op)
Function: set_tex_environment (op, before, after)

  Customize the TeX environment output by `tex`. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

  Only the TeX environment of the top-level operator in an expression is output; TeX environments associated with other operators are ignored.

  `get_tex_environment` returns the TeX enviroment which is applied to the operator op; returns the default if no other environment has been assigned.

  `set_tex_environment` assigns the TeX environment for the operator op.

  Examples:

      (%i1) get_tex_environment (":=");
      (%o1) [
      \begin{verbatim}
      , ;
      \end{verbatim}
      ]
      (%i2) tex (f (x) := 1 - x);

      \begin{verbatim}
      f(x):=1-x;
      \end{verbatim}

      (%o2)                         false
      (%i3) set_tex_environment (":=", "$$", "$$");
      (%o3)                       [$$, $$]
      (%i4) tex (f (x) := 1 - x);
      $$f(x):=1-x$$
      (%o4)                         false

  Categories: TeX output

Function: get_tex_environment_default ()
Function: set_tex_environment_default (before, after)

  Customize the TeX environment output by `tex`. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

  `get_tex_environment_default` returns the TeX environment which is applied to expressions for which the top-level operator has no specific TeX environment (as assigned by `set_tex_environment`).

  `set_tex_environment_default` assigns the default TeX environment.

  Examples:

      (%i1) get_tex_environment_default ();
      (%o1)                       [$$, $$]
      (%i2) tex (f(x) + g(x));
      $$g\left(x\right)+f\left(x\right)$$
      (%o2)                         false
      (%i3) set_tex_environment_default ("\\begin{equation}
      ", "
      \\end{equation}");
      (%o3) [\begin{equation}
      ,
      \end{equation}]
      (%i4) tex (f(x) + g(x));
      \begin{equation}
      g\left(x\right)+f\left(x\right)
      \end{equation}
      (%o4)                         false

  Categories: TeX output

Function: system (command)

  Executes command as a separate process. The command is passed to the default shell for execution. `system` is not supported by all operating systems, but generally exists in Unix and Unix-like environments.

  Supposing `_hist.out` is a list of frequencies which you wish to plot as a bar graph using `xgraph`.

      (%i1) (with_stdout("_hist.out",
                 for i:1 thru length(hist) do (
                   print(i,hist[i]))),
             system("xgraph -bar -brw .7 -nl < _hist.out"));

  In order to make the plot be done in the background (returning control to Maxima) and remove the temporary file after it is done do:

      system("(xgraph -bar -brw .7 -nl < _hist.out;  rm -f _hist.out)&")

Option variable: ttyoff

  Default value: `false`

  When `ttyoff` is `true`, output expressions are not displayed. Output expressions are still computed and assigned labels. See `labels`.

  Text printed by built-in Maxima functions, such as error messages and the output of `describe`, is not affected by `ttyoff`.

  Categories: Display flags and variables

Function: with_stdout (f, expr_1, expr_2, expr_3, ...)
Function: with_stdout (s, expr_1, expr_2, expr_3, ...)

  Evaluates expr_1, expr_2, expr_3, ... and writes any output thus generated to a file f or output stream s. The evaluated expressions are not written to the output. Output may be generated by `print`, `display`, `grind`, among other functions.

  The global flag `file_output_append` governs whether `with_stdout` appends or truncates the output file f. When `file_output_append` is `true`, `with_stdout` appends to the output file. Otherwise, `with_stdout` truncates the output file. In either case, `with_stdout` creates the file if it does not yet exist.

  `with_stdout` returns the value of its final argument.

  See also `writefile`.

      (%i1) with_stdout ("tmp.out", for i:5 thru 10 do
            print (i, "! yields", i!))$
      (%i2) printfile ("tmp.out")$
      5 ! yields 120
      6 ! yields 720
      7 ! yields 5040
      8 ! yields 40320
      9 ! yields 362880
      10 ! yields 3628800

  Categories: File output

Function: writefile (filename)

  Begins writing a transcript of the Maxima session to filename. All interaction between the user and Maxima is then recorded in this file, just as it appears on the console.

  As the transcript is printed in the console output format, it cannot be reloaded into Maxima. To make a file containing expressions which can be reloaded, see `save` and `stringout`. `save` stores expressions in Lisp form, while `stringout` stores expressions in Maxima form.

  The effect of executing `writefile` when filename already exists depends on the underlying Lisp implementation; the transcript file may be clobbered, or the file may be appended. `appendfile` always appends to the transcript file.

  It may be convenient to execute `playback` after `writefile` to save the display of previous interactions. As `playback` displays only the input and output variables (`%i1`, `%o1`, etc.), any output generated by a print statement in a function (as opposed to a return value) is not displayed by `playback`.

  `closefile` closes the transcript file opened by `writefile` or `appendfile`.

  Categories: File output · Console interaction

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Robert Dodier on August, 11 2010 using texi2html 1.76.