This is maxima.info, produced by makeinfo version 4.0 from maxima.texi. This is a Texinfo Maxima Manual Copyright 1994,2001 William F. Schelter START-INFO-DIR-ENTRY * Maxima: (maxima). A computer algebra system. END-INFO-DIR-ENTRY  File: maxima.info, Node: Definitions for Input and Output, Prev: PLAYBACK, Up: Input and Output Definitions for Input and Output ================================ - Variable: % The last D-line computed by MACSYMA (whether or not it was printed out). (See also %%.) - Variable: %% The value of the last computation performed while in a (MACSYMA-BREAK). Also may be used in compound statements in the nth statement to refer to the value of the (n-1)th statement. E.g. F(N):=(INTEGRATE(X^N,X),SUBST(3,X,%%)-SUBST(2,X,%%)); is in essence equivalent to F(N):=BLOCK([%%], %%:INTEGRATE(X^N,X), SUBST(3,X,%%)-SUBST(2,X,%%)); This will also work for communicating between the (n-1)th and nth (non-atomic) BLOCK statements. - Variable: %EDISPFLAG default: [FALSE] - if TRUE, MACSYMA displays %E to a negative exponent as a quotient, i.e. %E^-X as 1/%E^X. - Function: %TH (i) is the ith previous computation. That is, if the next expression to be computed is D(j) this is D(j-i). This is useful in BATCH files or for referring to a group of D expressions. For example, if SUM is initialized to 0 then FOR I:1 THRU 10 DO SUM:SUM+%TH(I) will set SUM to the sum of the last ten D expressions. - special symbol: "?" - As prefix to a function or variable name, signifies that the function or variable is a LISP token, not a MACSYMA token. Two question marks typed together, ??, will flush the current MACSYMA command line. - Variable: ABSBOXCHAR default: [!] is the character used to draw absolute value signs around expressions which are more than a single line high. - Function: APPENDFILE (filename1, filename2, DSK, directory) is like WRITEFILE(DSK,directory) but appends to the file whose name is specified by the first two arguments. A subsequent CLOSEFILE will delete the original file and rename the appended file. - Function: BACKUP () To "back up" and see what you did, see PLAYBACK. - Function: BATCH (file-specification) reads in and evaluates MACSYMA command lines from a file - A facility for executing command lines stored on a disk file rather than in the usual on-line mode. This facility has several uses, namely to provide a reservoir for working command lines, for giving error-free demonstrations, or helping in organizing one's thinking in complex problem-solving situations where modifications may be done via a text editor. A batch file consists of a set of MACSYMA command lines, each with its terminating ; or $, which may be further separated by spaces, carriage- returns, form-feeds, and the like. The BATCH function calls for reading in the command lines from the file one at a time, echoing them on the user console, and executing them in turn. Control is returned to the user console only when serious errors occur or when the end of the file is met. Of course, the user may quit out of the file-processing by typing control-G at any point. BATCH files may be created using a text editor or by use of the STRINGOUT command. Do DESCRIBE(STRINGOUT) for details DESCRIBE(FILE); and DESCRIBE(FILES); have additional information on how the file argument is interpreted, and files in general. - Variable: BATCHKILL default: [FALSE] if TRUE then the effect of all previous BATCH files is nullified because a KILL(ALL) and a RESET() will be done automatically when the next one is read in. If BATCHKILL is bound to any other atom then a KILL of the value of BATCHKILL will be done. - Function: BATCHLOAD (file-specification) Batches in the file silently without terminal output or labels. - Function: BATCON (argument) continues BATCHing in a file which was interrupted. - Variable: BATCOUNT default: [0] may be set to the number of the last expression BATCHed in from a file. Thus BATCON(BATCOUNT-1) will resume BATCHing from the expression before the last BATCHed in from before. - Variable: BOTHCASES default: [TRUE] if TRUE will cause MAXIMA to retain lower case text as well as upper case. Note, however, that the names of any MAXIMA special variables or functions are in upper case. The default is now TRUE since it makes code more readable, allowing users to have names like SeriesSolve. Because of this we make the system variables and functions all upper case, and users may enter them however they like (in upper or lower). But all other variables and functions are case sensitive. When you print out your program using for example grind(fundef(f)) then you will see that the symbols like 'IF', 'SIN',... all appear in upper case whereas non system symbols appear in the case which you used. This is implemented as follows: If the symbol is being encountered for the first time, if the upper case version is in the package and has a nontrivial function or property list, then the upper case symbol is used, and it is recorded on the mixed case one, that the upper case should be used in future. If a symbol is already in the package then it is just used. In effect this means that most old programs should continue to work, and that new ones may write sIn, Sin, SIN, sin etc and they will all be interpreted as SIN. However if they write MySin this will be different from MYSIN, because MYSIN is not a system function or variable. SeriesSolve(f,x):= if (f = sin) ... and this is read as SeriesSolve(f,x):= IF (f = SIN) ... - Variable: CHANGE_FILEDEFAULTS default: [TRUE] on PDP10 systems, and FALSE elsewhere. Controls whether the user doing a LOADFILE or BATCH has his file defaults changed to the file LOADFILEd or BATCHed. The TRUE setting is for people who like DDT-style file defaulting. The FALSE setting is for people who like the conventions of other operating systems, who like LISP-style file defaulting, or who write packages which do LOADFILEs or BATCHes which should not interfere with their user's file defaults. - Function: CLOSEFILE (filename1, filename2) closes a file opened by WRITEFILE and gives it the name filename1 filename2. (On a Lisp Machine one need only say CLOSEFILE();.) Thus to save a file consisting of the display of all input and output during some part of a session with MACSYMA the user issues a WRITEFILE, transacts with MACSYMA, then issues a CLOSEFILE. The user can also issue the PLAYBACK function after a WRITEFILE to save the display of previous transactions. (Note that what is saved this way is a copy of the display of expressions not the expressions themselves). To save the actual expression in internal form the SAVE function may be used. The expression can then be brought back into MACSYMA via the LOADFILE function. To save the expression in a linear form which may then be BATCHed in later, the STRINGOUT function is used. - Function: COLLAPSE (expression) collapses" its argument 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 before using FASSAVE or after loading in a SAVE file. You can collapse several expressions together by using COLLAPSE([expr1,...,exprN])$. Similarly, you can collapse the elements of the array A by doing COLLAPSE(LISTARRAY('A))$. - Function: CONCAT (arg1, arg2, ...) evaluates its arguments and returns the concatenation of their values resulting in a name or a quoted string the type being given by that of the first argument. Thus if X is bound to 1 and D is unbound then CONCAT(X,2)="12" and CONCAT(D,X+1)=D2. - Function: SCONCAT (arg1, arg2, ...) evaluates its arguments and concatenates them into a string. Unlike CONCAT, the arguments do NOT need to be atoms. The result is a Common Lisp String. (C5) sconcat("xx[",3,"]:",expand((x+y)^3)); (D5) xx[3]:Y^3+3*X*Y^2+3*X^2*Y+X^3 The resulting string could be used in conjunction with print. - Variable: CURSORDISP default: [TRUE] If TRUE, causes expressions to be drawn by the displayer in logical sequence. This only works with a console which can do cursor movement. If FALSE, expressions are simply printed line by line. CURSORDISP is FALSE when a WRITEFILE is in effect. - Variable: DIREC - The value of this variable is the default file directory for SAVE, STORE, FASSAVE, and STRINGOUT. It is initialized to the user's login name, if he has a disk directory, and to one of the USERSi directories otherwise. DIREC determines to what directory disk files will be written. - Function: DISP (expr1,expr2, ...) 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. - Function: DISPCON (tensor1,tensor2,...) displays the contraction properties of the tensori as were given to DEFCON. DISPCON(ALL) displays all the contraction properties which were defined. - Function: DISPLAY (expr1, expr2, ...) displays equations whose left side is expri 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 the DISP function) (C1) DISPLAY(B[1,2]); 2 B = X - X 1, 2 (D1) DONE - Variable: DISPLAY2D default: [TRUE] - if set to FALSE will cause the standard display to be a string (1-dimensional) form rather than a display (2-dimensional) form. This may be of benefit for users on printing consoles who would like to conserve paper. - Variable: DISPLAY_FORMAT_INTERNAL default: [FALSE] - if set to TRUE will cause expressions to be displayed without being transformed in ways that hide the internal mathematical representation. The display then corresponds to what the INPART command returns rather than the PART command. 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 - Function: DISPTERMS (expr) displays its argument 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+...) will display P1, then below it P2, etc. When not using DISPTERMS, if an exponential expression is too wide to be displayed as A**B it will appear as EXPT(A,B) (or as NCEXPT(A,B) in the case of A^^B). - Variable: DSKALL default: [] If TRUE will cause values, functions, arrays, and rules to be written periodically onto the disk in addition to labelled expressions. TRUE is the default value whereas if DSKALL is FALSE then only labelled expresions will be written. - Variable: ERROR_SIZE default: [20 for a display terminal, 10 for others]. controls the size of error messages. For example, let U:(C^D^E+B+A)/(COS(X-1)+1); . U has an error size of 24. So if ERROR_SIZE has value < 24 then (C1) ERROR("The function", FOO,"doesn't like", U,"as input."); prints as: The function FOO doesn't like ERREXP1 as input. If ERROR_SIZE>24 then as: E D C + B + A The function FOO doesn't like -------------- as input. COS(X - 1) + 1 Expressions larger than ERROR_SIZE are replaced by symbols, and the symbols are set to the expressions. The symbols are taken from the user-settable list ERROR_SYMS:[ERREXP1,ERREXP2,ERREXP3] . The default value of this switch might change depending on user experience. If you find the defaults either too big or two small for your tastes, send mail to MACSYMA. - Variable: ERROR_SYMS default: [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, and are initially ERREXP1, ERREXP2, ERREXP3, etc. After an error message is printed, e.g. "The function FOO doesn't like ERREXP1 as input.", the user can type ERREXP1; to see the expression. ERROR_SYMS may be set by the user to a different set of symbols, if desired. - Function: EXPT (A,B) if an exponential expression is too wide to be displayed as A^B it will appear as EXPT(A,B) (or as NCEXPT(A,B) in the case of A^^B). - Variable: EXPTDISPFLAG default: [TRUE] - if TRUE, MACSYMA displays expressions with negative exponents using quotients e.g., X**(-1) as 1/X. - Function: FASSAVE (args) is similar to SAVE but produces a FASL file in which the sharing of subexpressions which are shared in core is preserved in the file created. Hence, expressions which have common subexpressions will consume less space when loaded back from a file created by FASSAVE rather than by SAVE. Files created with FASSAVE are reloaded using LOADFILE, just as files created with SAVE. FASSAVE returns a list of the form [,,...] where ... are the things saved. Warnings are printed out in the case of large files. FASSAVE may be used while a WRITEFILE is in progress. - Function: FILEDEFAULTS () returns the current default filename, in whatever format is used by the specific Macsyma implementation. (See DESCRIBE(FILE) for what that format is.) This is the file specification used by LOADFILE, BATCH, and a number of other file-accessing commands. FILEDEFAULTS('file) - sets the current filedefaults to "file". The argument to FILEDEFAULTS is evaulated as it is anticipated that the command will be used mainly in programs. The "file" need not be a real file, so one can use this function e.g. if one's real purpose is to set only the "device" field to something, where one does not care about the settings of the other fields. - Variable: FILENAME default: [] - The value of this variable is the first name of the files which are generated by the automatic disk storage scheme. The default value is the first three characters of the user's login name concatenated with the lowest unused integer, e.g. ECR1. - Function: FILENAME_MERGE ("filename1","filename2",...) ; merges together filenames. What this means is that it returns "filename1" except that missing components come from the corresponding components of "filename2", and if they are missing there, then from "filename3". - Variable: FILENUM default: [0] - The default second file name for files generated by SAVE, STRINGOUT, or FASSAVE if no file names are specified by the user. It is an integer, and is incremented by one each time a new file is written. - Variable: FILE_SEARCH - this is a list of files naming directories to search by LOAD and a number of other functions. The default value of this is a list of the various SHARE directories used by Macsyma. FILE_SEARCH("filename"); searches on those directories and devices specified by the FILE_SEARCH_LISP, FILE_SEARCH_MAXIMA and FILE_SEARCH_DEMO variables, and returns the name of the first file it finds. This function is invoked by the LOAD function, which is why LOAD("FFT") finds and loads share/fft.mac. You may add a path to the appropriate list. Note that the format of the paths allows specifying multiple extensions and multiple paths. "/home/wfs/###.{o,lisp,mac,mc}" "/home/{wfs,joe}/###.{o,lisp,mac,mc}" The '###' is replaced by the actual filename passed. File_SEARCH first checks if the actual name passed exists, before substituting it in the various patterns. - Variable: FILE_STRING_PRINT default: [FALSE] on MC, [TRUE] elsewhere. If TRUE, filenames are output as strings; if FALSE, as lists. For example, the message when an out of core file is loaded into MACSYMA (e.g. the LIMIT package), appears on MC in list format as LIMIT FASL DSK MACSYM being loaded and in string format as: DSK:MACSYM;LIMIT FASL being loaded The string format is like the top level (DDT) file specifications. - Function: FILE_TYPE ("filename") ; returns FASL, LISP, or MACSYMA, depending on what kind of file it is. FASL means a compiled Lisp file, which normally has an extension of .VAS in NIL. - Function: GRIND (arg) prints out arg in a more readable format than the STRING command. It returns a D-line as value. The GRIND switch, default: [FALSE], if TRUE will cause the STRING, STRINGOUT, and PLAYBACK commands to use "grind" mode instead of "string" mode. For PLAYBACK, "grind" mode can also be turned on (for processing input lines) by specifying GRIND as an option. - Variable: IBASE default: [10] - the base for inputting numbers. - Variable: INCHAR default: [C] - the alphabetic prefix of the names of expressions typed by the user. - Function: LDISP (expr1,expr2,...) is like DISP but also generates intermediate labels. - Function: LDISPLAY (expr1,expr2,...) is like DISPLAY but also generates intermediate labels. - Variable: LINECHAR default: [E] - the alphabetic prefix of the names of intermediate displayed expressions. - Variable: LINEDISP default: [TRUE] - Allows the use of line graphics in the drawing of equations on those systems which support them (e.g. the Lisp Machine). This can be disabled by setting LINEDISP to FALSE. It is automatically disabled during WRITEFILE. - Variable: LINEL default: [] - the number of characters which are printed on a line. It is initially set by MACSYMA to the line length of the type of terminal being used (as far as is known) but may be reset at any time by the user. The user may have to reset it in DDT with :TCTYP as well. - Function: LOAD ("filename") ; takes one argument, a filename represented as a "string" (i.e. inside quotation marks), or as list (e.g. inside square brackets), and locates and loads in the indicated file. If no directory is specified, it then searches the SHAREi directories and any other directories listed in the FILE_SEARCH variable and loads the indicated file. LOAD("EIGEN") will load the eigen package without the need for the user to be aware of the details of whether the package was compiled, translated, saved, or fassaved, i.e. LOAD will work on both LOADFILEable and BATCHable files. Note: LOAD will use BATCHLOAD if it finds the file is BATCHable (which means that it will BATCH the file in "silently" without terminal output or labels). Other MACSYMA commands to load in files are: LOADFILE, RESTORE, BATCH, and DEMO. Do DESCRIBE(command); for details. LOADFILE and RESTORE work for files written with SAVE; BATCH and DEMO for those files written with STRINGOUT or created as lists of commands with a text editor. If load can't find the file, check the value FILE_SEARCH to make sure that it contains an appropriate template. (C4) load("eigen"); MACSYMA BUG: Unknown file type NIL Error: macsyma error Error signalled by MEVAL1. Broken at $LOAD. Type :H for Help. MAXIMA>>:q By examining the file system we find the file is actually in /public/maxima/share/eigen.mc. So we add that to the file_search path. This can be done at start up (see init.lsp) or, else it can be done and then the system resaved once it has been customized for local directories and pathnames. At lisp level we would do (in-package "MAXIMA") (setq $file_search ($append (list '(mlist) "/tmp/foo.mac" "/tmp/foo.mc") $file_search)) and at maxima level: (C5) file_search:append(["/public/maxima/share/foo.mc"], file_search)$ (C6) load("eigen"); batching /usr/public/maxima/share/eigen.mc (D6) #/public/maxima/share/eigen.mc (C7) eigenvalues(matrix([a,b],[c,d])); 2 2 - SQRT(D - 2 A D + 4 B C + A ) + D + A (D7) [[---------------------------------------, 2 2 2 SQRT(D - 2 A D + 4 B C + A ) + D + A -------------------------------------], [1, 1]] 2 - Function: LOADFILE (filename) loads a file as designated by its arguments. This function may be used to bring back quantities that were stored from a prior MACSYMA session by use of the SAVE or STORE functions. Specify the pathname as on your operating system. For unix this would be "/home/wfs/foo.mc" for example. - Variable: LOADPRINT default: [TRUE] - governs the printing of messages accompanying loading of files. The following options are available: TRUE means always print the message; 'LOADFILE means print only when the LOADFILE command is used; 'AUTOLOAD means print only when a file is automatically loaded in (e.g. the integration file SIN FASL); FALSE means never print the loading message. - Function: NOSTRING (arg) displays all input lines when playing back rather than STRINGing them. If arg is GRIND then the display will be in a more readable format. One may include any number of options as in PLAYBACK([5,10],20,TIME,SLOW). - Variable: OBASE default: [10] the base for display of numbers. - Variable: OUTCHAR default: [D] - the alphabetic prefix of the names of outputted expressions. - Variable: PACKAGEFILE default:[FALSE] - Package designers who use SAVE, FASSAVE, or TRANSLATE to create packages (files) for others to use may want to set PACKAGEFILE:TRUE$ to prevent information from being added to MACSYMA'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 MACSYMA init files. - Variable: PARSEWINDOW default:[10] - the maximum number of "lexical tokens" that are printed out on each side of the error-point when a syntax (parsing) error occurs. This option is especially useful on slow terminals. Setting it to -1 causes the entire input string to be printed out when an error occurs. - Variable: PFEFORMAT default: [FALSE] - if TRUE will cause rational numbers to display in a linear form and denominators which are integers to display as rational number multipliers. - Function: PRINT (exp1, exp2, ...) evaluates and displays its arguments one after the other "on a line" starting at the leftmost position. If expi is unbound or is preceded by a single quote or is enclosed in "s then it is printed literally. For example, PRINT("THE VALUE OF X IS ",X). The value returned by PRINT is the value of its last argument. No intermediate lines are generated. (For "printing" files, see the PRINTFILE function.) - Function: SPRINT (exp1, exp2, ...) evaluates and displays its arguments one after the other "on a line" starting at the leftmost position. The numbers are printed with the '-' right next to the number, and it disregards line length. - Function: TCL_OUTPUT (LIST INDEX &optional-skip) prints a TCL list based on LIST extracting the INDEX slot. Here skip defaults to 2, meaning that every other element will be printed if the argument is of the form a list of numbers, rathter than a list of lists. For example: TCL_OUTPUT([x1,y1,x2,y2,x3,y3],1) --> {x1 x2 x3 } TCL_OUTPUT([x1,y1,x2,y2,x3,y3],2) --> {y1 y2 y3 } TCL_OUTPUT([1,2,3,4,5,6],1,3) --> {1 4} TCL_OUTPUT([1,2,3,4,5,6],2,3) --> {2 5} - Function: READ (string1, ...) prints its arguments, then reads in and evaluates one expression. For example: A:READ("ENTER THE NUMBER OF VALUES"). - Function: READONLY (string1,...) prints its arguments, then reads in an expression (which in contrast to READ is not evaluated). - Function: REVEAL (exp,depth) will display exp to the specified integer depth with the length of each part indicated. Sums will be displayed as Sum(n) and products as Product(n) where n is the number of subparts of the sum or product. Exponentials will be displayed as Expt. (C1) INTEGRATE(1/(X^3+2),X)$ (C2) REVEAL(%,2); (D2) Negterm + Quotient + Quotient (C3) REVEAL(D1,3); ATAN LOG (D3) - Quotient + ---------- + ---------- Product(2) Product(2) - Variable: RMXCHAR default: []] - The character used to display the (right) delimiter of a matrix (see also LMXCHAR). - Function: SAVE (filename,arg1, arg2,...,argi) saves quantities described by its arguments on disk and keeps them in core also. The arg's are the expressions to be SAVEd. ALL is the simplest, but note that saving ALL will save the entire contents of your MACSYMA, which in the case of a large computation may result in a large file. VALUES, FUNCTIONS, or any other items on the INFOLISTS (do DESCRIBE(INFOLISTS); for the list) may be SAVEd, as may functions and variables by name. C and D lines may also be saved, but it is better to give them explicit names, which may be done in the command line, e.g. SAVE(RES1=D15); Files saved with SAVE should be reloaded with LOADFILE. SAVE returns the pathname where the items were saved. - Variable: SAVEDEF default: [TRUE] - if TRUE will cause the MACSYMA version of a user function to remain when the function is TRANSLATEd. This permits the definition to be displayed by DISPFUN and allows the function to be edited. If SAVEDEF is FALSE, the names of translated functions are removed from the FUNCTIONS list. - Function: SHOW (exp) will display exp with the indexed objects in it shown having covariant indices as subscripts,contravariant indices as superscripts. The derivative indices will be displayed as subscripts, separated from the covariant indices by a comma. - Function: SHOWRATVARS (exp) returns a list of the RATVARS (CRE variables) of exp. - Variable: STARDISP default: [FALSE] - if TRUE will cause multiplication to be displayed explicitly with an * between operands. - Function: STRING (expr) converts expr to MACSYMA's linear notation (similar to FORTRAN's) just as if it had been typed in and puts expr into the buffer for possible editing (in which case expr is usually Ci) The STRING'ed expression should not be used in a computation. - Function: STRINGOUT (args) will output an expression to a file in a linear format. Such files are then used by the BATCH or DEMO commands. STRINGOUT(file-specification, A1, A2, ...) outputs to a file given by file-specification ([filename1,filename2,DSK, directory]) the values given by A1,A2,.. in a MACSYMA readable format. The file-specification may be omitted, in which case the default values will be used. The Ai are usually C labels or may be INPUT meaning the value of all C labels. Another option is to make ai FUNCTIONS which will cause all of the user's function definitions to be strungout (i.e. all those retrieved by DISPFUN(ALL)). Likewise the ai may be VALUES, and all the variables to which the user has assigned values will be strungout. ai may also be a list [m,n] which means to stringout all labels in the range m through n inclusive. This function may be used to create a file of FORTRAN statements by doing some simple editing on the strungout expressions. If the GRIND switch is set to TRUE, then STRINGOUT will use GRIND format instead of STRING format. Note: a STRINGOUT may be done while a WRITEFILE is in progress. - Function: TEX (expr) - Function: TEX(expr,filename) - Function: TEX(label,filename) In the case of a label, a left-equation-number will be produced. in case a file-name is supplied, the output will be appended to the file. (C1) integrate(1/(1+x^3),x); 2 x - 1 2 ATAN(-------) LOG(x - x + 1) SQRT(3) LOG(x + 1) (D1) - --------------- + ------------- + ---------- 6 SQRT(3) 3 (C2) tex(d1); $$-{{\log \left(x^{2}-x+1\right)}\over{6}}+{{\arctan {{2\>x-1}\over{ \sqrt{3}}}}\over{\sqrt{3}}}+{{\log \left(x+1\right)}\over{3}}\leqno{\tt (D1)}$$ (D2) (D1) (C6) tex(integrate(sin(x),x)); $$-\cos x$$ (D6) FALSE (C7) tex(d1,"/tmp/jo.tex"); (D7) (D1) where the last expression will be appended to the file `/tmp/jo.tex' - Function: SYSTEM(command) Execute COMMAND as a subprocess. The command will be passed to the default shell for execution. System is not supported by all operating systems, but generally exists in the unix environment. if hist is a list of frequencies which you wish to plot as a bar graph using xgraph. (C1) (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)&") - Variable: TTYOFF default: [FALSE] - if TRUE stops printing output to the console. - macro: WITH_STDOUT(file,stmt1,stmt2,...) Opens file and then evaluates stmt1, stmt2, .... Any printing to standard output goes to the file instead of the terminal. It always returns FALSE. Note the binding of display2d to be false, otherwise the printing will have things like "- 3" instead of "-3". mygnuplot(f,var,range,number_ticks):= block([numer:true,display2d:false], with_stdout("/tmp/gnu", for x:range[1] thru range[2] step (range[2]-range[1])/number_ticks do (print(x,at(f,var=x)))), system("echo \"set data style lines; set title '", f,"' ;plot '/tmp/gnu' ;pause 10 \" | gnuplot")); (C8) with_stdout("/home/wfs/joe", n:10, for i:8 thru n do(print("factorial(",i,") gives ",i!))); (D8) FALSE (C9) system("cat /home/wfs/joe"); factorial( 8 ) gives 40320 factorial( 9 ) gives 362880 factorial( 10 ) gives 3628800 (D9) 0 - Function: WRITEFILE (DSK, directory) opens up a file for writing. On a Lisp Machine one uses WRITEFILE("filename"). All interaction between the user and MACSYMA is then recorded in this file, just as it is on the console. Such a file is a transcript of the session, and is not reloadable or batchable into MACSYMA again. (See also CLOSEFILE.)  File: maxima.info, Node: Floating Point, Next: Contexts, Prev: Input and Output, Up: Top Floating Point ************** * Menu: * Definitions for Floating Point::  File: maxima.info, Node: Definitions for Floating Point, Prev: Floating Point, Up: Floating Point Definitions for Floating Point ============================== - Function: BFFAC (exp,n) BFLOAT version of the Factorial (shifted Gamma) function. The 2nd argument is how many digits to retain and return, it's a good idea to request a couple of extra. This function is available by doing LOAD(BFFAC); . - Variable: ALGEPSILON The default value is 10^-8. The value of ALGEPSILON is used by ALGSYS. - Function: BFLOAT (X) converts all numbers and functions of numbers to bigfloat numbers. Setting FPPREC[16] to N, sets the bigfloat precision to N digits. If FLOAT2BF[FALSE] is FALSE a warning message is printed when a floating point number is converted into a bigfloat number (since this may lead to loss of precision). - Function: BFLOATP (exp) is TRUE if exp is a bigfloat number else FALSE. - Function: BFPSI (n,z,fpprec) gives polygammas of real arg and integer order. For digamma, BFPSI0(z,fpprec) is more direct. Note -BFPSI0(1,fpprec) provides BFLOATed %GAMMA. To use this do LOAD(BFFAC); - Variable: BFTORAT default: [FALSE] controls the conversion of bfloats to rational numbers. If BFTORAT:FALSE RATEPSILON will be used to control the conversion (this results in relatively small rational numbers). If BFTORAT:TRUE , the rational number generated will accurately represent the bfloat. - Variable: BFTRUNC default: [TRUE] causes trailing zeroes in non-zero bigfloat numbers not to be displayed. Thus, if BFTRUNC:FALSE, BFLOAT(1); displays as 1.000000000000000B0. Otherwise, this is displayed as 1.0B0. - Function: CBFAC (z,fpprec) a factorial for complex bfloats. It may be used by doing LOAD(BFAC); For more details see share2/bfac.usg. - Function: FLOAT (exp) converts integers, rational numbers and bigfloats in exp to floating point numbers. It is also an EVFLAG, FLOAT causes non-integral rational numbers and bigfloat numbers to be converted to floating point. - Variable: FLOAT2BF default: [FALSE] if FALSE, a warning message is printed when a floating point number is converted into a bigfloat number (since this may lead to loss of precision). - Function: FLOATDEFUNK - is a utility for making floating point functions from mathematical expression. It will take the input expression and FLOAT it, then OPTIMIZE it, and then insert MODE_DECLAREations for all the variables. This is THE way to use ROMBERG, PLOT2, INTERPOLATE, etc. e.g. EXP:some-hairy-macsyma-expression; FLOATDEFUNK('F,['X],EXP); will define the function F(X) for you. (Do PRINTFILE(MCOMPI,DOC,MAXDOC); for more details.) - Function: FLOATNUMP (exp) is TRUE if exp is a floating point number else FALSE. - Variable: FPPREC default: [16] - Floating Point PRECision. Can be set to an integer representing the desired precision. - Variable: FPPRINTPREC default: [0] - The number of digits to print when printing a bigfloat number, making it possible to compute with a large number of digits of precision, but have the answer printed out with a smaller number of digits. If FPPRINTPREC is 0 (the default), or >= FPPREC, then the value of FPPREC controls the number of digits used for printing. However, if FPPRINTPREC has a value between 2 and FPPREC-1, then it controls the number of digits used. (The minimal number of digits used is 2, one to the left of the point and one to the right. The value 1 for FPPRINTPREC is illegal.) - Function: ?ROUND (x,&optional-divisor) round the floating point X to the nearest integer. The argument must be a regular system float, not a bigfloat. The ? beginning the name indicates this is normal common lisp function. (C3) ?round(-2.8); (D3) - 3 - Function: ?TRUNCATE (x,&optional-divisor) truncate the floating point X towards 0, to become an integer. The argument must be a regular system float, not a bigfloat. The ? beginning the name indicates this is normal common lisp function. (C4) ?truncate(-2.8); (D4) - 2 (C5) ?truncate(2.4); (D5) 2 (C6) ?truncate(2.8); (D6) 2 - Variable: ZUNDERFLOW default: [TRUE] - if FALSE, an error will be signaled if floating point underflow occurs. Currently in NIL Macsyma, all floating-point underflow, floating-point overflow, and division-by-zero errors signal errors, and this switch is ignored.  File: maxima.info, Node: Contexts, Next: Polynomials, Prev: Floating Point, Up: Top Contexts ******** * Menu: * Definitions for Contexts::  File: maxima.info, Node: Definitions for Contexts, Prev: Contexts, Up: Contexts Definitions for Contexts ======================== - Function: ACTIVATE (cont1, cont2, ...) causes the specified contexts conti to be activated. The facts in these contexts are used in making deductions and retrieving information. The facts in these contexts are not listed when FACTS(); is done. The variable ACTIVECONTEXTS is the list of contexts which are active by way of the ACTIVATE function. - Variable: ACTIVECONTEXTS default: [] is a list of the contexts which are active by way of the ACTIVATE function, as opposed to being active because they are subcontexts of the current context. - Function: ASSUME (pred1, pred2, ...) First checks the specified predicates for redundancy and consistency with the current data base. If the predicates are consistent and non-redundant, they are added to the data base; if inconsistent or redundant, no action is taken. ASSUME returns a list whose entries are the predicates added to the data base and the atoms REDUNDANT or INCONSISTENT where applicable. - Variable: ASSUMESCALAR default: [TRUE] - helps govern whether expressions `exp' for which NONSCALARP(exp) is FALSE are assumed to behave like scalars for certain transformations as follows: Let `exp' represent any non-list/non-matrix, and `[1,2,3]' any list or matrix. exp.[1,2,3]; ==> [exp,2*exp,3*exp] if ASSUMESCALAR is TRUE or SCALARP(exp) is TRUE or CONSTANTP(exp) is TRUE. If ASSUMESCALAR is TRUE, such expressions will behave like scalars only for the commutative operators, but not for ".". If ASSUMESCALAR is FALSE, such expressions will behave like non-scalars. If ASSUMESCALAR is ALL, such expressions will behave like scalars for all the operators listed above. - Variable: ASSUME_POS default:[FALSE] - When using INTEGRATE, etc. one often introduces parameters which are real and positive or one's calculations can often be constructed so that this is true. There is a switch ASSUME_POS (default FALSE) such that if set to TRUE, MACSYMA will assume one's parameters are positive. The intention here is to cut down on the number of questions MACSYMA needs to ask. Obviously, ASSUME information or any contextual information present will take precedence. The user can control what is considered to be a parameter for this purpose. Parameters by default are those which satisfy SYMBOLP(x) OR SUBVARP(x). The user can change this by setting the option ASSUME_POS_PRED [default FALSE] to the name of a predicate function of one argument. E.g. if you want only symbols to be parameters, you can do ASSUME_POS:TRUE$ ASSUME_POS_PRED:'SYMBOLP$ SIGN(A); -> POS, SIGN(A[1]); -> PNZ. - Variable: ASSUME_POS_PRED default:[FALSE] - may be set to one argument to control what will be considered a parameter for the "assumptions" that INTEGRATE will make... see ASSUME and ASSUME_POS . - Variable: CONTEXT default: INITIAL. Whenever a user assumes a new fact, it is placed in the context named as the current value of the variable CONTEXT. Similarly, FORGET references the current value of CONTEXT. To change contexts, simply bind CONTEXT to the desired context. If the specified context does not exist it will be created by an invisible call to NEWCONTEXT. The context specified by the value of CONTEXT is automatically activated. (Do DESCRIBE(CONTEXTS); for a general description of the CONTEXT mechanism.) - Variable: CONTEXTS default: [INITIAL,GLOBAL] is a list of the contexts which currently exist, including the currently active context. The context mechanism makes it possible for a user to bind together and name a selected portion of his data base, called a context. Once this is done, the user can have MACSYMA assume or forget large numbers of facts merely by activating or deactivating their context. Any symbolic atom can be a context, and the facts contained in that context will be retained in storage until the user destroys them individually by using FORGET or destroys them as a whole by using KILL to destroy the context to which they belong. Contexts exist in a formal hierarchy, with the root always being the context GLOBAL, which contains information about MACSYMA that some functions need. When in a given context, all the facts in that context are "active" (meaning that they are used in deductions and retrievals) as are all the facts in any context which is an inferior of that context. When a fresh MACSYMA is started up, the user is in a context called INITIAL, which has GLOBAL as a subcontext. The functions which deal with contexts are: FACTS, NEWCONTEXT, SUPCONTEXT, KILLCONTEXT, ACTIVATE, DEACTIVATE, ASSUME, and FORGET. - Function: DEACTIVATE (cont1, cont2, ...) causes the specified contexts conti to be deactivated. - Function: FACTS (item) If 'item' is the name of a context then FACTS returns a list of the facts in the specified context. If no argument is given, it lists the current context. If 'item' is not the name of a context then it returns a list of the facts known about 'item' in the current context. Facts that are active, but in a different context, are not listed. - declaration: FEATURES - MACSYMA has built-in properties which are handled by the data base. These are called FEATURES. One can do DECLARE(N,INTEGER), etc. One can also DECLARE one's own FEATURES by e.g. DECLARE( INCREASING, FEATURE); which will then allow one to say DECLARE(F, INCREASING);. One can then check if F is INCREASING by using the predicate FEATUREP via FEATUREP(F, INCREASING). There is an infolist FEATURES which is a list of known FEATURES. At present known FEATURES are: INTEGER, NONINTEGER, EVEN, ODD, RATIONAL, IRRATIONAL, REAL, IMAGINARY, COMPLEX, ANALYTIC, INCREASING, DECREASING, ODDFUN, EVENFUN, POSFUN, COMMUTATIVE, LASSOCIATIVE, RASSOCIATIVE, SYMMETRIC, and ANTISYMMETRIC. [Note: system "features" may be checked with STATUS(FEATURE, ...); See DESCRIBE(STATUS); or DESCRIBE(FEATURE); for details.] - Function: FORGET (pred1, pred2, ...) removes relations established by ASSUME. The predicates may be expressions equivalent to (but not necessarily identical to) those previously ASSUMEd. FORGET(list) is also a legal form. - Function: KILLCONTEXT (context1,context2,...,contextn) kills the specified contexts. If one of them is the current context, the new current context will become the first available subcontext of the current context which has not been killed. If the first available unkilled context is GLOBAL then INITIAL is used instead. If the INITIAL context is killed, a new INITIAL is created, which is empty of facts. KILLCONTEXT doesn't allow the user to kill a context which is currently active, either because it is a subcontext of the current context, or by use of the function ACTIVATE. - Function: NEWCONTEXT (name) creates a new (empty) context, called name, which has GLOBAL as its only subcontext. The new context created will become the currently active context. - Function: SUPCONTEXT (name,context) will create a new context (called name) whose subcontext is context. If context is not specified, the current context will be assumed. If it is specified, context must exist.  File: maxima.info, Node: Polynomials, Next: Constants, Prev: Contexts, Up: Top Polynomials *********** * Menu: * Introduction to Polynomials:: * Definitions for Polynomials::  File: maxima.info, Node: Introduction to Polynomials, Next: Definitions for Polynomials, Prev: Polynomials, Up: Polynomials Introduction to Polynomials =========================== Polynomials are stored in maxima either in General Form or as Cannonical Rational Expressions (CRE) form. The latter is a standard form, and is used internally by operations such as factor, ratsimp, and so on. Canonical Rational Expressions constitute a kind of representation which is especially suitable for expanded polynomials and rational functions (as well as for partially factored polynomials and rational functions when RATFAC[FALSE] is set to TRUE). In this CRE form an ordering of variables (from most to least main) is assumed for each expression. Polynomials are represented recursively by a list consisting of the main variable followed by a series of pairs of expressions, one for each term of the polynomial. The first member of each pair is the exponent of the main variable in that term and the second member is the coefficient of that term which could be a number or a polynomial in another variable again represented in this form. Thus the principal part of the CRE form of 3*X^2-1 is (X 2 3 0 -1) and that of 2*X*Y+X-3 is (Y 1 (X 1 2) 0 (X 1 1 0 -3)) assuming Y is the main variable, and is (X 1 (Y 1 2 0 1) 0 -3) assuming X is the main variable. "Main"-ness is usually determined by reverse alphabetical order. The "variables" of a CRE expression needn't be atomic. In fact any subexpression whose main operator is not + - * / or ^ with integer power will be considered a "variable" of the expression (in CRE form) in which it occurs. For example the CRE variables of the expression X+SIN(X+1)+2*SQRT(X)+1 are X, SQRT(X), and SIN(X+1). If the user does not specify an ordering of variables by using the RATVARS function MACSYMA will choose an alphabetic one. In general, CRE's represent rational expressions, that is, ratios of polynomials, where the numerator and denominator have no common factors, and the denominator is positive. The internal form is essentially a pair of polynomials (the numerator and denominator) preceded by the variable ordering list. If an expression to be displayed is in CRE form or if it contains any subexpressions in CRE form, the symbol /R/ will follow the line label. See the RAT function for converting an expression to CRE form. An extended CRE form is used for the representation of Taylor series. The notion of a rational expression is extended so that the exponents of the variables can be positive or negative rational numbers rather than just positive integers and the coefficients can themselves be rational expressions as described above rather than just polynomials. These are represented internally by a recursive polynomial form which is similar to and is a generalization of CRE form, but carries additional information such as the degree of truncation. As with CRE form, the symbol /T/ follows the line label of such expressions.