This is maxima.info, produced by makeinfo version 4.7 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: Top, Next: Introduction to Maxima, Prev: (dir), Up: (dir) Maxima Manual ************* Maxima is a computer algebra system, implemented in Lisp. Maxima is derived from the Macsyma system, developed at MIT in the years 1968 through 1982 as part of Project MAC. MIT turned over a copy of the Macsyma source code to the Department of Energy in 1982; that version is now known as DOE Macsyma. A copy of DOE Macsyma was maintained by Professor William F. Schelter of the University of Texas from 1982 until his death in 2001. In 1998, Schelter obtained permission from the Department of Energy to release the DOE Macsyma source code under the GNU Public License, and in 2000 he initiated the Maxima project at SourceForge to maintain and develop DOE Macsyma, now called Maxima. * Menu: Maxima infrastructure * Introduction to Maxima:: Sample Maxima sessions. * Bug Detection and Reporting:: Finding and reporting bugs in Maxima. * Help:: Asking for help from within a Maxima session. * Command Line:: Maxima command line syntax. * Operators:: Operators used in Maxima expressions. * Expressions:: Expressions in Maxima. * Simplification:: Simplifying expressions. * Plotting:: 2D and 3D graphical output. * Input and Output:: File input and output. * Floating Point:: Low level numerical routines. * Contexts:: Sets of assumed facts. Support for specific areas of mathematics * Polynomials:: Standard forms for polynomials, and functions operating on them. * Constants:: Numerical constants. * Logarithms:: Manipulation of expressions involving logarithms. * Trigonometric:: Manipulating expressions with trig and inverse trig functions. * Special Functions:: Special functions * Elliptic Functions:: Elliptic Functions and Integrals * Limits:: Limits of expressions. * Differentiation:: Differential calculus. * Integration:: Integral calculus. * Equations:: Defining and solving equations. * Differential Equations:: Defining and solving differential equations. * Numerical:: Numerical integration, Fourier transforms, etc. * Arrays:: Creating and working with arrays. * Matrices and Linear Algebra:: Matrix operations. * Affine:: * itensor:: Indicial Tensor Manipulation. * ctensor:: Component Tensor Manipulation. * atensor:: Algebraic Tensor Manipulation. * Series:: Taylor and power series. * Number Theory:: Number theory. * Symmetries:: * Groups:: Abstract algebra. Advanced facilities and programming * Runtime Environment:: Customization of the Maxima environment. * Miscellaneous Options:: Options with a global effect on Maxima. * Rules and Patterns:: User defined pattern matching and simplification rules. * Lists:: Manipulation of lists. * Sets:: Manipulation of sets. * Function Definition:: Defining functions. * Program Flow:: Defining Maxima programs. * Debugging:: Debugging Maxima programs. Additional packages * augmented_lagrangian:: augmented_lagrangian package. * bode:: Bode gain and phase plots. * contrib_ode:: Additional routines for ODEs * descriptive:: Descriptive statistics. * diag:: Jordan matrices. * distrib:: Probability distributions. * draw:: A Maxima-Gnuplot interface. * dynamics:: Graphics for dynamical systems and fractals. * eval_string:: Maxima expressions as strings. * f90:: Maxima to fortran translator. * ggf:: Generating function of sequences. * grobner:: Functions for working with Groebner bases. * impdiff:: Implicit derivatives. * implicit_plot:: Implicit plots package. * interpol:: Interpolation package. * lbfgs:: L-BFGS unconstrained minimization package. * lindstedt:: Lindstedt package. * linearalgebra:: Functions for linear algebra. * lsquares:: Least squares. * makeOrders:: Polynomial utility. * mnewton:: Newton's method. * numericalio:: Reading and writing files. * opsubst:: Substitutions utility. * orthopoly:: Orthogonal polynomials. * plotdf:: Direction fields plots. * romberg:: Romberg method for numerical integration. * simplex:: Linear programming. * simplification:: Simplification rules and functions. * solve_rec:: Linear recurrences. * stats:: Statistical inference package. * stirling:: Stirling formula. * stringproc:: String processing. * unit:: Units and dimensions package. * zeilberger:: Functions for hypergeometric summation. Index * Function and Variable Index:: Index. --- The Detailed Node Listing --- Introduction * Introduction to Maxima:: Help * Lisp and Maxima:: * Garbage Collection:: * Documentation:: * Functions and Variables for Help:: Command Line * Introduction to Command Line:: * Functions and Variables for Command Line:: Operators * nary:: * nofix:: * postfix:: * prefix:: * Arithmetic operators:: * Relational operators:: * General operators:: Expressions * Introduction to Expressions:: * Assignment:: * Complex:: * Inequality:: * Syntax:: * Functions and Variables for Expressions:: Simplification * Functions and Variables for Simplification:: Plotting * Functions and Variables for Plotting:: Input and Output * Comments:: * Files:: * Functions and Variables for Input and Output:: Floating Point * Functions and Variables for Floating Point:: Contexts * Functions and Variables for Contexts:: Polynomials * Introduction to Polynomials:: * Functions and Variables for Polynomials:: Constants * Functions and Variables for Constants:: Logarithms * Functions and Variables for Logarithms:: Trigonometric * Introduction to Trigonometric:: * Functions and Variables for Trigonometric:: Special Functions * Introduction to Special Functions:: * Functions and Variables for Special Functions:: Elliptic Functions * Introduction to Elliptic Functions and Integrals:: * Functions and Variables for Elliptic Functions:: * Functions and Variables for Elliptic Integrals:: Limits * Functions and Variables for Limits:: Differentiation * Functions and Variables for Differentiation:: Integration * Introduction to Integration:: * Functions and Variables for Integration:: Equations * Functions and Variables for Equations:: Differential Equations * Introduction to Differential Equations:: * Functions and Variables for Differential Equations:: Numerical * Introduction to Numerical:: * Fourier packages:: * Functions and Variables for Numerical:: * Functions and Variables for Fourier Series:: Arrays * Functions and Variables for Arrays:: Matrices and Linear Algebra * Introduction to Matrices and Linear Algebra:: * Dot:: * Vectors:: * eigen:: * Functions and Variables for Matrices and Linear Algebra:: Affine * Functions and Variables for Affine:: itensor * Introduction to itensor:: * Functions and Variables for itensor:: ctensor * Introduction to ctensor:: * Functions and Variables for ctensor:: atensor * Introduction to atensor:: * Functions and Variables for atensor:: Series * Introduction to Series:: * Functions and Variables for Series:: Number Theory * Functions and Variables for Number Theory:: Symmetries * Functions and Variables for Symmetries:: Groups * Functions and Variables for Groups:: Runtime Environment * Introduction for Runtime Environment:: * Interrupts:: * Functions and Variables for Runtime Environment:: Miscellaneous Options * Introduction to Miscellaneous Options:: * Share:: * Functions and Variables for Miscellaneous Options:: Rules and Patterns * Introduction to Rules and Patterns:: * Functions and Variables for Rules and Patterns:: Lists * Introduction to Lists:: * Functions and Variables for Lists:: Sets * Introduction to Sets:: * Functions and Variables for Sets:: Function Definition * Introduction to Function Definition:: * Function:: * Macros:: * Functions and Variables for Function Definition:: Program Flow * Introduction to Program Flow:: * Functions and Variables for Program Flow:: Debugging * Functions and Variables for Debugging:: augmented_lagrangian * Functions and Variables for augmented_lagrangian:: bode * Functions and Variables for bode:: contrib_ode * Introduction to contrib_ode:: * Functions and Variables for contrib_ode:: * Possible improvements to contrib_ode:: * Test cases for contrib_ode:: * References for contrib_ode:: descriptive * Introduction to descriptive:: * Functions and Variables for data manipulation:: * Functions and Variables for descriptive statistics:: * Functions and Variables for specific multivariate descriptive statistics:: * Functions and Variables for statistical graphs:: diag * Functions and Variables for diag:: distrib * Introduction to distrib:: * Functions and Variables for continuous distributions:: * Functions and Variables for discrete distributions:: draw * Introduction to draw:: * Functions and Variables for draw:: * Functions and Variables for pictures:: * Functions and Variables for worldmap:: dynamics * Introduction to dynamics:: * Functions and Variables for dynamics:: eval_string * Functions and Variables for eval_string:: f90 * Functions and Variables for f90:: ggf * Functions and Variables for ggf:: grobner * Introduction to grobner:: * Functions and Variables for grobner:: impdiff * Functions and Variables for impdiff:: implicit_plot * Functions and Variables for implicit_plot:: interpol * Introduction to interpol:: * Functions and Variables for interpol:: lbfgs * Introduction to lbfgs:: * Functions and Variables for lbfgs:: lindstedt * Functions and Variables for lindstedt:: linearalgebra * Introduction to linearalgebra:: * Functions and Variables for linearalgebra:: lsquares * Functions and Variables for lsquares:: makeOrders * Functions and Variables for makeOrders:: mnewton * Functions and Variables for mnewton:: numericalio * Introduction to numericalio:: * Functions and Variables for numericalio:: opsubst * Functions and Variables for opsubst:: orthopoly * Introduction to orthogonal polynomials:: * Functions and Variables for orthogonal polynomials:: plotdf * Introduction to plotdf:: * Functions and Variables for plotdf:: romberg * Functions and Variables for romberg:: simplex * Introduction to simplex:: * Functions and Variables for simplex:: simplification * Introduction to simplification:: * Functions and Variables for simplification:: solve_rec * Introduction to solve_rec:: * Functions and Variables for solve_rec:: stats * Introduction to stats:: * Functions and Variables for inference_result:: * Functions and Variables for stats:: * Functions and Variables for special distributions:: stirling * Functions and Variables for stirling:: stringproc * Introduction to string processing:: * Functions and Variables for input and output:: * Functions and Variables for characters:: * Functions and Variables for strings:: unit * Introduction to Units:: * Functions and Variables for Units:: zeilberger * Introduction to zeilberger:: * Functions and Variables for zeilberger::  File: maxima.info, Node: Introduction to Maxima, Next: Bug Detection and Reporting, Prev: Top, Up: Top 1 Introduction to Maxima ************************ Start Maxima with the command "maxima". Maxima will display version information and a prompt. End each Maxima command with a semicolon. End the session with the command "quit();". Here's a sample session: [wfs@chromium]$ maxima Maxima 5.9.1 http://maxima.sourceforge.net Using Lisp CMU Common Lisp 19a Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) factor(10!); 8 4 2 (%o1) 2 3 5 7 (%i2) expand ((x + y)^6); 6 5 2 4 3 3 4 2 5 6 (%o2) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i3) factor (x^6 - 1); 2 2 (%o3) (x - 1) (x + 1) (x - x + 1) (x + x + 1) (%i4) quit(); [wfs@chromium]$ Maxima can search the info pages. Use the `describe' command to show information about the command or all the commands and variables containing a string. The question mark `?' (exact search) and double question mark `??' (inexact search) are abbreviations for `describe': (%i1) ?? integ 0: Functions and Variables for Elliptic Integrals 1: Functions and Variables for Integration 2: Introduction to Elliptic Functions and Integrals 3: Introduction to Integration 4: askinteger (Functions and Variables for Simplification) 5: integerp (Functions and Variables for Miscellaneous Options) 6: integer_partitions (Functions and Variables for Sets) 7: integrate (Functions and Variables for Integration) 8: integrate_use_rootsof (Functions and Variables for Integration) 9: integration_constant_counter (Functions and Variables for Integration) 10: nonnegintegerp (Functions and Variables for linearalgebra) Enter space-separated numbers, `all' or `none': 5 4 -- Function: integerp () Returns `true' if is a literal numeric integer, otherwise `false'. `integerp' returns false if its argument is a symbol, even if the argument is declared integer. Examples: (%i1) integerp (0); (%o1) true (%i2) integerp (1); (%o2) true (%i3) integerp (-17); (%o3) true (%i4) integerp (0.0); (%o4) false (%i5) integerp (1.0); (%o5) false (%i6) integerp (%pi); (%o6) false (%i7) integerp (n); (%o7) false (%i8) declare (n, integer); (%o8) done (%i9) integerp (n); (%o9) false -- Function: askinteger (, integer) -- Function: askinteger () -- Function: askinteger (, even) -- Function: askinteger (, odd) `askinteger (, integer)' attempts to determine from the `assume' database whether is an integer. `askinteger' prompts the user if it cannot tell otherwise, and attempt to install the information in the database if possible. `askinteger ()' is equivalent to `askinteger (, integer)'. `askinteger (, even)' and `askinteger (, odd)' likewise attempt to determine if is an even integer or odd integer, respectively. (%o1) true To use a result in later calculations, you can assign it to a variable or refer to it by its automatically supplied label. In addition, `%' refers to the most recent calculated result: (%i1) u: expand ((x + y)^6); 6 5 2 4 3 3 4 2 5 6 (%o1) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i2) diff (u, x); 5 4 2 3 3 2 4 5 (%o2) 6 y + 30 x y + 60 x y + 60 x y + 30 x y + 6 x (%i3) factor (%o2); 5 (%o3) 6 (y + x) Maxima knows about complex numbers and numerical constants: (%i1) cos(%pi); (%o1) - 1 (%i2) exp(%i*%pi); (%o2) - 1 Maxima can do differential and integral calculus: (%i1) u: expand ((x + y)^6); 6 5 2 4 3 3 4 2 5 6 (%o1) y + 6 x y + 15 x y + 20 x y + 15 x y + 6 x y + x (%i2) diff (%, x); 5 4 2 3 3 2 4 5 (%o2) 6 y + 30 x y + 60 x y + 60 x y + 30 x y + 6 x (%i3) integrate (1/(1 + x^3), x); 2 x - 1 2 atan(-------) log(x - x + 1) sqrt(3) log(x + 1) (%o3) - --------------- + ------------- + ---------- 6 sqrt(3) 3 Maxima can solve linear systems and cubic equations: (%i1) linsolve ([3*x + 4*y = 7, 2*x + a*y = 13], [x, y]); 7 a - 52 25 (%o1) [x = --------, y = -------] 3 a - 8 3 a - 8 (%i2) solve (x^3 - 3*x^2 + 5*x = 15, x); (%o2) [x = - sqrt(5) %i, x = sqrt(5) %i, x = 3] Maxima can solve nonlinear sets of equations. Note that if you don't want a result printed, you can finish your command with `$' instead of `;'. (%i1) eq_1: x^2 + 3*x*y + y^2 = 0$ (%i2) eq_2: 3*x + y = 1$ (%i3) solve ([eq_1, eq_2]); 3 sqrt(5) + 7 sqrt(5) + 3 (%o3) [[y = - -------------, x = -----------], 2 2 3 sqrt(5) - 7 sqrt(5) - 3 [y = -------------, x = - -----------]] 2 2 Maxima can generate plots of one or more functions: (%i1) eq_1: x^2 + 3*x*y + y^2 = 0$ (%i2) eq_2: 3*x + y = 1$ (%i3) solve ([eq_1, eq_2]); 3 sqrt(5) + 7 sqrt(5) + 3 (%o3) [[y = - -------------, x = -----------], 2 2 3 sqrt(5) - 7 sqrt(5) - 3 [y = -------------, x = - -----------]] 2 2 (%i4) kill(labels); (%o0) done (%i1) plot2d (sin(x)/x, [x, -20, 20]); (%o1) (%i2) plot2d ([atan(x), erf(x), tanh(x)], [x, -5, 5]); (%o2) (%i3) plot3d (sin(sqrt(x^2 + y^2))/sqrt(x^2 + y^2), [x, -12, 12], [y, -12, 12]); (%o3)  File: maxima.info, Node: Bug Detection and Reporting, Next: Help, Prev: Introduction to Maxima, Up: Top 2 Bug Detection and Reporting ***************************** * Menu: * Functions and Variables for Bug Detection and Reporting::  File: maxima.info, Node: Functions and Variables for Bug Detection and Reporting, Up: Bug Detection and Reporting 2.1 Functions and Variables for Bug Detection and Reporting =========================================================== -- Function: run_testsuite () -- Function: run_testsuite () -- Function: run_testsuite (, ) -- Function: run_testsuite (, , ) Run the Maxima test suite. Tests producing the desired answer are considered "passes," as are tests that do not produce the desired answer, but are marked as known bugs. `run_testsuite ()' displays only tests that do not pass. `run_testsuite (true)' displays tests that are marked as known bugs, as well as failures. `run_testsuite (true, true)' displays all tests. If the optional third argument is given, a subset of the tests is run. The subset of the tests to run is given as a list of the names of the tests. The complete set of tests is specified by `testsuite_files'. `run_testsuite' changes the Maxima environment. Typically a test script executes `kill' to establish a known environment (namely one without user-defined functions and variables) and then defines functions and variables appropriate to the test. `run_testsuite' returns `done'. -- Option variable: testsuite_files `testsuite_files' is the set of tests to be run by `run_testsuite'. It is a list of names of the files containing the tests to run. If some of the tests in a file are known to fail, then instead of listing the name of the file, a list containing the file name and the test numbers that fail is used. For example, this is a part of the default set of tests: ["rtest13s", ["rtest14", 57, 63]] This specifies the testsuite consists of the files "rtest13s" and "rtest14", but "rtest14" contains two tests that are known to fail: 57 and 63. -- Function: bug_report () Prints out Maxima and Lisp version numbers, and gives a link to the Maxima project bug report web page. The version information is the same as reported by `build_info'. When a bug is reported, it is helpful to copy the Maxima and Lisp version information into the bug report. `bug_report' returns an empty string `""'. -- Function: build_info () Prints out a summary of the parameters of the Maxima build. `build_info' returns an empty string `""'.  File: maxima.info, Node: Help, Next: Command Line, Prev: Bug Detection and Reporting, Up: Top 3 Help ****** * Menu: * Lisp and Maxima:: * Garbage Collection:: * Documentation:: * Functions and Variables for Help::  File: maxima.info, Node: Lisp and Maxima, Next: Garbage Collection, Prev: Help, Up: Help 3.1 Lisp and Maxima =================== Maxima is written in Lisp, and it is easy to access Lisp functions and variables from Maxima and vice versa. Lisp and Maxima symbols are distinguished by a naming convention. A Lisp symbol which begins with a dollar sign `$' corresponds to a Maxima symbol without the dollar sign. A Maxima symbol which begins with a question mark `?' corresponds to a Lisp symbol without the question mark. For example, the Maxima symbol `foo' corresponds to the Lisp symbol `$foo', while the Maxima symbol `?foo' corresponds to the Lisp symbol `foo', Note that `?foo' is written without a space between `?' and `foo'; otherwise it might be mistaken for `describe ("foo")'. Hyphen `-', asterisk `*', or other special characters in Lisp symbols must be escaped by backslash `\' where they appear in Maxima code. For example, the Lisp identifier `*foo-bar*' is written `?\*foo\-bar\*' in Maxima. Lisp code may be executed from within a Maxima session. A single line of Lisp (containing one or more forms) may be executed by the special command `:lisp'. For example, (%i1) :lisp (foo $x $y) calls the Lisp function `foo' with Maxima variables `x' and `y' as arguments. The `:lisp' construct can appear at the interactive prompt or in a file processed by `batch' or `demo', but not in a file processed by `load', `batchload', `translate_file', or `compile_file'. The function `to_lisp()' opens an interactive Lisp session. Entering `(to-maxima)' closes the Lisp session and returns to Maxima. Lisp functions and variables which are to be visible in Maxima as functions and variables with ordinary names (no special punctuation) must have Lisp names beginning with the dollar sign `$'. Maxima is case-sensitive, distinguishing between lowercase and uppercase letters in identifiers, while Lisp is not. There are some rules governing the translation of names between Lisp and Maxima. 1. A Lisp identifier not enclosed in vertical bars corresponds to a Maxima identifier in lowercase. Whether the Lisp identifier is uppercase, lowercase, or mixed case, is ignored. E.g., Lisp `$foo', `$FOO', and `$Foo' all correspond to Maxima `foo'. 2. A Lisp identifier which is all uppercase or all lowercase and enclosed in vertical bars corresponds to a Maxima identifier with case reversed. That is, uppercase is changed to lowercase and lowercase to uppercase. E.g., Lisp `|$FOO|' and `|$foo|' correspond to Maxima `foo' and `FOO', respectively. 3. A Lisp identifier which is mixed uppercase and lowercase and enclosed in vertical bars corresponds to a Maxima identifier with the same case. E.g., Lisp `|$Foo|' corresponds to Maxima `Foo'. The `#$' Lisp macro allows the use of Maxima expressions in Lisp code. `#$$' expands to a Lisp expression equivalent to the Maxima expression . (msetq $foo #$[x, y]$) This has the same effect as entering (%i1) foo: [x, y]; The Lisp function `displa' prints an expression in Maxima format. (%i1) :lisp #$[x, y, z]$ ((MLIST SIMP) $X $Y $Z) (%i1) :lisp (displa '((MLIST SIMP) $X $Y $Z)) [x, y, z] NIL Functions defined in Maxima are not ordinary Lisp functions. The Lisp function `mfuncall' calls a Maxima function. For example: (%i1) foo(x,y) := x*y$ (%i2) :lisp (mfuncall '$foo 'a 'b) ((MTIMES SIMP) A B) Some Lisp functions are shadowed in the Maxima package, namely the following. `complement', `continue', `//', `float', `functionp', `array', `exp', `listen', `signum', `atan', `asin', `acos', `asinh', `acosh', `atanh', `tanh', `cosh', `sinh', `tan', `break', and `gcd'.  File: maxima.info, Node: Garbage Collection, Next: Documentation, Prev: Lisp and Maxima, Up: Help 3.2 Garbage Collection ====================== Symbolic computation tends to create a good deal of garbage, and effective handling of this can be crucial to successful completion of some programs. Under GCL, on UNIX systems where the mprotect system call is available (including SUN OS 4.0 and some variants of BSD) a stratified garbage collection is available. This limits the collection to pages which have been recently written to. See the GCL documentation under ALLOCATE and GBC. At the Lisp level doing (setq si::*notify-gbc* t) will help you determine which areas might need more space.  File: maxima.info, Node: Documentation, Next: Functions and Variables for Help, Prev: Garbage Collection, Up: Help 3.3 Documentation ================= The Maxima on-line user's manual can be viewed in different forms. From the Maxima interactive prompt, the user's manual is viewed as plain text by the `?' command (i.e., the `describe' function). The user's manual is viewed as `info' hypertext by the `info' viewer program and as a web page by any ordinary web browser. `example' displays examples for many Maxima functions. For example, (%i1) example (integrate); yields (%i2) test(f):=block([u],u:integrate(f,x),ratsimp(f-diff(u,x))) (%o2) test(f) := block([u], u : integrate(f, x), ratsimp(f - diff(u, x))) (%i3) test(sin(x)) (%o3) 0 (%i4) test(1/(x+1)) (%o4) 0 (%i5) test(1/(x^2+1)) (%o5) 0 and additional output.  File: maxima.info, Node: Functions and Variables for Help, Prev: Documentation, Up: Help 3.4 Functions and Variables for Help ==================================== -- Function: demo () Evaluates Maxima expressions in and displays the results. `demo' pauses after evaluating each expression and continues after the user enters a carriage return. (If running in Xmaxima, `demo' may need to see a semicolon `;' followed by a carriage return.) `demo' searches the list of directories `file_search_demo' to find `filename'. If the file has the suffix `dem', the suffix may be omitted. See also `file_search'. `demo' evaluates its argument. `demo' returns the name of the demonstration file. Example: (%i1) demo ("disol"); batching /home/wfs/maxima/share/simplification/disol.dem At the _ prompt, type ';' followed by enter to get next demo (%i2) load(disol) _ (%i3) exp1 : a (e (g + f) + b (d + c)) (%o3) a (e (g + f) + b (d + c)) _ (%i4) disolate(exp1, a, b, e) (%t4) d + c (%t5) g + f (%o5) a (%t5 e + %t4 b) _ (%i5) demo ("rncomb"); batching /home/wfs/maxima/share/simplification/rncomb.dem At the _ prompt, type ';' followed by enter to get next demo (%i6) load(rncomb) _ z x (%i7) exp1 : ----- + --------- y + x 2 (y + x) z x (%o7) ----- + --------- y + x 2 (y + x) _ (%i8) combine(exp1) z x (%o8) ----- + --------- y + x 2 (y + x) _ (%i9) rncombine(%) 2 z + x (%o9) --------- 2 (y + x) _ d c b a (%i10) exp2 : - + - + - + - 3 3 2 2 d c b a (%o10) - + - + - + - 3 3 2 2 _ (%i11) combine(exp2) 2 d + 2 c + 3 (b + a) (%o11) --------------------- 6 _ (%i12) rncombine(exp2) 2 d + 2 c + 3 b + 3 a (%o12) --------------------- 6 _ (%i13) -- Function: describe () -- Function: describe (, exact) -- Function: describe (, inexact) `describe()' is equivalent to `describe(, exact)'. `describe(, exact)' finds an item with title equal (case-insensitive) to , if there is any such item. `describe(, inexact)' finds all documented items which contain in their titles. If there is more than one such item, Maxima asks the user to select an item or items to display. At the interactive prompt, `? foo' (with a space between `?' and `foo') is equivalent to `describe("foo", exact)', and `?? foo' is equivalent to `describe("foo", inexact)'. `describe("", inexact)' yields a list of all topics documented in the on-line manual. `describe' quotes its argument. `describe' returns `true' if some documentation is found, otherwise `false'. See also *Note Documentation::. Example: (%i1) ?? integ 0: Functions and Variables for Elliptic Integrals 1: Functions and Variables for Integration 2: Introduction to Elliptic Functions and Integrals 3: Introduction to Integration 4: askinteger (Functions and Variables for Simplification) 5: integerp (Functions and Variables for Miscellaneous Options) 6: integer_partitions (Functions and Variables for Sets) 7: integrate (Functions and Variables for Integration) 8: integrate_use_rootsof (Functions and Variables for Integration) 9: integration_constant_counter (Functions and Variables for Integration) 10: nonnegintegerp (Functions and Variables for linearalgebra) Enter space-separated numbers, `all' or `none': 7 8 -- Function: integrate (, ) -- Function: integrate (, , , ) Attempts to symbolically compute the integral of with respect to . `integrate (, )' is an indefinite integral, while `integrate (, , , )' is a definite integral, [...] -- Option variable: integrate_use_rootsof Default value: `false' When `integrate_use_rootsof' is `true' and the denominator of a rational function cannot be factored, `integrate' returns the integral in a form which is a sum over the roots (not yet known) of the denominator. [...] In this example, items 7 and 8 were selected (output is shortened as indicated by `[...]'. All or none of the items could have been selected by entering `all' or `none', which can be abbreviated `a' or `n', respectively. -- Function: example () -- Function: example () `example ()' displays some examples of , which is a symbol (not a string). Most topics are function names. `example ()' returns the list of all recognized topics. The name of the file containing the examples is given by the global variable `manual_demo', which defaults to `"manual.demo"'. `example' quotes its argument. `example' returns `done' unless there is an error or there is no argument, in which case `example' returns the list of all recognized topics. Examples: (%i1) example (append); (%i2) append([x+y,0,-3.2],[2.5E+20,x]) (%o2) [y + x, 0, - 3.2, 2.5E+20, x] (%o2) done (%i3) example (coeff); (%i4) coeff(b+tan(x)+2*a*tan(x) = 3+5*tan(x),tan(x)) (%o4) 2 a + 1 = 5 (%i5) coeff(1+x*%e^x+y,x,0) (%o5) y + 1 (%o5) done  File: maxima.info, Node: Command Line, Next: Operators, Prev: Help, Up: Top 4 Command Line ************** * Menu: * Introduction to Command Line:: * Functions and Variables for Command Line::  File: maxima.info, Node: Introduction to Command Line, Next: Functions and Variables for Command Line, Prev: Command Line, Up: Command Line 4.1 Introduction to Command Line ================================ -- Operator: ' The single quote operator `'' prevents evaluation. Applied to a symbol, the single quote prevents evaluation of the symbol. Applied to a function call, the single quote prevents evaluation of the function call, although the arguments of the function are still evaluated (if evaluation is not otherwise prevented). The result is the noun form of the function call. Applied to a parenthesized expression, the single quote prevents evaluation of all symbols and function calls in the expression. E.g., `'(f(x))' means do not evaluate the expression `f(x)'. `'f(x)' (with the single quote applied to `f' instead of `f(x)') means return the noun form of `f' applied to `[x]'. The single quote does not prevent simplification. When the global flag `noundisp' is `true', nouns display with a single quote. This switch is always `true' when displaying function definitions. See also the quote-quote operator `''' and `nouns'. Examples: Applied to a symbol, the single quote prevents evaluation of the symbol. (%i1) aa: 1024; (%o1) 1024 (%i2) aa^2; (%o2) 1048576 (%i3) 'aa^2; 2 (%o3) aa (%i4) ''%; (%o4) 1048576 Applied to a function call, the single quote prevents evaluation of the function call. The result is the noun form of the function call. (%i1) x0: 5; (%o1) 5 (%i2) x1: 7; (%o2) 7 (%i3) integrate (x^2, x, x0, x1); 218 (%o3) --- 3 (%i4) 'integrate (x^2, x, x0, x1); 7 / [ 2 (%o4) I x dx ] / 5 (%i5) %, nouns; 218 (%o5) --- 3 Applied to a parenthesized expression, the single quote prevents evaluation of all symbols and function calls in the expression. (%i1) aa: 1024; (%o1) 1024 (%i2) bb: 19; (%o2) 19 (%i3) sqrt(aa) + bb; (%o3) 51 (%i4) '(sqrt(aa) + bb); (%o4) bb + sqrt(aa) (%i5) ''%; (%o5) 51 The single quote does not prevent simplification. (%i1) sin (17 * %pi) + cos (17 * %pi); (%o1) - 1 (%i2) '(sin (17 * %pi) + cos (17 * %pi)); (%o2) - 1 -- Operator: " The quote-quote operator `''' (two single quote marks) modifies evaluation in input expressions. Applied to a general expression , quote-quote causes the value of to be substituted for in the input expression. Applied to the operator of an expression, quote-quote changes the operator from a noun to a verb (if it is not already a verb). The quote-quote operator is applied by the input parser; it is not stored as part of a parsed input expression. The quote-quote operator is always applied as soon as it is parsed, and cannot be quoted. Thus quote-quote causes evaluation when evaluation is otherwise suppressed, such as in function definitions, lambda expressions, and expressions quoted by single quote `''. Quote-quote is recognized by `batch' and `load'. See also the single-quote operator `'' and `nouns'. Examples: Applied to a general expression , quote-quote causes the value of to be substituted for in the input expression. (%i1) expand ((a + b)^3); 3 2 2 3 (%o1) b + 3 a b + 3 a b + a (%i2) [_, ''_]; 3 3 2 2 3 (%o2) [expand((b + a) ), b + 3 a b + 3 a b + a ] (%i3) [%i1, ''%i1]; 3 3 2 2 3 (%o3) [expand((b + a) ), b + 3 a b + 3 a b + a ] (%i4) [aa : cc, bb : dd, cc : 17, dd : 29]; (%o4) [cc, dd, 17, 29] (%i5) foo_1 (x) := aa - bb * x; (%o5) foo_1(x) := aa - bb x (%i6) foo_1 (10); (%o6) cc - 10 dd (%i7) ''%; (%o7) - 273 (%i8) ''(foo_1 (10)); (%o8) - 273 (%i9) foo_2 (x) := ''aa - ''bb * x; (%o9) foo_2(x) := cc - dd x (%i10) foo_2 (10); (%o10) - 273 (%i11) [x0 : x1, x1 : x2, x2 : x3]; (%o11) [x1, x2, x3] (%i12) x0; (%o12) x1 (%i13) ''x0; (%o13) x2 (%i14) '' ''x0; (%o14) x3 Applied to the operator of an expression, quote-quote changes the operator from a noun to a verb (if it is not already a verb). (%i1) sin (1); (%o1) sin(1) (%i2) ''sin (1); (%o2) 0.8414709848079 (%i3) declare (foo, noun); (%o3) done (%i4) foo (x) := x - 1729; (%o4) ''foo(x) := x - 1729 (%i5) foo (100); (%o5) foo(100) (%i6) ''foo (100); (%o6) - 1629 The quote-quote operator is applied by the input parser; it is not stored as part of a parsed input expression. (%i1) [aa : bb, cc : dd, bb : 1234, dd : 5678]; (%o1) [bb, dd, 1234, 5678] (%i2) aa + cc; (%o2) dd + bb (%i3) display (_, op (_), args (_)); _ = cc + aa op(cc + aa) = + args(cc + aa) = [cc, aa] (%o3) done (%i4) ''(aa + cc); (%o4) 6912 (%i5) display (_, op (_), args (_)); _ = dd + bb op(dd + bb) = + args(dd + bb) = [dd, bb] (%o5) done Quote-quote causes evaluation when evaluation is otherwise suppressed, such as in function definitions, lambda expressions, and expressions quoted by single quote `''. (%i1) foo_1a (x) := ''(integrate (log (x), x)); (%o1) foo_1a(x) := x log(x) - x (%i2) foo_1b (x) := integrate (log (x), x); (%o2) foo_1b(x) := integrate(log(x), x) (%i3) dispfun (foo_1a, foo_1b); (%t3) foo_1a(x) := x log(x) - x (%t4) foo_1b(x) := integrate(log(x), x) (%o4) [%t3, %t4] (%i4) integrate (log (x), x); (%o4) x log(x) - x (%i5) foo_2a (x) := ''%; (%o5) foo_2a(x) := x log(x) - x (%i6) foo_2b (x) := %; (%o6) foo_2b(x) := % (%i7) dispfun (foo_2a, foo_2b); (%t7) foo_2a(x) := x log(x) - x (%t8) foo_2b(x) := % (%o8) [%t7, %t8] (%i8) F : lambda ([u], diff (sin (u), u)); (%o8) lambda([u], diff(sin(u), u)) (%i9) G : lambda ([u], ''(diff (sin (u), u))); (%o9) lambda([u], cos(u)) (%i10) '(sum (a[k], k, 1, 3) + sum (b[k], k, 1, 3)); (%o10) sum(b , k, 1, 3) + sum(a , k, 1, 3) k k (%i11) '(''(sum (a[k], k, 1, 3)) + ''(sum (b[k], k, 1, 3))); (%o11) b + a + b + a + b + a 3 3 2 2 1 1  File: maxima.info, Node: Functions and Variables for Command Line, Prev: Introduction to Command Line, Up: Command Line 4.2 Functions and Variables for Command Line ============================================ -- Function: alias (, , ..., , ) provides an alternate name for a (user or system) function, variable, array, etc. Any even number of arguments may be used. -- Option variable: debugmode Default value: `false' When a Maxima error occurs, Maxima will start the debugger if `debugmode' is `true'. The user may enter commands to examine the call stack, set breakpoints, step through Maxima code, and so on. See `debugging' for a list of debugger commands. Enabling `debugmode' will not catch Lisp errors. -- Function: ev (, , ..., ) Evaluates the expression in the environment specified by the arguments , ..., . The arguments are switches (Boolean flags), assignments, equations, and functions. `ev' returns the result (another expression) of the evaluation. The evaluation is carried out in steps, as follows. 1. First the environment is set up by scanning the arguments which may be any or all of the following. * `simp' causes to be simplified regardless of the setting of the switch `simp' which inhibits simplification if `false'. * `noeval' supresses the evaluation phase of `ev' (see step (4) below). This is useful in conjunction with the other switches and in causing to be resimplified without being reevaluated. * `nouns' causes the evaluation of noun forms (typically unevaluated functions such as `'integrate' or `'diff') in . * `expand' causes expansion. * `expand (, )' causes expansion, setting the values of `maxposex' and `maxnegex' to and respectively. * `detout' causes any matrix inverses computed in to have their determinant kept outside of the inverse rather than dividing through each element. * `diff' causes all differentiations indicated in to be performed. * `derivlist (, , , ...)' causes only differentiations with respect to the indicated variables. * `float' causes non-integral rational numbers to be converted to floating point. * `numer' causes some mathematical functions (including exponentiation) with numerical arguments to be evaluated in floating point. It causes variables in which have been given numervals to be replaced by their values. It also sets the `float' switch on. * `pred' causes predicates (expressions which evaluate to `true' or `false') to be evaluated. * `eval' causes an extra post-evaluation of to occur. (See step (5) below.) `eval' may occur multiple times. For each instance of `eval', the expression is evaluated again. * `A' where `A' is an atom declared to be an evaluation flag (see `evflag') causes `A' to be bound to `true' during the evaluation of . * `V: expression' (or alternately `V=expression') causes `V' to be bound to the value of `expression' during the evaluation of . Note that if `V' is a Maxima option, then `expression' is used for its value during the evaluation of . If more than one argument to `ev' is of this type then the binding is done in parallel. If `V' is a non-atomic expression then a substitution rather than a binding is performed. * `F' where `F', a function name, has been declared to be an evaluation function (see `evfun') causes `F' to be applied to . * Any other function names (e.g., `sum') cause evaluation of occurrences of those names in as though they were verbs. * In addition a function occurring in (say `F(x)') may be defined locally for the purpose of this evaluation of by giving `F(x) := expression' as an argument to `ev'. * If an atom not mentioned above or a subscripted variable or subscripted expression was given as an argument, it is evaluated and if the result is an equation or assignment then the indicated binding or substitution is performed. If the result is a list then the members of the list are treated as if they were additional arguments given to `ev'. This permits a list of equations to be given (e.g. `[X=1, Y=A**2]') or a list of names of equations (e.g., `[%t1, %t2]' where `%t1' and `%t2' are equations) such as that returned by `solve'. The arguments of `ev' may be given in any order with the exception of substitution equations which are handled in sequence, left to right, and evaluation functions which are composed, e.g., `ev (, ratsimp, realpart)' is handled as `realpart (ratsimp ())'. The `simp', `numer', `float', and `pred' switches may also be set locally in a block, or globally in Maxima so that they will remain in effect until being reset. If is a canonical rational expression (CRE), then the expression returned by `ev' is also a CRE, provided the `numer' and `float' switches are not both `true'. 2. During step (1), a list is made of the non-subscripted variables appearing on the left side of equations in the arguments or in the value of some arguments if the value is an equation. The variables (subscripted variables which do not have associated array functions as well as non-subscripted variables) in the expression are replaced by their global values, except for those appearing in this list. Usually, is just a label or `%' (as in `%i2' in the example below), so this step simply retrieves the expression named by the label, so that `ev' may work on it. 3. If any substitutions are indicated by the arguments, they are carried out now. 4. The resulting expression is then re-evaluated (unless one of the arguments was `noeval') and simplified according to the arguments. Note that any function calls in will be carried out after the variables in it are evaluated and that `ev(F(x))' thus may behave like `F(ev(x))'. 5. For each instance of `eval' in the arguments, steps (3) and (4) are repeated. Examples (%i1) sin(x) + cos(y) + (w+1)^2 + 'diff (sin(w), w); d 2 (%o1) cos(y) + sin(x) + -- (sin(w)) + (w + 1) dw (%i2) ev (%, sin, expand, diff, x=2, y=1); 2 (%o2) cos(w) + w + 2 w + cos(1) + 1.909297426825682 An alternate top level syntax has been provided for `ev', whereby one may just type in its arguments, without the `ev()'. That is, one may write simply , , ..., This is not permitted as part of another expression, e.g., in functions, blocks, etc. Notice the parallel binding process in the following example. (%i3) programmode: false; (%o3) false (%i4) x+y, x: a+y, y: 2; (%o4) y + a + 2 (%i5) 2*x - 3*y = 3$ (%i6) -3*x + 2*y = -4$ (%i7) solve ([%o5, %o6]); Solution 1 (%t7) y = - - 5 6 (%t8) x = - 5 (%o8) [[%t7, %t8]] (%i8) %o6, %o8; (%o8) - 4 = - 4 (%i9) x + 1/x > gamma (1/2); 1 (%o9) x + - > sqrt(%pi) x (%i10) %, numer, x=1/2; (%o10) 2.5 > 1.772453850905516 (%i11) %, pred; (%o11) true -- Property: evflag When a symbol has the `evflag' property, the expressions `ev(, )' and `, ' (at the interactive prompt) are equivalent to `ev(, = true)'. That is, is bound to `true' while is evaluated. The expression `declare(, evflag)' gives the `evflag' property to the variable . The flags which have the `evflag' property by default are the following: `algebraic', `cauchysum', `demoivre', `dotscrules', `%emode', `%enumer', `exponentialize', `exptisolate', `factorflag', `float', `halfangles', `infeval', `isolate_wrt_times', `keepfloat', `letrat', `listarith', `logabs', `logarc', `logexpand', `lognegint', `lognumer', `m1pbranch', `numer_pbranch', `programmode', `radexpand', `ratalgdenom', `ratfac', `ratmx', `ratsimpexpons', `simp', `simpsum', `sumexpand', and `trigexpand'. Examples: (%i1) sin (1/2); 1 (%o1) sin(-) 2 (%i2) sin (1/2), float; (%o2) 0.479425538604203 (%i3) sin (1/2), float=true; (%o3) 0.479425538604203 (%i4) simp : false; (%o4) false (%i5) 1 + 1; (%o5) 1 + 1 (%i6) 1 + 1, simp; (%o6) 2 (%i7) simp : true; (%o7) true (%i8) sum (1/k^2, k, 1, inf); inf ==== \ 1 (%o8) > -- / 2 ==== k k = 1 (%i9) sum (1/k^2, k, 1, inf), simpsum; 2 %pi (%o9) ---- 6 (%i10) declare (aa, evflag); (%o10) done (%i11) if aa = true then YES else NO; (%o11) NO (%i12) if aa = true then YES else NO, aa; (%o12) YES -- Property: evfun When a function has the `evfun' property, the expressions `ev(, )' and `, ' (at the interactive prompt) are equivalent to `(ev())'. If two or more `evfun' functions , , etc., are specified, the functions are applied in the order that they are specified. The expression `declare(, evfun)' gives the `evfun' property to the function . The functions which have the `evfun' property by default are the following: `bfloat', `factor', `fullratsimp', `logcontract', `polarform', `radcan', `ratexpand', `ratsimp', `rectform', `rootscontract', `trigexpand', and `trigreduce'. Examples: (%i1) x^3 - 1; 3 (%o1) x - 1 (%i2) x^3 - 1, factor; 2 (%o2) (x - 1) (x + x + 1) (%i3) factor (x^3 - 1); 2 (%o3) (x - 1) (x + x + 1) (%i4) cos(4 * x) / sin(x)^4; cos(4 x) (%o4) -------- 4 sin (x) (%i5) cos(4 * x) / sin(x)^4, trigexpand; 4 2 2 4 sin (x) - 6 cos (x) sin (x) + cos (x) (%o5) ------------------------------------- 4 sin (x) (%i6) cos(4 * x) / sin(x)^4, trigexpand, ratexpand; 2 4 6 cos (x) cos (x) (%o6) - --------- + ------- + 1 2 4 sin (x) sin (x) (%i7) ratexpand (trigexpand (cos(4 * x) / sin(x)^4)); 2 4 6 cos (x) cos (x) (%o7) - --------- + ------- + 1 2 4 sin (x) sin (x) (%i8) declare ([F, G], evfun); (%o8) done (%i9) (aa : bb, bb : cc, cc : dd); (%o9) dd (%i10) aa; (%o10) bb (%i11) aa, F; (%o11) F(cc) (%i12) F (aa); (%o12) F(bb) (%i13) F (ev (aa)); (%o13) F(cc) (%i14) aa, F, G; (%o14) G(F(cc)) (%i15) G (F (ev (aa))); (%o15) G(F(cc)) -- Option variable: infeval Enables "infinite evaluation" mode. `ev' repeatedly evaluates an expression until it stops changing. To prevent a variable, say `X', from being evaluated away in this mode, simply include `X='X' as an argument to `ev'. Of course expressions such as `ev (X, X=X+1, infeval)' will generate an infinite loop. -- Function: kill (, ..., ) -- Function: kill (labels) -- Function: kill (inlabels, outlabels, linelabels) -- Function: kill () -- Function: kill ([, ]) -- Function: kill (values, functions, arrays, ...) -- Function: kill (all) -- Function: kill (allbut (, ..., )) Removes all bindings (value, function, array, or rule) from the arguments , ..., . An argument may be a symbol or a single array element. When is a single array element, `kill' unbinds that element without affecting any other elements of the array. Several special arguments are recognized. Different kinds of arguments may be combined, e.g., `kill (inlabels, functions, allbut (foo, bar))'. `kill (labels)' unbinds all input, output, and intermediate expression labels created so far. `kill (inlabels)' unbinds only input labels which begin with the current value of `inchar'. Likewise, `kill (outlabels)' unbinds only output labels which begin with the current value of `outchar', and `kill (linelabels)' unbinds only intermediate expression labels which begin with the current value of `linechar'. `kill ()', where is an integer, unbinds the most recent input and output labels. `kill ([, ])' unbinds input and output labels through . `kill ()', where is any item in `infolists' (such as `values', `functions', or `arrays') unbinds all items in . See also `infolists'. `kill (all)' unbinds all items on all infolists. `kill (all)' does not reset global variables to their default values; see `reset' on this point. `kill (allbut (, ..., ))' unbinds all items on all infolists except for , ..., . `kill (allbut ())' unbinds all items except for the ones on , where is `values', `functions', `arrays', etc. The memory taken up by a bound property is not released until all symbols are unbound from it. In particular, to release the memory taken up by the value of a symbol, one unbinds the output label which shows the bound value, as well as unbinding the symbol itself. `kill' quotes its arguments. The quote-quote operator `''' defeats quotation. `kill ()' unbinds all properties of . In contrast, `remvalue', `remfunction', `remarray', and `remrule' unbind a specific property. `kill' always returns `done', even if an argument has no binding. -- Function: labels () -- System variable: labels Returns the list of input, output, or intermediate expression labels which begin with . Typically is the value of `inchar', `outchar', or `linechar'. The label character may be given with or without a percent sign, so, for example, `i' and `%i' yield the same result. If no labels begin with , `labels' returns an empty list. The function `labels' quotes its argument. The quote-quote operator `''' defeats quotation. For example, `labels (''inchar)' returns the input labels which begin with the current input label character. The variable `labels' is the list of input, output, and intermediate expression labels, including all previous labels if `inchar', `outchar', or `linechar' were redefined. By default, Maxima displays the result of each user input expression, giving the result an output label. The output display is suppressed by terminating the input with `$' (dollar sign) instead of `;' (semicolon). An output label is constructed and bound to the result, but not displayed, and the label may be referenced in the same way as displayed output labels. See also `%', `%%', and `%th'. Intermediate expression labels can be generated by some functions. The flag `programmode' controls whether `solve' and some other functions generate intermediate expression labels instead of returning a list of expressions. Some other functions, such as `ldisplay', always generate intermediate expression labels. See also `inchar', `outchar', `linechar', and `infolists'. -- System variable: linenum The line number of the current pair of input and output expressions. -- System variable: myoptions Default value: `[]' `myoptions' is the list of all options ever reset by the user, whether or not they get reset to their default value. -- Option variable: nolabels Default value: `false' When `nolabels' is `true', input and output result labels (`%i' and `%o', respectively) are displayed, but the labels are not bound to results, and the labels are not appended to the `labels' list. Since labels are not bound to results, garbage collection can recover the memory taken up by the results. Otherwise input and output result labels are bound to results, and the labels are appended to the `labels' list. Intermediate expression labels (`%t') are not affected by `nolabels'; whether `nolabels' is `true' or `false', intermediate expression labels are bound and appended to the `labels' list. See also `batch', `load', and `labels'. -- Option variable: optionset Default value: `false' When `optionset' is `true', Maxima prints out a message whenever a Maxima option is reset. This is useful if the user is doubtful of the spelling of some option and wants to make sure that the variable he assigned a value to was truly an option variable. -- Function: playback () -- Function: playback () -- Function: playback ([, ]) -- Function: playback ([]) -- Function: playback (input) -- Function: playback (slow) -- Function: playback (time) -- Function: playback (grind) Displays input, output, and intermediate expressions, without recomputing them. `playback' only displays the expressions bound to labels; any other output (such as text printed by `print' or `describe', or error messages) is not displayed. See also `labels'. `playback' quotes its arguments. The quote-quote operator `''' defeats quotation. `playback' always returns `done'. `playback ()' (with no arguments) displays all input, output, and intermediate expressions generated so far. An output expression is displayed even if it was suppressed by the `$' terminator when it was originally computed. `playback ()' displays the most recent expressions. Each input, output, and intermediate expression counts as one. `playback ([, ])' displays input, output, and intermediate expressions with numbers from through , inclusive. `playback ([])' is equivalent to `playback ([, ])'; this usually prints one pair of input and output expressions. `playback (input)' displays all input expressions generated so far. `playback (slow)' pauses between expressions and waits for the user to press `enter'. This behavior is similar to `demo'. `playback (slow)' is useful in conjunction with `save' or `stringout' when creating a secondary-storage file in order to pick out useful expressions. `playback (time)' displays the computation time for each expression. `playback (grind)' displays input expressions in the same format as the `grind' function. Output expressions are not affected by the `grind' option. See `grind'. Arguments may be combined, e.g., `playback ([5, 10], grind, time, slow)'. -- Function: printprops (, ) -- Function: printprops ([, ..., ], ) -- Function: printprops (all, ) Displays the property with the indicator associated with the atom . may also be a list of atoms or the atom `all' in which case all of the atoms with the given property will be used. For example, `printprops ([f, g], atvalue)'. `printprops' is for properties that cannot otherwise be displayed, i.e. for `atvalue', `atomgrad', `gradef', and `matchdeclare'. -- Option variable: prompt Default value: `_' `prompt' is the prompt symbol of the `demo' function, `playback (slow)' mode, and the Maxima break loop (as invoked by `break'). -- Function: quit () Terminates the Maxima session. Note that the function must be invoked as `quit();' or `quit()$', not `quit' by itself. To stop a lengthy computation, type `control-C'. The default action is to return to the Maxima prompt. If `*debugger-hook*' is `nil', `control-C' opens the Lisp debugger. See also `debugging'. -- Function: remfunction (, ..., ) -- Function: remfunction (all) Unbinds the function definitions of the symbols , ..., . The arguments may be the names of ordinary functions (created by `:=' or `define') or macro functions (created by `::='). `remfunction (all)' unbinds all function definitions. `remfunction' quotes its arguments. `remfunction' returns a list of the symbols for which the function definition was unbound. `false' is returned in place of any symbol for which there is no function definition. -- Function: reset () Resets many global variables and options, and some other variables, to their default values. `reset' processes the variables on the Lisp list `*variable-initial-values*'. The Lisp macro `defmvar' puts variables on this list (among other actions). Many, but not all, global variables and options are defined by `defmvar', and some variables defined by `defmvar' are not global variables or options. -- Option variable: showtime Default value: `false' When `showtime' is `true', the computation time and elapsed time is printed with each output expression. The computation time is always recorded, so `time' and `playback' can display the computation time even when `showtime' is `false'. See also `timer'. -- Function: sstatus (, ) Sets the status of in . After `sstatus (, )' is executed, `status (, )' returns `true'. This can be useful for package writers, to keep track of what features they have loaded in. -- Function: to_lisp () Enters the Lisp system under Maxima. `(to-maxima)' returns to Maxima. -- System variable: values Initial value: `[]' `values' is a list of all bound user variables (not Maxima options or switches). The list comprises symbols bound by `:' , `::', or `:='.  File: maxima.info, Node: Operators, Next: Expressions, Prev: Command Line, Up: Top 5 Operators *********** * Menu: * nary:: * nofix:: * postfix:: * prefix:: * Arithmetic operators:: * Relational operators:: * General operators::  File: maxima.info, Node: nary, Next: nofix, Prev: Operators, Up: Operators 5.1 nary ======== An `nary' operator is used to denote a function of any number of arguments, each of which is separated by an occurrence of the operator, e.g. A+B or A+B+C. The `nary("x")' function is a syntax extension function to declare x to be an `nary' operator. Functions may be declared to be `nary'. If `declare(j,nary);' is done, this tells the simplifier to simplify, e.g. `j(j(a,b),j(c,d))' to `j(a, b, c, d)'. See also `syntax'.  File: maxima.info, Node: nofix, Next: postfix, Prev: nary, Up: Operators 5.2 nofix ========= `nofix' operators are used to denote functions of no arguments. The mere presence of such an operator in a command will cause the corresponding function to be evaluated. For example, when one types "exit;" to exit from a Maxima break, "exit" is behaving similar to a `nofix' operator. The function `nofix("x")' is a syntax extension function which declares x to be a `nofix' operator. See also `syntax'.  File: maxima.info, Node: postfix, Next: prefix, Prev: nofix, Up: Operators 5.3 postfix =========== `postfix' operators like the `prefix' variety denote functions of a single argument, but in this case the argument immediately precedes an occurrence of the operator in the input string, e.g. 3! . The `postfix("x")' function is a syntax extension function to declare x to be a `postfix' operator. See also `syntax'.  File: maxima.info, Node: prefix, Next: Arithmetic operators, Prev: postfix, Up: Operators 5.4 prefix ========== A `prefix' operator is one which signifies a function of one argument, which argument immediately follows an occurrence of the operator. `prefix("x")' is a syntax extension function to declare x to be a `prefix' operator. See also `syntax'.  File: maxima.info, Node: Arithmetic operators, Next: Relational operators, Prev: prefix, Up: Operators 5.5 Arithmetic operators ======================== -- Operator: + -- Operator: - -- Operator: * -- Operator: / -- Operator: ^ The symbols `+' `*' `/' and `^' represent addition, multiplication, division, and exponentiation, respectively. The name of these operators are `"+"' `"*"' `"//"' and `"^"', which may appear where the name of a function or operator is required. The symbols `+' and `-' represent unary addition and negation, respectively, and the names of these operators are `"+"' and `"-"', respectively. Subtraction `a - b' is represented within Maxima as addition, `a + (- b)'. Expressions such as `a + (- b)' are displayed as subtraction. Maxima recognizes `"-"' only as the name of the unary negation operator, and not as the name of the binary subtraction operator. Division `a / b' is represented within Maxima as multiplication, `a * b^(- 1)'. Expressions such as `a * b^(- 1)' are displayed as division. Maxima recognizes `"//"' as the name of the division operator. Addition and multiplication are n-ary, commutative operators. Division and exponentiation are binary, noncommutative operators. Maxima sorts the operands of commutative operators to construct a canonical representation. For internal storage, the ordering is determined by `orderlessp'. For display, the ordering for addition is determined by `ordergreatp', and for multiplication, it is the same as the internal ordering. Arithmetic computations are carried out on literal numbers (integers, rationals, ordinary floats, and bigfloats). Except for exponentiation, all arithmetic operations on numbers are simplified to numbers. Exponentiation is simplified to a number if either operand is an ordinary float or bigfloat or if the result is an exact integer or rational; otherwise an exponentiation may be simplified to `sqrt' or another exponentiation or left unchanged. Floating-point contagion applies to arithmetic computations: if any operand is a bigfloat, the result is a bigfloat; otherwise, if any operand is an ordinary float, the result is an ordinary float; otherwise, the operands are rationals or integers and the result is a rational or integer. Arithmetic computations are a simplification, not an evaluation. Thus arithmetic is carried out in quoted (but simplified) expressions. Arithmetic operations are applied element-by-element to lists when the global flag `listarith' is `true', and always applied element-by-element to matrices. When one operand is a list or matrix and another is an operand of some other type, the other operand is combined with each of the elements of the list or matrix. Examples: Addition and multiplication are n-ary, commutative operators. Maxima sorts the operands to construct a canonical representation. The names of these operators are `"+"' and `"*"'. (%i1) c + g + d + a + b + e + f; (%o1) g + f + e + d + c + b + a (%i2) [op (%), args (%)]; (%o2) [+, [g, f, e, d, c, b, a]] (%i3) c * g * d * a * b * e * f; (%o3) a b c d e f g (%i4) [op (%), args (%)]; (%o4) [*, [a, b, c, d, e, f, g]] (%i5) apply ("+", [a, 8, x, 2, 9, x, x, a]); (%o5) 3 x + 2 a + 19 (%i6) apply ("*", [a, 8, x, 2, 9, x, x, a]); 2 3 (%o6) 144 a x Division and exponentiation are binary, noncommutative operators. The names of these operators are `"//"' and `"^"'. (%i1) [a / b, a ^ b]; a b (%o1) [-, a ] b (%i2) [map (op, %), map (args, %)]; (%o2) [[//, ^], [[a, b], [a, b]]] (%i3) [apply ("//", [a, b]), apply ("^", [a, b])]; a b (%o3) [-, a ] b Subtraction and division are represented internally in terms of addition and multiplication, respectively. (%i1) [inpart (a - b, 0), inpart (a - b, 1), inpart (a - b, 2)]; (%o1) [+, a, - b] (%i2) [inpart (a / b, 0), inpart (a / b, 1), inpart (a / b, 2)]; 1 (%o2) [*, a, -] b Computations are carried out on literal numbers. Floating-point contagion applies. (%i1) 17 + b - (1/2)*29 + 11^(2/4); 5 (%o1) b + sqrt(11) + - 2 (%i2) [17 + 29, 17 + 29.0, 17 + 29b0]; (%o2) [46, 46.0, 4.6b1] Arithmetic computations are a simplification, not an evaluation. (%i1) simp : false; (%o1) false (%i2) '(17 + 29*11/7 - 5^3); 29 11 3 (%o2) 17 + ----- - 5 7 (%i3) simp : true; (%o3) true (%i4) '(17 + 29*11/7 - 5^3); 437 (%o4) - --- 7 Arithmetic is carried out element-by-element for lists (depending on `listarith') and matrices. (%i1) matrix ([a, x], [h, u]) - matrix ([1, 2], [3, 4]); [ a - 1 x - 2 ] (%o1) [ ] [ h - 3 u - 4 ] (%i2) 5 * matrix ([a, x], [h, u]); [ 5 a 5 x ] (%o2) [ ] [ 5 h 5 u ] (%i3) listarith : false; (%o3) false (%i4) [a, c, m, t] / [1, 7, 2, 9]; [a, c, m, t] (%o4) ------------ [1, 7, 2, 9] (%i5) [a, c, m, t] ^ x; x (%o5) [a, c, m, t] (%i6) listarith : true; (%o6) true (%i7) [a, c, m, t] / [1, 7, 2, 9]; c m t (%o7) [a, -, -, -] 7 2 9 (%i8) [a, c, m, t] ^ x; x x x x (%o8) [a , c , m , t ] -- Operator: ** Exponentiation operator. Maxima recognizes `**' as the same operator as `^' in input, and it is displayed as `^' in 1-dimensional output, or by placing the exponent as a superscript in 2-dimensional output. The `fortran' function displays the exponentiation operator as `**', whether it was input as `**' or `^'. Examples: (%i1) is (a**b = a^b); (%o1) true (%i2) x**y + x^z; z y (%o2) x + x (%i3) string (x**y + x^z); (%o3) x^z+x^y (%i4) fortran (x**y + x^z); x**z+x**y (%o4) done  File: maxima.info, Node: Relational operators, Next: General operators, Prev: Arithmetic operators, Up: Operators 5.6 Relational operators ======================== -- Operator: < -- Operator: <= -- Operator: >= -- Operator: >  File: maxima.info, Node: General operators, Prev: Relational operators, Up: Operators 5.7 General operators ===================== -- Operator: ^^ Noncommutative exponentiation operator. `^^' is the exponentiation operator corresponding to noncommutative multiplication `.', just as the ordinary exponentiation operator `^' corresponds to commutative multiplication `*'. Noncommutative exponentiation is displayed by `^^' in 1-dimensional output, and by placing the exponent as a superscript within angle brackets `< >' in 2-dimensional output. Examples: (%i1) a . a . b . b . b + a * a * a * b * b; 3 2 <2> <3> (%o1) a b + a . b (%i2) string (a . a . b . b . b + a * a * a * b * b); (%o2) a^3*b^2+a^^2 . b^^3 -- Operator: ! The factorial operator. For any complex number `x' (including integer, rational, and real numbers) except for negative integers, `x!' is defined as `gamma(x+1)'. For an integer `x', `x!' simplifies to the product of the integers from 1 to `x' inclusive. `0!' simplifies to 1. For a floating point number `x', `x!' simplifies to the value of `gamma (x+1)'. For `x' equal to `n/2' where `n' is an odd integer, `x!' simplifies to a rational factor times `sqrt (%pi)' (since `gamma (1/2)' is equal to `sqrt (%pi)'). If `x' is anything else, `x!' is not simplified. The variables `factlim', `minfactorial', and `factcomb' control the simplification of expressions containing factorials. The functions `gamma', `bffac', and `cbffac' are varieties of the gamma function. `makegamma' substitutes `gamma' for factorials and related functions. See also `binomial'. The factorial of an integer, half-integer, or floating point argument is simplified unless the operand is greater than `factlim'. (%i1) factlim : 10; (%o1) 10 (%i2) [0!, (7/2)!, 4.77!, 8!, 20!]; 105 sqrt(%pi) (%o2) [1, -------------, 81.44668037931199, 40320, 20!] 16 The factorial of a complex number, known constant, or general expression is not simplified. Even so it may be possible simplify the factorial after evaluating the operand. (%i1) [(%i + 1)!, %pi!, %e!, (cos(1) + sin(1))!]; (%o1) [(%i + 1)!, %pi!, %e!, (sin(1) + cos(1))!] (%i2) ev (%, numer, %enumer); (%o2) [(%i + 1)!, 7.188082728976037, 4.260820476357, 1.227580202486819] The factorial of an unbound symbol is not simplified. (%i1) kill (foo); (%o1) done (%i2) foo!; (%o2) foo! Factorials are simplified, not evaluated. Thus `x!' may be replaced even in a quoted expression. (%i1) '([0!, (7/2)!, 4.77!, 8!, 20!]); 105 sqrt(%pi) (%o1) [1, -------------, 81.44668037931199, 40320, 16 2432902008176640000] -- Operator: !! The double factorial operator. For an integer, float, or rational number `n', `n!!' evaluates to the product `n (n-2) (n-4) (n-6) ... (n - 2 (k-1))' where `k' is equal to `entier (n/2)', that is, the largest integer less than or equal to `n/2'. Note that this definition does not coincide with other published definitions for arguments which are not integers. For an even (or odd) integer `n', `n!!' evaluates to the product of all the consecutive even (or odd) integers from 2 (or 1) through `n' inclusive. For an argument `n' which is not an integer, float, or rational, `n!!' yields a noun form `genfact (n, n/2, 2)'. -- Operator: # Represents the negation of syntactic equality `='. Note that because of the rules for evaluation of predicate expressions (in particular because `not ' causes evaluation of ), `not = ' is equivalent to `is( # )', instead of ` # '. Examples: (%i1) a = b; (%o1) a = b (%i2) is (a = b); (%o2) false (%i3) a # b; (%o3) a # b (%i4) not a = b; (%o4) true (%i5) is (a # b); (%o5) true (%i6) is (not a = b); (%o6) true -- Operator: . The dot operator, for matrix (non-commutative) multiplication. When "." is used in this way, spaces should be left on both sides of it, e.g. A . B. This distinguishes it plainly from a decimal point in a floating point number. See also `dot', `dot0nscsimp', `dot0simp', `dot1simp', `dotassoc', `dotconstrules', `dotdistrib', `dotexptsimp', `dotident', and `dotscrules'. -- Operator: : The assignment operator. E.g. A:3 sets the variable A to 3. -- Operator: :: Assignment operator. :: assigns the value of the expression on its right to the value of the quantity on its left, which must evaluate to an atomic variable or subscripted variable. -- Operator: ::= Macro function definition operator. `::=' defines a function (called a "macro" for historical reasons) which quotes its arguments, and the expression which it returns (called the "macro expansion") is evaluated in the context from which the macro was called. A macro function is otherwise the same as an ordinary function. `macroexpand' returns a macro expansion (without evaluating it). `macroexpand (foo (x))' followed by `''%' is equivalent to `foo (x)' when `foo' is a macro function. `::=' puts the name of the new macro function onto the global list `macros'. `kill', `remove', and `remfunction' unbind macro function definitions and remove names from `macros'. `fundef' or `dispfun' return a macro function definition or assign it to a label, respectively. Macro functions commonly contain `buildq' and `splice' expressions to construct an expression, which is then evaluated. Examples A macro function quotes its arguments, so message (1) shows `y - z', not the value of `y - z'. The macro expansion (the quoted expression `'(print ("(2) x is equal to", x))' is evaluated in the context from which the macro was called, printing message (2). (%i1) x: %pi; (%o1) %pi (%i2) y: 1234; (%o2) 1234 (%i3) z: 1729 * w; (%o3) 1729 w (%i4) printq1 (x) ::= block (print ("(1) x is equal to", x), '(print ("(2) x is equal to", x))); (%o4) printq1(x) ::= block(print("(1) x is equal to", x), '(print("(2) x is equal to", x))) (%i5) printq1 (y - z); (1) x is equal to y - z (2) x is equal to %pi (%o5) %pi An ordinary function evaluates is arguments, so message (1) shows the value of `y - z'. The return value is not evaluated, so message (2) is not printed until the explicit evaluation `''%'. (%i1) x: %pi; (%o1) %pi (%i2) y: 1234; (%o2) 1234 (%i3) z: 1729 * w; (%o3) 1729 w (%i4) printe1 (x) := block (print ("(1) x is equal to", x), '(print ("(2) x is equal to", x))); (%o4) printe1(x) := block(print("(1) x is equal to", x), '(print("(2) x is equal to", x))) (%i5) printe1 (y - z); (1) x is equal to 1234 - 1729 w (%o5) print((2) x is equal to, x) (%i6) ''%; (2) x is equal to %pi (%o6) %pi `macroexpand' returns a macro expansion. `macroexpand (foo (x))' followed by `''%' is equivalent to `foo (x)' when `foo' is a macro function. (%i1) x: %pi; (%o1) %pi (%i2) y: 1234; (%o2) 1234 (%i3) z: 1729 * w; (%o3) 1729 w (%i4) g (x) ::= buildq ([x], print ("x is equal to", x)); (%o4) g(x) ::= buildq([x], print("x is equal to", x)) (%i5) macroexpand (g (y - z)); (%o5) print(x is equal to, y - z) (%i6) ''%; x is equal to 1234 - 1729 w (%o6) 1234 - 1729 w (%i7) g (y - z); x is equal to 1234 - 1729 w (%o7) 1234 - 1729 w -- Operator: := The function definition operator. `(, ..., ) := ' defines a function named with arguments , ..., and function body . `:=' never evaluates the function body (unless explicitly evaluated by quote-quote `'''). The function so defined may be an ordinary Maxima function (with arguments enclosed in parentheses) or an array function (with arguments enclosed in square brackets). When the last or only function argument is a list of one element, the function defined by `:=' accepts a variable number of arguments. Actual arguments are assigned one-to-one to formal arguments , ..., , and any further actual arguments, if present, are assigned to as a list. All function definitions appear in the same namespace; defining a function `f' within another function `g' does not limit the scope of `f' to `g'. If some formal argument is a quoted symbol, the function defined by `:=' does not evaluate the corresponding actual argument. Otherwise all actual arguments are evaluated. See also `define' and `::='. Examples: `:=' never evaluates the function body (unless explicitly evaluated by quote-quote). (%i1) expr : cos(y) - sin(x); (%o1) cos(y) - sin(x) (%i2) F1 (x, y) := expr; (%o2) F1(x, y) := expr (%i3) F1 (a, b); (%o3) cos(y) - sin(x) (%i4) F2 (x, y) := ''expr; (%o4) F2(x, y) := cos(y) - sin(x) (%i5) F2 (a, b); (%o5) cos(b) - sin(a) The function defined by `:=' may be an ordinary Maxima function or an array function. (%i1) G1 (x, y) := x.y - y.x; (%o1) G1(x, y) := x . y - y . x (%i2) G2 [x, y] := x.y - y.x; (%o2) G2 := x . y - y . x x, y When the last or only function argument is a list of one element, the function defined by `:=' accepts a variable number of arguments. (%i1) H ([L]) := apply ("+", L); (%o1) H([L]) := apply("+", L) (%i2) H (a, b, c); (%o2) c + b + a -- Operator: = The equation operator. An expression ` = ', by itself, represents an unevaluated equation, which might or might not hold. Unevaluated equations may appear as arguments to `solve' and `algsys' or some other functions. The function `is' evaluates `=' to a Boolean value. `is( = )' evaluates ` = ' to `true' when and are identical. That is, and are atoms which are identical, or they are not atoms and their operators are identical and their arguments are identical. Otherwise, `is( = )' evaluates to `false'; it never evaluates to `unknown'. When `is( = )' is `true', and are said to be syntactically equal, in contrast to equivalent expressions, for which `is(equal(, ))' is `true'. Expressions can be equivalent and not syntactically equal. The negation of `=' is represented by `#'. As with `=', an expression ` # ', by itself, is not evaluated. `is( # )' evaluates ` # ' to `true' or `false'. In addition to `is', some other operators evaluate `=' and `#' to `true' or `false', namely `if', `and', `or', and `not'. Note that because of the rules for evaluation of predicate expressions (in particular because `not ' causes evaluation of ), `not = ' is equivalent to `is( # )', instead of ` # '. `rhs' and `lhs' return the right-hand and left-hand sides, respectively, of an equation or inequation. See also `equal' and `notequal'. Examples: An expression ` = ', by itself, represents an unevaluated equation, which might or might not hold. (%i1) eq_1 : a * x - 5 * y = 17; (%o1) a x - 5 y = 17 (%i2) eq_2 : b * x + 3 * y = 29; (%o2) 3 y + b x = 29 (%i3) solve ([eq_1, eq_2], [x, y]); 196 29 a - 17 b (%o3) [[x = ---------, y = -----------]] 5 b + 3 a 5 b + 3 a (%i4) subst (%, [eq_1, eq_2]); 196 a 5 (29 a - 17 b) (%o4) [--------- - --------------- = 17, 5 b + 3 a 5 b + 3 a 196 b 3 (29 a - 17 b) --------- + --------------- = 29] 5 b + 3 a 5 b + 3 a (%i5) ratsimp (%); (%o5) [17 = 17, 29 = 29] `is( = )' evaluates ` = ' to `true' when and are syntactically equal (that is, identical). Expressions can be equivalent and not syntactically equal. (%i1) a : (x + 1) * (x - 1); (%o1) (x - 1) (x + 1) (%i2) b : x^2 - 1; 2 (%o2) x - 1 (%i3) [is (a = b), is (a # b)]; (%o3) [false, true] (%i4) [is (equal (a, b)), is (notequal (a, b))]; (%o4) [true, false] Some operators evaluate `=' and `#' to `true' or `false'. (%i1) if expand ((x + y)^2) = x^2 + 2 * x * y + y^2 then FOO else BAR; (%o1) FOO (%i2) eq_3 : 2 * x = 3 * x; (%o2) 2 x = 3 x (%i3) eq_4 : exp (2) = %e^2; 2 2 (%o3) %e = %e (%i4) [eq_3 and eq_4, eq_3 or eq_4, not eq_3]; (%o4) [false, true, true] Because `not ' causes evaluation of , `not = ' is equivalent to `is( # )'. (%i1) [2 * x # 3 * x, not (2 * x = 3 * x)]; (%o1) [2 x # 3 x, true] (%i2) is (2 * x # 3 * x); (%o2) true -- Operator: and The logical conjunction operator. `and' is an n-ary infix operator; its operands are Boolean expressions, and its result is a Boolean value. `and' forces evaluation (like `is') of one or more operands, and may force evaluation of all operands. Operands are evaluated in the order in which they appear. `and' evaluates only as many of its operands as necessary to determine the result. If any operand is `false', the result is `false' and no further operands are evaluated. The global flag `prederror' governs the behavior of `and' when an evaluated operand cannot be determined to be `true' or `false'. `and' prints an error message when `prederror' is `true'. Otherwise, operands which do not evaluate to `true' or `false' are accepted, and the result is a Boolean expression. `and' is not commutative: `a and b' might not be equal to `b and a' due to the treatment of indeterminate operands. -- Operator: or The logical disjunction operator. `or' is an n-ary infix operator; its operands are Boolean expressions, and its result is a Boolean value. `or' forces evaluation (like `is') of one or more operands, and may force evaluation of all operands. Operands are evaluated in the order in which they appear. `or' evaluates only as many of its operands as necessary to determine the result. If any operand is `true', the result is `true' and no further operands are evaluated. The global flag `prederror' governs the behavior of `or' when an evaluated operand cannot be determined to be `true' or `false'. `or' prints an error message when `prederror' is `true'. Otherwise, operands which do not evaluate to `true' or `false' are accepted, and the result is a Boolean expression. `or' is not commutative: `a or b' might not be equal to `b or a' due to the treatment of indeterminate operands. -- Operator: not The logical negation operator. `not' is a prefix operator; its operand is a Boolean expression, and its result is a Boolean value. `not' forces evaluation (like `is') of its operand. The global flag `prederror' governs the behavior of `not' when its operand cannot be determined to be `true' or `false'. `not' prints an error message when `prederror' is `true'. Otherwise, operands which do not evaluate to `true' or `false' are accepted, and the result is a Boolean expression. -- Function: abs () Returns the absolute value . If is complex, returns the complex modulus of . -- Keyword: additive If `declare(f,additive)' has been executed, then: (1) If `f' is univariate, whenever the simplifier encounters `f' applied to a sum, `f' will be distributed over that sum. I.e. `f(y+x)' will simplify to `f(y)+f(x)'. (2) If `f' is a function of 2 or more arguments, additivity is defined as additivity in the first argument to `f', as in the case of `sum' or `integrate', i.e. `f(h(x)+g(x),x)' will simplify to `f(h(x),x)+f(g(x),x)'. This simplification does not occur when `f' is applied to expressions of the form `sum(x[i],i,lower-limit,upper-limit)'. -- Keyword: allbut works with the `part' commands (i.e. `part', `inpart', `substpart', `substinpart', `dpart', and `lpart'). For example, (%i1) expr : e + d + c + b + a; (%o1) e + d + c + b + a (%i2) part (expr, [2, 5]); (%o2) d + a while (%i1) expr : e + d + c + b + a; (%o1) e + d + c + b + a (%i2) part (expr, allbut (2, 5)); (%o2) e + c + b `allbut' is also recognized by `kill'. (%i1) [aa : 11, bb : 22, cc : 33, dd : 44, ee : 55]; (%o1) [11, 22, 33, 44, 55] (%i2) kill (allbut (cc, dd)); (%o0) done (%i1) [aa, bb, cc, dd]; (%o1) [aa, bb, 33, 44] `kill(allbut(, , ...))' has the effect of `kill(all)' except that it does not kill the symbols , , ... . -- Declaration: antisymmetric If `declare(h,antisymmetric)' is done, this tells the simplifier that `h' is antisymmetric. E.g. `h(x,z,y)' will simplify to `- h(x, y, z)'. That is, it will give (-1)^n times the result given by `symmetric' or `commutative', where n is the number of interchanges of two arguments necessary to convert it to that form. -- Function: cabs () Returns the complex absolute value (the complex modulus) of . -- Function: ceiling () When is a real number, return the least integer that is greater than or equal to . If is a constant expression (`10 * %pi', for example), `ceiling' evaluates using big floating point numbers, and applies `ceiling' to the resulting big float. Because `ceiling' uses floating point evaluation, it's possible, although unlikely, that `ceiling' could return an erroneous value for constant inputs. To guard against errors, the floating point evaluation is done using three values for `fpprec'. For non-constant inputs, `ceiling' tries to return a simplified value. Here are examples of the simplifications that `ceiling' knows about: (%i1) ceiling (ceiling (x)); (%o1) ceiling(x) (%i2) ceiling (floor (x)); (%o2) floor(x) (%i3) declare (n, integer)$ (%i4) [ceiling (n), ceiling (abs (n)), ceiling (max (n, 6))]; (%o4) [n, abs(n), max(n, 6)] (%i5) assume (x > 0, x < 1)$ (%i6) ceiling (x); (%o6) 1 (%i7) tex (ceiling (a)); $$\left \lceil a \right \rceil$$ (%o7) false The function `ceiling' does not automatically map over lists or matrices. Finally, for all inputs that are manifestly complex, `ceiling' returns a noun form. If the range of a function is a subset of the integers, it can be declared to be `integervalued'. Both the `ceiling' and `floor' functions can use this information; for example: (%i1) declare (f, integervalued)$ (%i2) floor (f(x)); (%o2) f(x) (%i3) ceiling (f(x) - 1); (%o3) f(x) - 1 -- Function: charfun (

) Return 0 when the predicate

) -- Function: polymod (

, ) Converts the polynomial

to a modular representation with respect to the current modulus which is the value of the variable `modulus'. `polymod (

, )' specifies a modulus to be used instead of the current value of `modulus'. See `modulus'. -- Function: mod (, ) If and are real numbers and is nonzero, return ` - * floor( / )'. Further for all real , we have `mod (, 0) = '. For a discussion of the definition `mod (, 0) = ', see Section 3.4, of "Concrete Mathematics," by Graham, Knuth, and Patashnik. The function `mod (, 1)' is a sawtooth function with period 1 with `mod (1, 1) = 0' and `mod (0, 1) = 0'. To find the principal argument (a number in the interval `(-%pi, %pi]') of a complex number, use the function ` |-> %pi - mod (%pi - , 2*%pi)', where is an argument. When and are constant expressions (`10 * %pi', for example), `mod' uses the same big float evaluation scheme that `floor' and `ceiling' uses. Again, it's possible, although unlikely, that `mod' could return an erroneous value in such cases. For nonnumerical arguments or , `mod' knows several simplification rules: (%i1) mod (x, 0); (%o1) x (%i2) mod (a*x, a*y); (%o2) a mod(x, y) (%i3) mod (0, x); (%o3) 0 -- Function: oddp () is `true' if is an odd integer. `false' is returned in all other cases. -- Operator: pred As an argument in a call to `ev ()', `pred' causes predicates (expressions which evaluate to `true' or `false') to be evaluated. See `ev'. -- Function: make_random_state () -- Function: make_random_state () -- Function: make_random_state (true) -- Function: make_random_state (false) A random state object represents the state of the random number generator. The state comprises 627 32-bit words. `make_random_state ()' returns a new random state object created from an integer seed value equal to modulo 2^32. may be negative. `make_random_state ()' returns a copy of the random state . `make_random_state (true)' returns a new random state object, using the current computer clock time as the seed. `make_random_state (false)' returns a copy of the current state of the random number generator. -- Function: set_random_state () Copies to the random number generator state. `set_random_state' always returns `done'. -- Function: random () Returns a pseudorandom number. If is an integer, `random ()' returns an integer from 0 through ` - 1' inclusive. If is a floating point number, `random ()' returns a nonnegative floating point number less than . `random' complains with an error if is neither an integer nor a float, or if is not positive. The functions `make_random_state' and `set_random_state' maintain the state of the random number generator. The Maxima random number generator is an implementation of the Mersenne twister MT 19937. Examples: (%i1) s1: make_random_state (654321)$ (%i2) set_random_state (s1); (%o2) done (%i3) random (1000); (%o3) 768 (%i4) random (9573684); (%o4) 7657880 (%i5) random (2^75); (%o5) 11804491615036831636390 (%i6) s2: make_random_state (false)$ (%i7) random (1.0); (%o7) .2310127244107132 (%i8) random (10.0); (%o8) 4.394553645870825 (%i9) random (100.0); (%o9) 32.28666704056853 (%i10) set_random_state (s2); (%o10) done (%i11) random (1.0); (%o11) .2310127244107132 (%i12) random (10.0); (%o12) 4.394553645870825 (%i13) random (100.0); (%o13) 32.28666704056853 -- Function: rationalize () Convert all double floats and big floats in the Maxima expression to their exact rational equivalents. If you are not familiar with the binary representation of floating point numbers, you might be surprised that `rationalize (0.1)' does not equal 1/10. This behavior isn't special to Maxima - the number 1/10 has a repeating, not a terminating, binary representation. (%i1) rationalize (0.5); 1 (%o1) - 2 (%i2) rationalize (0.1); 1 (%o2) -- 10 (%i3) fpprec : 5$ (%i4) rationalize (0.1b0); 209715 (%o4) ------- 2097152 (%i5) fpprec : 20$ (%i6) rationalize (0.1b0); 236118324143482260685 (%o6) ---------------------- 2361183241434822606848 (%i7) rationalize (sin (0.1*x + 5.6)); x 28 (%o7) sin(-- + --) 10 5 Example use: (%i1) unitfrac(r) := block([uf : [], q], if not(ratnump(r)) then error("The input to 'unitfrac' must be a rational number"), while r # 0 do ( uf : cons(q : 1/ceiling(1/r), uf), r : r - q), reverse(uf)); (%o1) unitfrac(r) := block([uf : [], q], if not ratnump(r) then error("The input to 'unitfrac' must be a rational number"), 1 while r # 0 do (uf : cons(q : ----------, uf), r : r - q), 1 ceiling(-) r reverse(uf)) (%i2) unitfrac (9/10); 1 1 1 (%o2) [-, -, --] 2 3 15 (%i3) apply ("+", %); 9 (%o3) -- 10 (%i4) unitfrac (-9/10); 1 (%o4) [- 1, --] 10 (%i5) apply ("+", %); 9 (%o5) - -- 10 (%i6) unitfrac (36/37); 1 1 1 1 1 (%o6) [-, -, -, --, ----] 2 3 8 69 6808 (%i7) apply ("+", %); 36 (%o7) -- 37 -- Function: sign () Attempts to determine the sign of on the basis of the facts in the current data base. It returns one of the following answers: `pos' (positive), `neg' (negative), `zero', `pz' (positive or zero), `nz' (negative or zero), `pn' (positive or negative), or `pnz' (positive, negative, or zero, i.e. nothing known). -- Function: signum () For numeric , returns 0 if is 0, otherwise returns -1 or +1 as is less than or greater than 0, respectively. If is not numeric then a simplified but equivalent form is returned. For example, `signum(-x)' gives `-signum(x)'. -- Function: sort (,

) -- Function: sort () Sorts a list according to a predicate `P' of two arguments, such that `

([k], [k + 1])' is `true' for any two successive elements. The predicate may be specified as the name of a function or binary infix operator, or as a `lambda' expression. If specified as the name of an operator, the name is enclosed in "double quotes". The sorted list is returned as a new object; the argument is not modified. To construct the return value, `sort' makes a shallow copy of the elements of . If the predicate

is not a total order on the elements of , then `sort' might run to completion without error, but the result is undefined. `sort' complains if the predicate evaluates to something other than `true' or `false'. `sort ()' is equivalent to `sort (, orderlessp)'. That is, the default sorting order is ascending, as determined by `orderlessp'. All Maxima atoms and expressions are comparable under `orderlessp', although there are isolated examples of expressions for which `orderlessp' is not transitive; this is a bug. Examples: (%i1) sort ([11, -17, 29b0, 7.55, 3, -5/2, b + a, 9 * c, 19 - 3 * x]); 5 (%o1) [- 17, - -, 3, 7.55, 11, 2.9b1, b + a, 9 c, 19 - 3 x] 2 (%i2) sort ([11, -17, 29b0, 7.55, 3, -5/2, b + a, 9*c, 19 - 3*x], ordergreatp); 5 (%o2) [19 - 3 x, 9 c, b + a, 2.9b1, 11, 7.55, 3, - -, - 17] 2 (%i3) sort ([%pi, 3, 4, %e, %gamma]); (%o3) [3, 4, %e, %gamma, %pi] (%i4) sort ([%pi, 3, 4, %e, %gamma], "<"); (%o4) [%gamma, %e, 3, %pi, 4] (%i5) my_list: [[aa,hh,uu], [ee,cc], [zz,xx,mm,cc], [%pi,%e]]; (%o5) [[aa, hh, uu], [ee, cc], [zz, xx, mm, cc], [%pi, %e]] (%i6) sort (my_list); (%o6) [[%pi, %e], [aa, hh, uu], [ee, cc], [zz, xx, mm, cc]] (%i7) sort (my_list, lambda ([a, b], orderlessp (reverse (a), reverse (b)))); (%o7) [[%pi, %e], [ee, cc], [zz, xx, mm, cc], [aa, hh, uu]] -- Function: sqrt () The square root of . It is represented internally by `^(1/2)'. See also `rootscontract'. `radexpand' if `true' will cause nth roots of factors of a product which are powers of n to be pulled outside of the radical, e.g. `sqrt(16*x^2)' will become `4*x' only if `radexpand' is `true'. -- Option variable: sqrtdispflag Default value: `true' When `sqrtdispflag' is `false', causes `sqrt' to display with exponent 1/2. -- Function: sublis (, ) Makes multiple parallel substitutions into an expression. The variable `sublis_apply_lambda' controls simplification after `sublis'. Example: (%i1) sublis ([a=b, b=a], sin(a) + cos(b)); (%o1) sin(b) + cos(a) -- Function: sublist (,

) Returns the list of elements of for which the predicate `p' returns `true'. Example: (%i1) L: [1, 2, 3, 4, 5, 6]; (%o1) [1, 2, 3, 4, 5, 6] (%i2) sublist (L, evenp); (%o2) [2, 4, 6] -- Option variable: sublis_apply_lambda Default value: `true' - controls whether `lambda''s substituted are applied in simplification after `sublis' is used or whether you have to do an `ev' to get things to apply. `true' means do the application. -- Function: subst (, , ) Substitutes for in . must be an atom or a complete subexpression of . For example, `x+y+z' is a complete subexpression of `2*(x+y+z)/w' while `x+y' is not. When does not have these characteristics, one may sometimes use `substpart' or `ratsubst' (see below). Alternatively, if is of the form `e/f' then one could use `subst (a*f, e, c)' while if is of the form `e^(1/f)' then one could use `subst (a^f, e, c)'. The `subst' command also discerns the `x^y' in `x^-y' so that `subst (a, sqrt(x), 1/sqrt(x))' yields `1/a'. and may also be operators of an expression enclosed in double-quotes `"' or they may be function names. If one wishes to substitute for the independent variable in derivative forms then the `at' function (see below) should be used. `subst' is an alias for `substitute'. `subst (, )' or `subst ([, ..., ], )' are other permissible forms. The are equations indicating substitutions to be made. For each equation, the right side will be substituted for the left in the expression . `exptsubst' if `true' permits substitutions like `y' for `%e^x' in `%e^(a*x)' to take place. When `opsubst' is `false', `subst' will not attempt to substitute into the operator of an expression. E.g. `(opsubst: false, subst (x^2, r, r+r[0]))' will work. Examples: (%i1) subst (a, x+y, x + (x+y)^2 + y); 2 (%o1) y + x + a (%i2) subst (-%i, %i, a + b*%i); (%o2) a - %i b For further examples, do `example (subst)'. -- Function: substinpart (, , , ..., ) Similar to `substpart', but `substinpart' works on the internal representation of . Examples: (%i1) x . 'diff (f(x), x, 2); 2 d (%o1) x . (--- (f(x))) 2 dx (%i2) substinpart (d^2, %, 2); 2 (%o2) x . d (%i3) substinpart (f1, f[1](x + 1), 0); (%o3) f1(x + 1) If the last argument to a part function is a list of indices then several subexpressions are picked out, each one corresponding to an index of the list. Thus (%i1) part (x + y + z, [1, 3]); (%o1) z + x `piece' holds the value of the last expression selected when using the part functions. It is set during the execution of the function and thus may be referred to in the function itself as shown below. If `partswitch' is set to `true' then `end' is returned when a selected part of an expression doesn't exist, otherwise an error message is given. (%i1) expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1; 3 2 2 3 (%o1) 27 y + 54 x y + 36 x y + y + 8 x + x + 1 (%i2) part (expr, 2, [1, 3]); 2 (%o2) 54 y (%i3) sqrt (piece/54); (%o3) abs(y) (%i4) substpart (factor (piece), expr, [1, 2, 3, 5]); 3 (%o4) (3 y + 2 x) + y + x + 1 (%i5) expr: 1/x + y/x - 1/z; 1 y 1 (%o5) - - + - + - z x x (%i6) substpart (xthru (piece), expr, [2, 3]); y + 1 1 (%o6) ----- - - x z Also, setting the option `inflag' to `true' and calling `part' or `substpart' is the same as calling `inpart' or `substinpart'. -- Function: substpart (, , , ..., ) Substitutes for the subexpression picked out by the rest of the arguments as in `part'. It returns the new value of . may be some operator to be substituted for an operator of . In some cases needs to be enclosed in double-quotes `"' (e.g. `substpart ("+", a*b, 0)' yields `b + a'). (%i1) 1/(x^2 + 2); 1 (%o1) ------ 2 x + 2 (%i2) substpart (3/2, %, 2, 1, 2); 1 (%o2) -------- 3/2 x + 2 (%i3) a*x + f(b, y); (%o3) a x + f(b, y) (%i4) substpart ("+", %, 1, 0); (%o4) x + f(b, y) + a Also, setting the option `inflag' to `true' and calling `part' or `substpart' is the same as calling `inpart' or `substinpart'. -- Function: subvarp () Returns `true' if is a subscripted variable, for example `a[i]'. -- Function: symbolp () Returns `true' if is a symbol, else `false'. In effect, `symbolp(x)' is equivalent to the predicate `atom(x) and not numberp(x)'. See also *Note Identifiers::. -- Function: unorder () Disables the aliasing created by the last use of the ordering commands `ordergreat' and `orderless'. `ordergreat' and `orderless' may not be used more than one time each without calling `unorder'. See also `ordergreat' and `orderless'. Examples: (%i1) unorder(); (%o1) [] (%i2) b*x + a^2; 2 (%o2) b x + a (%i3) ordergreat (a); (%o3) done (%i4) b*x + a^2; %th(1) - %th(3); 2 (%o4) a + b x (%i5) unorder(); 2 2 (%o5) a - a -- Function: vectorpotential () Returns the vector potential of a given curl vector, in the current coordinate system. `potentialzeroloc' has a similar role as for `potential', but the order of the left-hand sides of the equations must be a cyclic permutation of the coordinate variables. -- Function: xthru () Combines all terms of (which should be a sum) over a common denominator without expanding products and exponentiated sums as `ratsimp' does. `xthru' cancels common factors in the numerator and denominator of rational expressions but only if the factors are explicit. Sometimes it is better to use `xthru' before `ratsimp'ing an expression in order to cause explicit factors of the gcd of the numerator and denominator to be canceled thus simplifying the expression to be `ratsimp'ed. (%i1) ((x+2)^20 - 2*y)/(x+y)^20 + (x+y)^(-19) - x/(x+y)^20; 20 1 (x + 2) - 2 y x (%o1) --------- + --------------- - --------- 19 20 20 (y + x) (y + x) (y + x) (%i2) xthru (%); 20 (x + 2) - y (%o2) ------------- 20 (y + x) -- Function: zeroequiv (, ) Tests whether the expression in the variable is equivalent to zero, returning `true', `false', or `dontknow'. `zeroequiv' has these restrictions: 1. Do not use functions that Maxima does not know how to differentiate and evaluate. 2. If the expression has poles on the real line, there may be errors in the result (but this is unlikely to occur). 3. If the expression contains functions which are not solutions to first order differential equations (e.g. Bessel functions) there may be incorrect results. 4. The algorithm uses evaluation at randomly chosen points for carefully selected subexpressions. This is always a somewhat hazardous business, although the algorithm tries to minimize the potential for error. For example `zeroequiv (sin(2*x) - 2*sin(x)*cos(x), x)' returns `true' and `zeroequiv (%e^x + x, x)' returns `false'. On the other hand `zeroequiv (log(a*b) - log(a) - log(b), a)' returns `dontknow' because of the presence of an extra parameter `b'.  File: maxima.info, Node: Expressions, Next: Simplification, Prev: Operators, Up: Top 6 Expressions ************* * Menu: * Introduction to Expressions:: * Assignment:: * Complex:: * Nouns and Verbs:: * Identifiers:: * Strings:: * Inequality:: * Syntax:: * Functions and Variables for Expressions::  File: maxima.info, Node: Introduction to Expressions, Next: Assignment, Prev: Expressions, Up: Expressions 6.1 Introduction to Expressions =============================== There are a number of reserved words which cannot be used as variable names. Their use would cause a possibly cryptic syntax error. integrate next from diff in at limit sum for and elseif then else do or if unless product while thru step Most things in Maxima are expressions. A sequence of expressions can be made into an expression by separating them by commas and putting parentheses around them. This is similar to the C comma expression. (%i1) x: 3$ (%i2) (x: x+1, x: x^2); (%o2) 16 (%i3) (if (x > 17) then 2 else 4); (%o3) 4 (%i4) (if (x > 17) then x: 2 else y: 4, y+x); (%o4) 20 Even loops in Maxima are expressions, although the value they return is the not too useful `done'. (%i1) y: (x: 1, for i from 1 thru 10 do (x: x*i))$ (%i2) y; (%o2) done whereas what you really want is probably to include a third term in the comma expression which actually gives back the value. (%i3) y: (x: 1, for i from 1 thru 10 do (x: x*i), x)$ (%i4) y; (%o4) 3628800  File: maxima.info, Node: Assignment, Next: Complex, Prev: Introduction to Expressions, Up: Expressions 6.2 Assignment ============== There are two assignment operators in Maxima, `:' and `::'. E.g., `a: 3' sets the variable `a' to 3. `::' assigns the value of the expression on its right to the value of the quantity on its left, which must evaluate to an atomic variable or subscripted variable.  File: maxima.info, Node: Complex, Next: Nouns and Verbs, Prev: Assignment, Up: Expressions 6.3 Complex =========== A complex expression is specified in Maxima by adding the real part of the expression to `%i' times the imaginary part. Thus the roots of the equation `x^2 - 4*x + 13 = 0' are `2 + 3*%i' and `2 - 3*%i'. Note that simplification of products of complex expressions can be effected by expanding the product. Simplification of quotients, roots, and other functions of complex expressions can usually be accomplished by using the `realpart', `imagpart', `rectform', `polarform', `abs', `carg' functions.  File: maxima.info, Node: Nouns and Verbs, Next: Identifiers, Prev: Complex, Up: Expressions 6.4 Nouns and Verbs =================== Maxima distinguishes between operators which are "nouns" and operators which are "verbs". A verb is an operator which can be executed. A noun is an operator which appears as a symbol in an expression, without being executed. By default, function names are verbs. A verb can be changed into a noun by quoting the function name or applying the `nounify' function. A noun can be changed into a verb by applying the `verbify' function. The evaluation flag `nouns' causes `ev' to evaluate nouns in an expression. The verb form is distinguished by a leading dollar sign `$' on the corresponding Lisp symbol. In contrast, the noun form is distinguished by a leading percent sign `%' on the corresponding Lisp symbol. Some nouns have special display properties, such as `'integrate' and `'derivative' (returned by `diff'), but most do not. By default, the noun and verb forms of a function are identical when displayed. The global flag `noundisp' causes Maxima to display nouns with a leading quote mark `''. See also `noun', `nouns', `nounify', and `verbify'. Examples: (%i1) foo (x) := x^2; 2 (%o1) foo(x) := x (%i2) foo (42); (%o2) 1764 (%i3) 'foo (42); (%o3) foo(42) (%i4) 'foo (42), nouns; (%o4) 1764 (%i5) declare (bar, noun); (%o5) done (%i6) bar (x) := x/17; x (%o6) ''bar(x) := -- 17 (%i7) bar (52); (%o7) bar(52) (%i8) bar (52), nouns; 52 (%o8) -- 17 (%i9) integrate (1/x, x, 1, 42); (%o9) log(42) (%i10) 'integrate (1/x, x, 1, 42); 42 / [ 1 (%o10) I - dx ] x / 1 (%i11) ev (%, nouns); (%o11) log(42)  File: maxima.info, Node: Identifiers, Next: Strings, Prev: Nouns and Verbs, Up: Expressions 6.5 Identifiers =============== Maxima identifiers may comprise alphabetic characters, plus the numerals 0 through 9, plus any special character preceded by the backslash `\' character. A numeral may be the first character of an identifier if it is preceded by a backslash. Numerals which are the second or later characters need not be preceded by a backslash. Characters may be declared alphabetic by the `declare' function. If so declared, they need not be preceded by a backslash in an identifier. The alphabetic characters are initially `A' through `Z', `a' through `z', `%', and `_'. Maxima is case-sensitive. The identifiers `foo', `FOO', and `Foo' are distinct. See *Note Lisp and Maxima:: for more on this point. A Maxima identifier is a Lisp symbol which begins with a dollar sign `$'. Any other Lisp symbol is preceded by a question mark `?' when it appears in Maxima. See *Note Lisp and Maxima:: for more on this point. Examples: (%i1) %an_ordinary_identifier42; (%o1) %an_ordinary_identifier42 (%i2) embedded\ spaces\ in\ an\ identifier; (%o2) embedded spaces in an identifier (%i3) symbolp (%); (%o3) true (%i4) [foo+bar, foo\+bar]; (%o4) [foo + bar, foo+bar] (%i5) [1729, \1729]; (%o5) [1729, 1729] (%i6) [symbolp (foo\+bar), symbolp (\1729)]; (%o6) [true, true] (%i7) [is (foo\+bar = foo+bar), is (\1729 = 1729)]; (%o7) [false, false] (%i8) baz\~quux; (%o8) baz~quux (%i9) declare ("~", alphabetic); (%o9) done (%i10) baz~quux; (%o10) baz~quux (%i11) [is (foo = FOO), is (FOO = Foo), is (Foo = foo)]; (%o11) [false, false, false] (%i12) :lisp (defvar *my-lisp-variable* '$foo) *MY-LISP-VARIABLE* (%i12) ?\*my\-lisp\-variable\*; (%o12) foo  File: maxima.info, Node: Strings, Next: Inequality, Prev: Identifiers, Up: Expressions 6.6 Strings =========== Strings (quoted character sequences) are enclosed in double quote marks `"' for input, and displayed with or without the quote marks, depending on the global variable `stringdisp'. Strings may contain any characters, including embedded tab, newline, and carriage return characters. The sequence `\"' is recognized as a literal double quote, and `\\' as a literal backslash. When backslash appears at the end of a line, the backslash and the line termination (either newline or carriage return and newline) are ignored, so that the string continues with the next line. No other special combinations of backslash with another character are recognized; when backslash appears before any character other than `"', `\', or a line termination, the backslash is ignored. There is no way to represent a special character (such as tab, newline, or carriage return) except by embedding the literal character in the string. There is no character type in Maxima; a single character is represented as a one-character string. Maxima strings are implemented as Lisp symbols, not Lisp strings; that may change in a future version of Maxima. Maxima can display Lisp strings and Lisp characters, although some other operations (for example, equality tests) may fail. The `stringproc' add-on package contains many functions for working with strings. Examples: (%i1) s_1 : "This is a Maxima string."; (%o1) This is a Maxima string. (%i2) s_2 : "Embedded \"double quotes\" and backslash \\ characters."; (%o2) Embedded "double quotes" and backslash \ characters. (%i3) s_3 : "Embedded line termination in this string."; (%o3) Embedded line termination in this string. (%i4) s_4 : "Ignore the \ line termination \ characters in \ this string."; (%o4) Ignore the line termination characters in this string. (%i5) stringdisp : false; (%o5) false (%i6) s_1; (%o6) This is a Maxima string. (%i7) stringdisp : true; (%o7) true (%i8) s_1; (%o8) "This is a Maxima string."  File: maxima.info, Node: Inequality, Next: Syntax, Prev: Strings, Up: Expressions 6.7 Inequality ============== Maxima has the inequality operators `<', `<=', `>=', `>', `#', and `notequal'. See `if' for a description of conditional expressions.  File: maxima.info, Node: Syntax, Next: Functions and Variables for Expressions, Prev: Inequality, Up: Expressions 6.8 Syntax ========== It is possible to define new operators with specified precedence, to undefine existing operators, or to redefine the precedence of existing operators. An operator may be unary prefix or unary postfix, binary infix, n-ary infix, matchfix, or nofix. "Matchfix" means a pair of symbols which enclose their argument or arguments, and "nofix" means an operator which takes no arguments. As examples of the different types of operators, there are the following. unary prefix negation `- a' unary postfix factorial `a!' binary infix exponentiation `a^b' n-ary infix addition `a + b' matchfix list construction `[a, b]' (There are no built-in nofix operators; for an example of such an operator, see `nofix'.) The mechanism to define a new operator is straightforward. It is only necessary to declare a function as an operator; the operator function might or might not be defined. An example of user-defined operators is the following. Note that the explicit function call `"dd" (a)' is equivalent to `dd a', likewise `"<-" (a, b)' is equivalent to `a <- b'. Note also that the functions `"dd"' and `"<-"' are undefined in this example. (%i1) prefix ("dd"); (%o1) dd (%i2) dd a; (%o2) dd a (%i3) "dd" (a); (%o3) dd a (%i4) infix ("<-"); (%o4) <- (%i5) a <- dd b; (%o5) a <- dd b (%i6) "<-" (a, "dd" (b)); (%o6) a <- dd b The Maxima functions which define new operators are summarized in this table, stating the default left and right binding powers (lbp and rbp, respectively). (Binding power determines operator precedence. However, since left and right binding powers can differ, binding power is somewhat more complicated than precedence.) Some of the operation definition functions take additional arguments; see the function descriptions for details. `prefix' rbp=180 `postfix' lbp=180 `infix' lbp=180, rbp=180 `nary' lbp=180, rbp=180 `matchfix' (binding power not applicable) `nofix' (binding power not applicable) For comparison, here are some built-in operators and their left and right binding powers. Operator lbp rbp : 180 20 :: 180 20 := 180 20 ::= 180 20 ! 160 !! 160 ^ 140 139 . 130 129 * 120 / 120 120 + 100 100 - 100 134 = 80 80 # 80 80 > 80 80 >= 80 80 < 80 80 <= 80 80 not 70 and 65 or 60 , 10 $ -1 ; -1 `remove' and `kill' remove operator properties from an atom. `remove ("", op)' removes only the operator properties of . `kill ("")' removes all properties of , including the operator properties. Note that the name of the operator must be enclosed in quotation marks. (%i1) infix ("##"); (%o1) ## (%i2) "##" (a, b) := a^b; b (%o2) a ## b := a (%i3) 5 ## 3; (%o3) 125 (%i4) remove ("##", op); (%o4) done (%i5) 5 ## 3; Incorrect syntax: # is not a prefix operator 5 ## ^ (%i5) "##" (5, 3); (%o5) 125 (%i6) infix ("##"); (%o6) ## (%i7) 5 ## 3; (%o7) 125 (%i8) kill ("##"); (%o8) done (%i9) 5 ## 3; Incorrect syntax: # is not a prefix operator 5 ## ^ (%i9) "##" (5, 3); (%o9) ##(5, 3)  File: maxima.info, Node: Functions and Variables for Expressions, Prev: Syntax, Up: Expressions 6.9 Functions and Variables for Expressions =========================================== -- Function: at (, [, ..., ]) -- Function: at (, ) Evaluates the expression with the variables assuming the values as specified for them in the list of equations `[, ..., ]' or the single equation . If a subexpression depends on any of the variables for which a value is specified but there is no atvalue specified and it can't be otherwise evaluated, then a noun form of the `at' is returned which displays in a two-dimensional form. `at' carries out multiple substitutions in series, not parallel. See also `atvalue'. For other functions which carry out substitutions, see also `subst' and `ev'. Examples: (%i1) atvalue (f(x,y), [x = 0, y = 1], a^2); 2 (%o1) a (%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y); (%o2) @2 + 1 (%i3) printprops (all, atvalue); ! d ! --- (f(@1, @2))! = @2 + 1 d@1 ! !@1 = 0 2 f(0, 1) = a (%o3) done (%i4) diff (4*f(x, y)^2 - u(x, y)^2, x); d d (%o4) 8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y))) dx dx (%i5) at (%, [x = 0, y = 1]); ! 2 d ! (%o5) 16 a - 2 u(0, 1) (-- (u(x, y))! ) dx ! !x = 0, y = 1 -- Function: box () -- Function: box (, ) Returns enclosed in a box. The return value is an expression with `box' as the operator and as the argument. A box is drawn on the display when `display2d' is `true'. `box (, )' encloses in a box labelled by the symbol . The label is truncated if it is longer than the width of the box. `box' evaluates its argument. However, a boxed expression does not evaluate to its content, so boxed expressions are effectively excluded from computations. `boxchar' is the character used to draw the box in `box' and in the `dpart' and `lpart' functions. Examples: (%i1) box (a^2 + b^2); """"""""" " 2 2" (%o1) "b + a " """"""""" (%i2) a : 1234; (%o2) 1234 (%i3) b : c - d; (%o3) c - d (%i4) box (a^2 + b^2); """""""""""""""""""" " 2 " (%o4) "(c - d) + 1522756" """""""""""""""""""" (%i5) box (a^2 + b^2, term_1); term_1"""""""""""""" " 2 " (%o5) "(c - d) + 1522756" """""""""""""""""""" (%i6) 1729 - box (1729); """""" (%o6) 1729 - "1729" """""" (%i7) boxchar: "-"; (%o7) - (%i8) box (sin(x) + cos(y)); ----------------- (%o8) -cos(y) + sin(x)- ----------------- -- Option variable: boxchar Default value: `"' `boxchar' is the character used to draw the box in the `box' and in the `dpart' and `lpart' functions. All boxes in an expression are drawn with the current value of `boxchar'; the drawing character is not stored with the box expression. -- Function: carg () Returns the complex argument of . The complex argument is an angle `theta' in `(-%pi, %pi]' such that `r exp (theta %i) = ' where `r' is the magnitude of . `carg' is a computational function, not a simplifying function. `carg' ignores the declaration `declare (, complex)', and treats as a real variable. This is a bug. See also `abs' (complex magnitude), `polarform', `rectform', `realpart', and `imagpart'. Examples: (%i1) carg (1); (%o1) 0 (%i2) carg (1 + %i); %pi (%o2) --- 4 (%i3) carg (exp (%i)); (%o3) 1 (%i4) carg (exp (%pi * %i)); (%o4) %pi (%i5) carg (exp (3/2 * %pi * %i)); %pi (%o5) - --- 2 (%i6) carg (17 * exp (2 * %i)); (%o6) 2 -- Special operator: constant `declare (, constant)' declares to be a constant. See `declare'. -- Function: constantp () Returns `true' if is a constant expression, otherwise returns `false'. An expression is considered a constant expression if its arguments are numbers (including rational numbers, as displayed with `/R/'), symbolic constants such as `%pi', `%e', and `%i', variables bound to a constant or declared constant by `declare', or functions whose arguments are constant. `constantp' evaluates its arguments. Examples: (%i1) constantp (7 * sin(2)); (%o1) true (%i2) constantp (rat (17/29)); (%o2) true (%i3) constantp (%pi * sin(%e)); (%o3) true (%i4) constantp (exp (x)); (%o4) false (%i5) declare (x, constant); (%o5) done (%i6) constantp (exp (x)); (%o6) true (%i7) constantp (foo (x) + bar (%e) + baz (2)); (%o7) false (%i8) -- Function: declare (, , , , ...) Assigns the atom or list of atoms the property or list of properties . When and/or are lists, each of the atoms gets all of the properties. `declare' quotes its arguments. `declare' always returns `done'. As noted in the description for each declaration flag, for some flags `featurep(, )' returns `true' if has been declared to have . However, `featurep' does not recognize some flags; this is a bug. See also `features'. `declare' recognizes the following properties: `evfun' Makes known to `ev' so that the function named by is applied when appears as a flag argument of `ev'. See `evfun'. `evflag' Makes known to the `ev' function so that is bound to `true' during the execution of `ev' when appears as a flag argument of `ev'. See `evflag'. `bindtest' Tells Maxima to trigger an error when is evaluated unbound. `noun' Tells Maxima to parse as a noun. The effect of this is to replace instances of with `'' or `nounify()', depending on the context. `constant' Tells Maxima to consider a symbolic constant. `scalar' Tells Maxima to consider a scalar variable. `nonscalar' Tells Maxima to consider a nonscalar variable. The usual application is to declare a variable as a symbolic vector or matrix. `mainvar' Tells Maxima to consider a "main variable" (`mainvar'). `ordergreatp' determines the ordering of atoms as follows: (main variables) > (other variables) > (scalar variables) > (constants) > (numbers) `alphabetic' Tells Maxima to recognize all characters in (which must be a string) as alphabetic characters. `feature' Tells Maxima to recognize as the name of a feature. Other atoms may then be declared to have the property. `rassociative', `lassociative' Tells Maxima to recognize as a right-associative or left-associative function. `nary' Tells Maxima to recognize as an n-ary function. The `nary' declaration is not the same as calling the `nary' function. The sole effect of `declare(foo, nary)' is to instruct the Maxima simplifier to flatten nested expressions, for example, to simplify `foo(x, foo(y, z))' to `foo(x, y, z)'. `symmetric', `antisymmetric', `commutative' Tells Maxima to recognize as a symmetric or antisymmetric function. `commutative' is the same as `symmetric'. `oddfun', `evenfun' Tells Maxima to recognize as an odd or even function. `outative' Tells Maxima to simplify expressions by pulling constant factors out of the first argument. When has one argument, a factor is considered constant if it is a literal or declared constant. When has two or more arguments, a factor is considered constant if the second argument is a symbol and the factor is free of the second argument. `multiplicative' Tells Maxima to simplify expressions by the substitution `(x * y * z * ...)' `-->' `(x) * (y) * (z) * ...'. The substitution is carried out on the first argument only. `additive' Tells Maxima to simplify expressions by the substitution `(x + y + z + ...)' `-->' `(x) + (y) + (z) + ...'. The substitution is carried out on the first argument only. `linear' Equivalent to declaring both `outative' and `additive'. `integer', `noninteger' Tells Maxima to recognize as an integer or noninteger variable. `even', `odd' Tells Maxima to recognize as an even or odd integer variable. `rational', `irrational' Tells Maxima to recognize as a rational or irrational real variable. `real', `imaginary', `complex' Tells Maxima to recognize as a real, pure imaginary, or complex variable. `increasing', `decreasing' Tells Maxima to recognize as an increasing or decreasing function. `posfun' Tells Maxima to recognize as a positive function. `integervalued' Tells Maxima to recognize as an integer-valued function. Examples: `evfun' and `evflag' declarations. (%i1) declare (expand, evfun); (%o1) done (%i2) (a + b)^3; 3 (%o2) (b + a) (%i3) (a + b)^3, expand; 3 2 2 3 (%o3) b + 3 a b + 3 a b + a (%i4) declare (demoivre, evflag); (%o4) done (%i5) exp (a + b*%i); %i b + a (%o5) %e (%i6) exp (a + b*%i), demoivre; a (%o6) %e (%i sin(b) + cos(b)) `bindtest' declaration. (%i1) aa + bb; (%o1) bb + aa (%i2) declare (aa, bindtest); (%o2) done (%i3) aa + bb; aa unbound variable -- an error. Quitting. To debug this try debugmode(true); (%i4) aa : 1234; (%o4) 1234 (%i5) aa + bb; (%o5) bb + 1234 `noun' declaration. (%i1) factor (12345678); 2 (%o1) 2 3 47 14593 (%i2) declare (factor, noun); (%o2) done (%i3) factor (12345678); (%o3) factor(12345678) (%i4) ''%, nouns; 2 (%o4) 2 3 47 14593 `constant', `scalar', `nonscalar', and `mainvar' declarations. `alphabetic' declaration. (%i1) xx\~yy\`\@ : 1729; (%o1) 1729 (%i2) declare ("~`@", alphabetic); (%o2) done (%i3) xx~yy`@ + @yy`xx + `xx@@yy~; (%o3) `xx@@yy~ + @yy`xx + 1729 (%i4) listofvars (%); (%o4) [@yy`xx, `xx@@yy~] `feature' declaration. (%i1) declare (FOO, feature); (%o1) done (%i2) declare (x, FOO); (%o2) done (%i3) featurep (x, FOO); (%o3) true `rassociative' and `lassociative' declarations. `nary' declaration. (%i1) H (H (a, b), H (c, H (d, e))); (%o1) H(H(a, b), H(c, H(d, e))) (%i2) declare (H, nary); (%o2) done (%i3) H (H (a, b), H (c, H (d, e))); (%o3) H(a, b, c, d, e) `symmetric' and `antisymmetric' declarations. (%i1) S (b, a); (%o1) S(b, a) (%i2) declare (S, symmetric); (%o2) done (%i3) S (b, a); (%o3) S(a, b) (%i4) S (a, c, e, d, b); (%o4) S(a, b, c, d, e) (%i5) T (b, a); (%o5) T(b, a) (%i6) declare (T, antisymmetric); (%o6) done (%i7) T (b, a); (%o7) - T(a, b) (%i8) T (a, c, e, d, b); (%o8) T(a, b, c, d, e) `oddfun' and `evenfun' declarations. (%i1) o (- u) + o (u); (%o1) o(u) + o(- u) (%i2) declare (o, oddfun); (%o2) done (%i3) o (- u) + o (u); (%o3) 0 (%i4) e (- u) - e (u); (%o4) e(- u) - e(u) (%i5) declare (e, evenfun); (%o5) done (%i6) e (- u) - e (u); (%o6) 0 `outative' declaration. (%i1) F1 (100 * x); (%o1) F1(100 x) (%i2) declare (F1, outative); (%o2) done (%i3) F1 (100 * x); (%o3) 100 F1(x) (%i4) declare (zz, constant); (%o4) done (%i5) F1 (zz * y); (%o5) zz F1(y) `multiplicative' declaration. (%i1) F2 (a * b * c); (%o1) F2(a b c) (%i2) declare (F2, multiplicative); (%o2) done (%i3) F2 (a * b * c); (%o3) F2(a) F2(b) F2(c) `additive' declaration. (%i1) F3 (a + b + c); (%o1) F3(c + b + a) (%i2) declare (F3, additive); (%o2) done (%i3) F3 (a + b + c); (%o3) F3(c) + F3(b) + F3(a) `linear' declaration. (%i1) 'sum (F(k) + G(k), k, 1, inf); inf ==== \ (%o1) > (G(k) + F(k)) / ==== k = 1 (%i2) declare (nounify (sum), linear); (%o2) done (%i3) 'sum (F(k) + G(k), k, 1, inf); inf inf ==== ==== \ \ (%o3) > G(k) + > F(k) / / ==== ==== k = 1 k = 1 -- Function: disolate (, , ..., ) is similar to `isolate (, )' except that it enables the user to isolate more than one variable simultaneously. This might be useful, for example, if one were attempting to change variables in a multiple integration, and that variable change involved two or more of the integration variables. This function is autoloaded from `simplification/disol.mac'. A demo is available by `demo("disol")$'. -- Function: dispform () Returns the external representation of with respect to its main operator. This should be useful in conjunction with `part' which also deals with the external representation. Suppose is -A . Then the internal representation of is "*"(-1,A), while the external representation is "-"(A). `dispform (, all)' converts the entire expression (not just the top-level) to external format. For example, if `expr: sin (sqrt (x))', then `freeof (sqrt, expr)' and `freeof (sqrt, dispform (expr))' give `true', while `freeof (sqrt, dispform (expr, all))' gives `false'. -- Function: distrib () Distributes sums over products. It differs from `expand' in that it works at only the top level of an expression, i.e., it doesn't recurse and it is faster than `expand'. It differs from `multthru' in that it expands all sums at that level. Examples: (%i1) distrib ((a+b) * (c+d)); (%o1) b d + a d + b c + a c (%i2) multthru ((a+b) * (c+d)); (%o2) (b + a) d + (b + a) c (%i3) distrib (1/((a+b) * (c+d))); 1 (%o3) --------------- (b + a) (d + c) (%i4) expand (1/((a+b) * (c+d)), 1, 0); 1 (%o4) --------------------- b d + a d + b c + a c -- Function: dpart (, , ..., ) Selects the same subexpression as `part', but instead of just returning that subexpression as its value, it returns the whole expression with the selected subexpression displayed inside a box. The box is actually part of the expression. (%i1) dpart (x+y/z^2, 1, 2, 1); y (%o1) ---- + x 2 """ "z" """ -- Function: exp () Represents the exponential function. Instances of `exp ()' in input are simplified to `%e^'; `exp' does not appear in simplified expressions. `demoivre' if `true' causes `%e^(a + b %i)' to simplify to `%e^(a (cos(b) + %i sin(b)))' if `b' is free of `%i'. See `demoivre'. `%emode', when `true', causes `%e^(%pi %i x)' to be simplified. See `%emode'. `%enumer', when `true' causes `%e' to be replaced by 2.718... whenever `numer' is `true'. See `%enumer'. -- Option variable: %emode Default value: `true' When `%emode' is `true', `%e^(%pi %i x)' is simplified as follows. `%e^(%pi %i x)' simplifies to `cos (%pi x) + %i sin (%pi x)' if `x' is an integer or a multiple of 1/2, 1/3, 1/4, or 1/6, and then further simplified. For other numerical `x', `%e^(%pi %i x)' simplifies to `%e^(%pi %i y)' where `y' is `x - 2 k' for some integer `k' such that `abs(y) < 1'. When `%emode' is `false', no special simplification of `%e^(%pi %i x)' is carried out. -- Option variable: %enumer Default value: `false' When `%enumer' is `true', `%e' is replaced by its numeric value 2.718... whenever `numer' is `true'. When `%enumer' is `false', this substitution is carried out only if the exponent in `%e^x' evaluates to a number. See also `ev' and `numer'. -- Option variable: exptisolate Default value: `false' `exptisolate', when `true', causes `isolate (expr, var)' to examine exponents of atoms (such as `%e') which contain `var'. -- Option variable: exptsubst Default value: `false' `exptsubst', when `true', permits substitutions such as `y' for `%e^x' in `%e^(a x)'. -- Function: freeof (, ..., , ) `freeof (, )' Returns `true' if no subexpression of is equal to or if occurs only as a dummy variable in , and returns `false' otherwise. `freeof (, ..., , )' is equivalent to `freeof (, ) and ... and freeof (, )'. The arguments , ..., may be names of functions and variables, subscripted names, operators (enclosed in double quotes), or general expressions. `freeof' evaluates its arguments. `freeof' operates only on as it stands (after simplification and evaluation) and does not attempt to determine if some equivalent expression would give a different result. In particular, simplification may yield an equivalent but different expression which comprises some different elements than the original form of . A variable is a dummy variable in an expression if it has no binding outside of the expression. Dummy variables recognized by `freeof' are the index of a sum or product, the limit variable in `limit', the integration variable in the definite integral form of `integrate', the original variable in `laplace', formal variables in `at' expressions, and arguments in `lambda' expressions. Local variables in `block' are not recognized by `freeof' as dummy variables; this is a bug. The indefinite form of `integrate' is not free of its variable of integration. * Arguments are names of functions, variables, subscripted names, operators, and expressions. `freeof (a, b, expr)' is equivalent to `freeof (a, expr) and freeof (b, expr)'. (%i1) expr: z^3 * cos (a[1]) * b^(c+d); d + c 3 (%o1) cos(a ) b z 1 (%i2) freeof (z, expr); (%o2) false (%i3) freeof (cos, expr); (%o3) false (%i4) freeof (a[1], expr); (%o4) false (%i5) freeof (cos (a[1]), expr); (%o5) false (%i6) freeof (b^(c+d), expr); (%o6) false (%i7) freeof ("^", expr); (%o7) false (%i8) freeof (w, sin, a[2], sin (a[2]), b*(c+d), expr); (%o8) true * `freeof' evaluates its arguments. (%i1) expr: (a+b)^5$ (%i2) c: a$ (%i3) freeof (c, expr); (%o3) false * `freeof' does not consider equivalent expressions. Simplification may yield an equivalent but different expression. (%i1) expr: (a+b)^5$ (%i2) expand (expr); 5 4 2 3 3 2 4 5 (%o2) b + 5 a b + 10 a b + 10 a b + 5 a b + a (%i3) freeof (a+b, %); (%o3) true (%i4) freeof (a+b, expr); (%o4) false (%i5) exp (x); x (%o5) %e (%i6) freeof (exp, exp (x)); (%o6) true * A summation or definite integral is free of its dummy variable. An indefinite integral is not free of its variable of integration. (%i1) freeof (i, 'sum (f(i), i, 0, n)); (%o1) true (%i2) freeof (x, 'integrate (x^2, x, 0, 1)); (%o2) true (%i3) freeof (x, 'integrate (x^2, x)); (%o3) false -- Function: genfact (, , ) Returns the generalized factorial, defined as `x (x-z) (x - 2 z) ... (x - (y - 1) z)'. Thus, for integral , `genfact (x, x, 1) = x!' and `genfact (x, x/2, 2) = x!!'. -- Function: imagpart () Returns the imaginary part of the expression . `imagpart' is a computational function, not a simplifying function. See also `abs', `carg', `polarform', `rectform', and `realpart'. -- Function: infix () -- Function: infix (, , ) -- Function: infix (, , , , , ) Declares to be an infix operator. An infix operator is a function of two arguments, with the name of the function written between the arguments. For example, the subtraction operator `-' is an infix operator. `infix ()' declares to be an infix operator with default binding powers (left and right both equal to 180) and parts of speech (left and right both equal to `any'). `infix (, , )' declares to be an infix operator with stated left and right binding powers and default parts of speech (left and right both equal to `any'). `infix (, , , , , )' declares to be an infix operator with stated left and right binding powers and parts of speech. The precedence of with respect to other operators derives from the left and right binding powers of the operators in question. If the left and right binding powers of are both greater the left and right binding powers of some other operator, then takes precedence over the other operator. If the binding powers are not both greater or less, some more complicated relation holds. The associativity of depends on its binding powers. Greater left binding power () implies an instance of is evaluated before other operators to its left in an expression, while greater right binding power () implies an instance of is evaluated before other operators to its right in an expression. Thus greater makes right-associative, while greater makes left-associative. If is equal to , is left-associative. See also `Syntax'. Examples: If the left and right binding powers of are both greater the left and right binding powers of some other operator, then takes precedence over the other operator. (%i1) :lisp (get '$+ 'lbp) 100 (%i1) :lisp (get '$+ 'rbp) 100 (%i1) infix ("##", 101, 101); (%o1) ## (%i2) "##"(a, b) := sconcat("(", a, ",", b, ")"); (%o2) (a ## b) := sconcat("(", a, ",", b, ")") (%i3) 1 + a ## b + 2; (%o3) (a,b) + 3 (%i4) infix ("##", 99, 99); (%o4) ## (%i5) 1 + a ## b + 2; (%o5) (a+1,b+2) Greater makes right-associative, while greater makes left-associative. (%i1) infix ("##", 100, 99); (%o1) ## (%i2) "##"(a, b) := sconcat("(", a, ",", b, ")")$ (%i3) foo ## bar ## baz; (%o3) (foo,(bar,baz)) (%i4) infix ("##", 100, 101); (%o4) ## (%i5) foo ## bar ## baz; (%o5) ((foo,bar),baz) -- Option variable: inflag Default value: `false' When `inflag' is `true', functions for part extraction inspect the internal form of `expr'. Note that the simplifier re-orders expressions. Thus `first (x + y)' returns `x' if `inflag' is `true' and `y' if `inflag' is `false'. (`first (y + x)' gives the same results.) Also, setting `inflag' to `true' and calling `part' or `substpart' is the same as calling `inpart' or `substinpart'. Functions affected by the setting of `inflag' are: `part', `substpart', `first', `rest', `last', `length', the `for' ... `in' construct, `map', `fullmap', `maplist', `reveal' and `pickapart'. -- Function: inpart (, , ..., ) is similar to `part' but works on the internal representation of the expression rather than the displayed form and thus may be faster since no formatting is done. Care should be taken with respect to the order of subexpressions in sums and products (since the order of variables in the internal form is often different from that in the displayed form) and in dealing with unary minus, subtraction, and division (since these operators are removed from the expression). `part (x+y, 0)' or `inpart (x+y, 0)' yield `+', though in order to refer to the operator it must be enclosed in "s. For example `... if inpart (%o9,0) = "+" then ...'. Examples: (%i1) x + y + w*z; (%o1) w z + y + x (%i2) inpart (%, 3, 2); (%o2) z (%i3) part (%th (2), 1, 2); (%o3) z (%i4) 'limit (f(x)^g(x+1), x, 0, minus); g(x + 1) (%o4) limit f(x) x -> 0- (%i5) inpart (%, 1, 2); (%o5) g(x + 1) -- Function: isolate (, ) Returns with subexpressions which are sums and which do not contain var replaced by intermediate expression labels (these being atomic symbols like `%t1', `%t2', ...). This is often useful to avoid unnecessary expansion of subexpressions which don't contain the variable of interest. Since the intermediate labels are bound to the subexpressions they can all be substituted back by evaluating the expression in which they occur. `exptisolate' (default value: `false') if `true' will cause `isolate' to examine exponents of atoms (like `%e') which contain var. `isolate_wrt_times' if `true', then `isolate' will also isolate with respect to products. See `isolate_wrt_times'. Do `example (isolate)' for examples. -- Option variable: isolate_wrt_times Default value: `false' When `isolate_wrt_times' is `true', `isolate' will also isolate with respect to products. E.g. compare both settings of the switch on (%i1) isolate_wrt_times: true$ (%i2) isolate (expand ((a+b+c)^2), c); (%t2) 2 a (%t3) 2 b 2 2 (%t4) b + 2 a b + a 2 (%o4) c + %t3 c + %t2 c + %t4 (%i4) isolate_wrt_times: false$ (%i5) isolate (expand ((a+b+c)^2), c); 2 (%o5) c + 2 b c + 2 a c + %t4 -- Option variable: listconstvars Default value: `false' When `listconstvars' is `true', it will cause `listofvars' to include `%e', `%pi', `%i', and any variables declared constant in the list it returns if they appear in the expression `listofvars' is called on. The default is to omit these. -- Option variable: listdummyvars Default value: `true' When `listdummyvars' is `false', "dummy variables" in the expression will not be included in the list returned by `listofvars'. (The meaning of "dummy variables" is as given in `freeof'. "Dummy variables" are mathematical things like the index of a sum or product, the limit variable, and the definite integration variable.) Example: (%i1) listdummyvars: true$ (%i2) listofvars ('sum(f(i), i, 0, n)); (%o2) [i, n] (%i3) listdummyvars: false$ (%i4) listofvars ('sum(f(i), i, 0, n)); (%o4) [n] -- Function: listofvars () Returns a list of the variables in . `listconstvars' if `true' causes `listofvars' to include `%e', `%pi', `%i', and any variables declared constant in the list it returns if they appear in . The default is to omit these. (%i1) listofvars (f (x[1]+y) / g^(2+a)); (%o1) [g, a, x , y] 1 -- Function: lfreeof (, ) For each member of list, calls `freeof (, )'. It returns `false' if any call to `freeof' does and `true' otherwise. -- Function: lopow (, ) Returns the lowest exponent of which explicitly appears in . Thus (%i1) lopow ((x+y)^2 + (x+y)^a, x+y); (%o1) min(a, 2) -- Function: lpart (

evaluates to `false'; return 1 when the predicate evaluates to `true'. When the predicate evaluates to something other than `true' or `false' (unknown), return a noun form. Examples: (%i1) charfun (x < 1); (%o1) charfun(x < 1) (%i2) subst (x = -1, %); (%o2) 1 (%i3) e : charfun ('"and" (-1 < x, x < 1))$ (%i4) [subst (x = -1, e), subst (x = 0, e), subst (x = 1, e)]; (%o4) [0, 1, 0] -- Declaration: commutative If `declare(h,commutative)' is done, this tells the simplifier that `h' is a commutative function. E.g. `h(x,z,y)' will simplify to `h(x, y, z)'. This is the same as `symmetric'. -- Function: compare (, ) Return a comparison operator (`<', `<=', `>', `>=', `=', or `#') such that `is ( )' evaluates to true; when either or depends on `%i' and ` # ', return `notcomparable'; when there is no such operator or Maxima isn't able to determine the operator, return `unknown'. Examples: (%i1) compare (1, 2); (%o1) < (%i2) compare (1, x); (%o2) unknown (%i3) compare (%i, %i); (%o3) = (%i4) compare (%i, %i + 1); (%o4) notcomparable (%i5) compare (1/x, 0); (%o5) # (%i6) compare (x, abs(x)); (%o6) <= The function `compare' doesn't try to determine whether the real domains of its arguments are nonempty; thus (%i1) compare (acos (x^2 + 1), acos (x^2 + 1) + 1); (%o1) < The real domain of `acos (x^2 + 1)' is empty. -- Function: entier () Returns the largest integer less than or equal to where is numeric. `fix' (as in `fixnum') is a synonym for this, so `fix()' is precisely the same. -- Function: equal (, ) Represents equivalence, that is, equal value. By itself, `equal' does not evaluate or simplify. The function `is' attempts to evaluate `equal' to a Boolean value. `is(equal(, ))' returns `true' (or `false') if and only if and are equal (or not equal) for all possible values of their variables, as determined by evaluating `ratsimp( - )'; if `ratsimp' returns 0, the two expressions are considered equivalent. Two expressions may be equivalent even if they are not syntactically equal (i.e., identical). When `is' fails to reduce `equal' to `true' or `false', the result is governed by the global flag `prederror'. When `prederror' is `true', `is' complains with an error message. Otherwise, `is' returns `unknown'. In addition to `is', some other operators evaluate `equal' and `notequal' to `true' or `false', namely `if', `and', `or', and `not'. The negation of `equal' is `notequal'. Examples: By itself, `equal' does not evaluate or simplify. (%i1) equal (x^2 - 1, (x + 1) * (x - 1)); 2 (%o1) equal(x - 1, (x - 1) (x + 1)) (%i2) equal (x, x + 1); (%o2) equal(x, x + 1) (%i3) equal (x, y); (%o3) equal(x, y) The function `is' attempts to evaluate `equal' to a Boolean value. `is(equal(, ))' returns `true' when `ratsimp( - )' returns 0. Two expressions may be equivalent even if they are not syntactically equal (i.e., identical). (%i1) ratsimp (x^2 - 1 - (x + 1) * (x - 1)); (%o1) 0 (%i2) is (equal (x^2 - 1, (x + 1) * (x - 1))); (%o2) true (%i3) is (x^2 - 1 = (x + 1) * (x - 1)); (%o3) false (%i4) ratsimp (x - (x + 1)); (%o4) - 1 (%i5) is (equal (x, x + 1)); (%o5) false (%i6) is (x = x + 1); (%o6) false (%i7) ratsimp (x - y); (%o7) x - y (%i8) is (equal (x, y)); (%o8) unknown (%i9) is (x = y); (%o9) false When `is' fails to reduce `equal' to `true' or `false', the result is governed by the global flag `prederror'. (%i1) [aa : x^2 + 2*x + 1, bb : x^2 - 2*x - 1]; 2 2 (%o1) [x + 2 x + 1, x - 2 x - 1] (%i2) ratsimp (aa - bb); (%o2) 4 x + 2 (%i3) prederror : true; (%o3) true (%i4) is (equal (aa, bb)); Maxima was unable to evaluate the predicate: 2 2 equal(x + 2 x + 1, x - 2 x - 1) -- an error. Quitting. To debug this try debugmode(true); (%i5) prederror : false; (%o5) false (%i6) is (equal (aa, bb)); (%o6) unknown Some operators evaluate `equal' and `notequal' to `true' or `false'. (%i1) if equal (y, y - 1) then FOO else BAR; (%o1) BAR (%i2) eq_1 : equal (x, x + 1); (%o2) equal(x, x + 1) (%i3) eq_2 : equal (y^2 + 2*y + 1, (y + 1)^2); 2 2 (%o3) equal(y + 2 y + 1, (y + 1) ) (%i4) [eq_1 and eq_2, eq_1 or eq_2, not eq_1]; (%o4) [false, true, true] Because `not ' causes evaluation of , `not equal(, )' is equivalent to `is(notequal(, ))'. (%i1) [notequal (2*z, 2*z - 1), not equal (2*z, 2*z - 1)]; (%o1) [notequal(2 z, 2 z - 1), true] (%i2) is (notequal (2*z, 2*z - 1)); (%o2) true -- Function: floor () When is a real number, return the largest integer that is less than or equal to . If is a constant expression (`10 * %pi', for example), `floor' evaluates using big floating point numbers, and applies floor to the resulting big float. Because floor uses floating point evaluation, it's possible, although unlikely, that `floor' could return an erroneous value for constant inputs. To guard against errors, the floating point evaluation is done using three values for `fpprec'. For non-constant inputs, `floor' tries to return a simplified value. Here are examples of the simplifications that `floor' knows about: (%i1) floor (ceiling (x)); (%o1) ceiling(x) (%i2) floor (floor (x)); (%o2) floor(x) (%i3) declare (n, integer)$ (%i4) [floor (n), floor (abs (n)), floor (min (n, 6))]; (%o4) [n, abs(n), min(n, 6)] (%i5) assume (x > 0, x < 1)$ (%i6) floor (x); (%o6) 0 (%i7) tex (floor (a)); $$\left \lfloor a \right \rfloor$$ (%o7) false The function `floor' does not automatically map over lists or matrices. Finally, for all inputs that are manifestly complex, `floor' returns a noun form. If the range of a function is a subset of the integers, it can be declared to be `integervalued'. Both the `ceiling' and `floor' functions can use this information; for example: (%i1) declare (f, integervalued)$ (%i2) floor (f(x)); (%o2) f(x) (%i3) ceiling (f(x) - 1); (%o3) f(x) - 1 -- Function: notequal (, ) Represents the negation of `equal(, )'. Examples: (%i1) equal (a, b); (%o1) equal(a, b) (%i2) maybe (equal (a, b)); (%o2) unknown (%i3) notequal (a, b); (%o3) notequal(a, b) (%i4) not equal (a, b); (%o4) notequal(a, b) (%i5) maybe (notequal (a, b)); (%o5) unknown (%i6) assume (a > b); (%o6) [a > b] (%i7) equal (a, b); (%o7) equal(a, b) (%i8) maybe (equal (a, b)); (%o8) false (%i9) notequal (a, b); (%o9) notequal(a, b) (%i10) maybe (notequal (a, b)); (%o10) true -- Operator: eval As an argument in a call to `ev ()', `eval' causes an extra evaluation of . See `ev'. -- Function: evenp () Returns `true' if is an even integer. `false' is returned in all other cases. -- Function: fix () A synonym for `entier ()'. -- Function: fullmap (, , ...) Similar to `map', but `fullmap' keeps mapping down all subexpressions until the main operators are no longer the same. `fullmap' is used by the Maxima simplifier for certain matrix manipulations; thus, Maxima sometimes generates an error message concerning `fullmap' even though `fullmap' was not explicitly called by the user. Examples: (%i1) a + b * c; (%o1) b c + a (%i2) fullmap (g, %); (%o2) g(b) g(c) + g(a) (%i3) map (g, %th(2)); (%o3) g(b c) + g(a) -- Function: fullmapl (, , ...) Similar to `fullmap', but `fullmapl' only maps onto lists and matrices. Example: (%i1) fullmapl ("+", [3, [4, 5]], [[a, 1], [0, -1.5]]); (%o1) [[a + 3, 4], [4, 3.5]] -- Function: is () Attempts to determine whether the predicate is provable from the facts in the `assume' database. If the predicate is provably `true' or `false', `is' returns `true' or `false', respectively. Otherwise, the return value is governed by the global flag `prederror'. When `prederror' is `true', `is' complains with an error message. Otherwise, `is' returns `unknown'. `ev(, pred)' (which can be written `, pred' at the interactive prompt) is equivalent to `is()'. See also `assume', `facts', and `maybe'. Examples: `is' causes evaluation of predicates. (%i1) %pi > %e; (%o1) %pi > %e (%i2) is (%pi > %e); (%o2) true `is' attempts to derive predicates from the `assume' database. (%i1) assume (a > b); (%o1) [a > b] (%i2) assume (b > c); (%o2) [b > c] (%i3) is (a < b); (%o3) false (%i4) is (a > c); (%o4) true (%i5) is (equal (a, c)); (%o5) false If `is' can neither prove nor disprove a predicate from the `assume' database, the global flag `prederror' governs the behavior of `is'. (%i1) assume (a > b); (%o1) [a > b] (%i2) prederror: true$ (%i3) is (a > 0); Maxima was unable to evaluate the predicate: a > 0 -- an error. Quitting. To debug this try debugmode(true); (%i4) prederror: false$ (%i5) is (a > 0); (%o5) unknown -- Function: maybe () Attempts to determine whether the predicate is provable from the facts in the `assume' database. If the predicate is provably `true' or `false', `maybe' returns `true' or `false', respectively. Otherwise, `maybe' returns `unknown'. `maybe' is functionally equivalent to `is' with `prederror: false', but the result is computed without actually assigning a value to `prederror'. See also `assume', `facts', and `is'. Examples: (%i1) maybe (x > 0); (%o1) unknown (%i2) assume (x > 1); (%o2) [x > 1] (%i3) maybe (x > 0); (%o3) true -- Function: isqrt () Returns the "integer square root" of the absolute value of , which is an integer. -- Function: lmax () When is a list or a set, return `apply ('max, args ())'. When isn't a list or a set, signal an error. -- Function: lmin () When is a list or a set, return `apply ('min, args ())'. When isn't a list or a set, signal an error. -- Function: max (, ..., ) Return a simplified value for the maximum of the expressions through . When `get (trylevel, maxmin)', is 2 or greater, `max' uses the simplification `max (e, -e) --> |e|'. When `get (trylevel, maxmin)' is 3 or greater, tries to eliminate expressions that are between two other arguments; for example, `max (x, 2*x, 3*x) --> max (x, 3*x)'. To set the value of `trylevel' to 2, use `put (trylevel, 2, maxmin)'. -- Function: min (, ..., ) Return a simplified value for the minimum of the expressions `x_1' through `x_n'. When `get (trylevel, maxmin)', is 2 or greater, `min' uses the simplification `min (e, -e) --> -|e|'. When `get (trylevel, maxmin)' is 3 or greater, `min' tries to eliminate expressions that are between two other arguments; for example, `min (x, 2*x, 3*x) --> min (x, 3*x)'. To set the value of `trylevel' to 2, use `put (trylevel, 2, maxmin)'. -- Function: polymod (