[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.1 Introduction to Command Line | ||
4.2 Functions and Variables for Command Line |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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
@ref{Category: Evaluation} · @ref{Category: Operators}
The quote-quote operator ''
(two single quote marks) modifies evaluation in input expressions.
Applied to a general expression expr, quote-quote causes the value of expr to be substituted for expr 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 expr, quote-quote causes the value of expr to be substituted for expr 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
@ref{Category: Evaluation} · @ref{Category: Operators}
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
provides an alternate name for a (user or system) function, variable, array, etc. Any even number of arguments may be used.
@ref{Category: Declarations and inferences}
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.
@ref{Category: Debugging} · @ref{Category: Global flags}
Evaluates the expression expr in the environment
specified by the arguments arg_1, ..., arg_n.
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.
simp
causes expr 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
expr to be resimplified without being reevaluated.
nouns
causes the evaluation of noun forms
(typically unevaluated functions such as 'integrate
or 'diff
)
in expr.
expand
causes expansion.
expand (m, n)
causes expansion, setting the values of maxposex
and
maxnegex
to m and n respectively.
detout
causes any matrix inverses computed in expr to have their
determinant kept outside of the inverse rather than dividing through
each element.
diff
causes all differentiations indicated in expr to be performed.
derivlist (x, y, z, ...)
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 expr 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 expr 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 expr.
V: expression
(or alternately V=expression
) causes V
to be bound to the
value of expression
during the evaluation of expr. Note that if V
is a
Maxima option, then expression
is used for its value during the
evaluation of expr. 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 expr.
sum
) cause evaluation of occurrences
of those names in expr as though they were verbs.
F(x)
) may be defined
locally for the purpose of this evaluation of expr by giving
F(x) := expression
as an argument to ev
.
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 (expr, ratsimp, realpart)
is
handled as realpart (ratsimp (expr))
.
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 expr 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
.
%
(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.
noeval
) and simplified according to the arguments. Note that
any function calls in expr will be carried out after the variables in
it are evaluated and that ev(F(x))
thus may behave like F(ev(x))
.
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
expr, arg_1, ..., arg_n
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
@ref{Category: Evaluation}
When a symbol x has the evflag
property,
the expressions ev(expr, x)
and expr, x
(at the interactive prompt) are equivalent to ev(expr, x = true)
.
That is, x is bound to true
while expr is evaluated.
The expression declare(x, evflag)
gives the evflag
property to the variable x.
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
@ref{Category: Evaluation flags} · @ref{Category: Simplification flags and variables}
When a function F has the evfun
property,
the expressions ev(expr, F)
and expr, F
(at the interactive prompt)
are equivalent to F(ev(expr))
.
If two or more evfun
functions F, G, etc., are specified,
the functions are applied in the order that they are specified.
The expression declare(F, evfun)
gives the evfun
property to the function F.
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))
@ref{Category: Evaluation flags}
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.
@ref{Category: Evaluation flags}
Removes all bindings (value, function, array, or rule) from the arguments
a_1, ..., a_n.
An argument a_k may be a symbol or a single array element.
When a_k 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 (n)
, where n is an integer,
unbinds the n most recent input and output labels.
kill ([m, n])
unbinds input and output labels m through n.
kill (infolist)
, where infolist is any item in infolists
(such as values
, functions
, or arrays
)
unbinds all items in infolist.
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 (a_1, ..., a_n))
unbinds all items on all infolists except for a_1, ..., a_n.
kill (allbut (infolist))
unbinds all items except for the ones on infolist,
where infolist 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 (symbol)
unbinds all properties of symbol.
In contrast, remvalue
, remfunction
, remarray
, and remrule
unbind a specific property.
kill
always returns done
, even if an argument has no binding.
@ref{Category: Evaluation} · @ref{Category: Console interaction} · @ref{Category: Session management}
Returns the list of input, output, or intermediate expression labels which begin with symbol.
Typically symbol 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 symbol, 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
.
@ref{Category: Display functions} · @ref{Category: Display flags and variables} · @ref{Category: Console interaction}
The line number of the current pair of input and output expressions.
@ref{Category: Display flags and variables} · @ref{Category: Console interaction}
Default value: []
myoptions
is the list of all options ever reset by the user,
whether or not they get reset to their default value.
@ref{Category: Global variables} · @ref{Category: Session management} · @ref{Category: Console interaction}
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
.
@ref{Category: Global flags} · @ref{Category: Session management}
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.
@ref{Category: Global flags} · @ref{Category: Session management} · @ref{Category: Console interaction}
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 (n)
displays the most recent n expressions.
Each input, output, and intermediate expression counts as one.
playback ([m, n])
displays input, output, and intermediate expressions
with numbers from m through n, inclusive.
playback ([m])
is equivalent to playback ([m, m])
;
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)
.
@ref{Category: Display functions} · @ref{Category: Console interaction}
Displays the property with the indicator i
associated with the atom a. a 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
.
@ref{Category: Declarations and inferences} · @ref{Category: Display functions}
Default value: _
prompt
is the prompt symbol of the demo
function,
playback (slow)
mode, and the Maxima break loop (as invoked by break
).
@ref{Category: Global variables} · @ref{Category: Console interaction}
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
.
@ref{Category: Console interaction}
Unbinds the function definitions of the symbols f_1, ..., f_n.
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.
remfunction
does not apply to array functions or subscripted functions.
remarray
applies to those types of functions.
@ref{Category: Function definition}
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.
@ref{Category: Session management}
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
.
@ref{Category: Display flags and variables} · @ref{Category: Debugging}
Sets the status of feature in package.
After sstatus (feature, package)
is executed,
status (feature, package)
returns true
.
This can be useful for package writers, to
keep track of what features they have loaded in.
@ref{Category: Declarations and inferences}
Enters the Lisp system under Maxima. (to-maxima)
returns to Maxima.
@ref{Category: Console interaction}
Initial value: []
values
is a list of all bound user variables (not Maxima options or switches).
The list comprises symbols bound by :
, ::
, or :=
.
@ref{Category: Evaluation} · @ref{Category: Global variables}
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by root on July, 13 2009 using texi2html 1.76.