Go to the first, previous, next, last section, table of contents.
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
(%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
There are two assignment operators in Maxima,
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.
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
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
A noun can be changed into a verb by applying the
The evaluation flag
ev to evaluate nouns in an expression.
The verb form is distinguished by
a leading dollar sign
$ on the corresponding Lisp symbol.
the noun form is distinguished by
a leading percent sign
% on the corresponding Lisp symbol.
Some nouns have special display properties, such as
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
(%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)
Maxima identifiers may comprise alphabetic characters,
plus the numerals 0 through 9,
plus any special character preceded by the backslash
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.
A special character may be declared alphabetic by the
If so declared, it need not be preceded by a backslash in an identifier.
The alphabetic characters are initially
Maxima is case-sensitive. The identifiers
Foo are distinct.
See section 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 section Lisp and Maxima for more on this point.
(%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
Maxima has the inequality operators
if for a description of conditional expressions.
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.
a + b
(There are no built-in nofix operators;
for an example of such an operator, see
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
"<-" (a, b) is equivalent to
a <- b.
Note also that the functions
"<-" 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.
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
kill remove operator properties from an atom.
remove ("a", op) removes only the operator properties of a.
kill ("a") removes all properties of a, 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 an infix 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 an infix operator 5 @ ^ (%i9) "@" (5, 3); (%o9) @(5, 3)
[eqn_1, ..., eqn_n]or the single equation eqn.
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.
For other functions which carry out substitutions,
(%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
boxas the operator and expr as the argument. A box is drawn on the display when
box (expr, a)
encloses expr in a box labelled by the symbol a.
The label is truncated if it is longer than the width of the box.
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
and in the
boxchar is the character used to draw the box in the
and in the
All boxes in an expression are drawn with the current value of
the drawing character is not stored with the box expression.
(-%pi, %pi]such that
r exp (theta %i) = zwhere
ris the magnitude of z.
carg is a computational function,
not a simplifying function.
carg ignores the declaration
declare (x, complex),
and treats x as a real variable.
This is a bug.
abs (complex magnitude),
(%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
declare (a, constant)declares a to be a constant. See
trueif expr is a constant expression, otherwise returns
An expression is considered a constant expression if its arguments are
numbers (including rational numbers, as displayed with
symbolic constants such as
variables bound to a constant or declared constant by
or functions whose arguments are constant.
constantp evaluates its arguments.
declare quotes its arguments.
declare always returns
The possible flags and their meanings are:
constant makes a_i a constant as is
mainvar makes a_i a
mainvar. The ordering scale for atoms: numbers <
%pi) < scalars < other variables < mainvars.
scalar makes a_i a scalar.
nonscalar makes a_i behave as does a list or matrix with respect to
the dot operator.
noun makes the function a_i a noun so that it won't be evaluated
evfun makes a_i known to the
ev function so that it will get applied
if its name is mentioned. See
evflag makes a_i known to the
ev function so that it will be bound to
true during the execution of
ev if it is mentioned. See
bindtest causes a_i to signal an error if it ever is used in a
Maxima currently recognizes and uses the following features of objects:
even, odd, integer, rational, irrational, real, imaginary, and complex
The useful features of functions include:
increasing, decreasing, oddfun (odd function), evenfun (even function), commutative (or symmetric), antisymmetric, lassociative and rassociative
The a_i and f_i may also be lists of objects or features.
featurep (object, feature)
determines if object has been declared to have feature.
isolate (expr, x)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
partwhich also deals with the external representation. Suppose expr is -A . Then the internal representation of expr is "*"(-1,A), while the external representation is "-"(A).
dispform (expr, 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
freeof (sqrt, dispform (expr, all))gives
expandin 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
multthruin that it expands all sums at that level.
(%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
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" """
exp (x)in input are simplified to
expdoes not appear in simplified expressions.
%e^(a + b %i) to simplify to
%e^(a (cos(b) + %i sin(b))) if
b is free of
%e^(%pi %i x) to be simplified. See
%e to be replaced by
%e^(%pi %i x) is simplified as
%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
%e^(%pi %i x) simplifies to
%e^(%pi %i y) where
x - 2 k
for some integer
k such that
abs(y) < 1.
special simplification of
%e^(%pi %i x) is carried out.
%e is replaced by its numeric value
false, this substitution is carried out
only if the exponent in
%e^x evaluates to a number.
isolate (expr, var) to
examine exponents of atoms (such as
%e) which contain
true, permits substitutions such as
freeof (x_1, expr)Returns
trueif no subexpression of expr is equal to x_1 or if x_1 occurs only as a dummy variable in expr, and returns
freeof (x_1, ..., x_n, expr)
is equivalent to
freeof (x_1, expr) and ... and freeof (x_n, expr).
The arguments x_1, ..., x_n
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 expr 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 expr.
A variable is a dummy variable in an expression if it has no binding outside of the expression.
Dummy variables recognized by
the index of a sum or product, the limit variable in
the integration variable in the definite integral form of
the original variable in
formal variables in
and arguments in
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.
freeof (a, b, expr)is equivalent to
freeof (a, expr) and freeof (b, expr).
(%i1) expr: z^3 * cos (a) * 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, expr); (%o4) false (%i5) freeof (cos (a), expr); (%o5) false (%i6) freeof (b^(c+d), expr); (%o6) false (%i7) freeof ("^", expr); (%o7) false (%i8) freeof (w, sin, a, sin (a), b*(c+d), expr); (%o8) true
freeofevaluates its arguments.
(%i1) expr: (a+b)^5$ (%i2) c: a$ (%i3) freeof (c, expr); (%o3) false
freeofdoes 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
(%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
x (x-z) (x - 2 z) ... (x - (y - 1) z). Thus, for integral x,
genfact (x, x, 1) = x!and
genfact (x, x/2, 2) = x!!.
imagpart is a computational function,
not a simplifying function.
-is an infix operator.
infix (op) declares op 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
infix (op, lbp, rbp) declares op to be an infix operator
with stated left and right binding powers
and default parts of speech (left and right both equal to
infix (op, lbp, rbp, lpos, rpos, pos)
declares op to be an infix operator
with stated left and right binding powers and parts of speech.
The precedence of op 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 op are both greater the left and right binding powers of some other operator, then op takes precedence over the other operator. If the binding powers are not both greater or less, some more complicated relation holds.
The associativity of op depends on its binding powers. Greater left binding power (lbp) implies an instance of op is evaluated before other operators to its left in an expression, while greater right binding power (rbp) implies an instance of op is evaluated before other operators to its right in an expression. Thus greater lbp makes op right-associative, while greater rbp makes op left-associative. If lbp is equal to rbp, op is left-associative.
(%i1) "@"(a, b) := sconcat("(", a, ",", b, ")")$ (%i2) :lisp (get '$+ 'lbp) 100 (%i2) :lisp (get '$+ 'rbp) 100 (%i2) infix ("@", 101, 101)$ (%i3) 1 + a@b + 2; (%o3) (a,b) + 3 (%i4) infix ("@", 99, 99)$ (%i5) 1 + a@b + 2; (%o5) (a+1,b+2)
(%i1) "@"(a, b) := sconcat("(", a, ",", b, ")")$ (%i2) infix ("@", 100, 99)$ (%i3) foo @ bar @ baz; (%o3) (foo,(bar,baz)) (%i4) infix ("@", 100, 101)$ (%i5) foo @ bar @ baz; (%o5) ((foo,bar),baz)
true, functions for part
extraction inspect the internal form of
Note that the simplifier re-orders expressions.
first (x + y) returns
first (y + x) gives the same results.)
true and calling
the same as calling
Functions affected by the setting of
partbut 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 ....
(%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)
%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:
true will cause
isolate to examine exponents of
%e) which contain var.
isolate will also isolate wrt
example (isolate) for examples.
will also isolate wrt products. E.g. compare both settings of the
(%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
true, it will cause
%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.
false, "dummy variables" in the
expression will not be included in the list returned by
(The meaning of "dummy variables" is as given in
"Dummy variables" are mathematical things like the index of a sum or
product, the limit variable, and the definite integration variable.)
(%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]
listofvars to include
%i, and any variables declared constant in the list it returns if they
appear in expr. The default is to omit these.
(%i1) listofvars (f (x+y) / g^(2+a)); (%o1) [g, a, x , y] 1
freeof (m, expr). It returns
falseif any call to
(%i1) lopow ((x+y)^2 + (x+y)^a, x+y); (%o1) min(a, 2)
dpartbut uses a labelled box. A labelled box is similar to the one produced by
dpartbut it has a name in the top line.
f_1 f_2 ... f_nwhere at least one factor, say f_i, is a sum of terms. Each term in that sum is multiplied by the other factors in the product. (Namely all the factors except f_i).
multthrudoes not expand exponentiated sums. This function is the fastest way to distribute products (commutative or noncommutative) over sums. Since quotients are represented as products
multthrucan be used to divide sums by products as well.
multthru (expr_1, expr_2) multiplies each term in expr_2 (which should be a
sum or an equation) by expr_1. If expr_1 is not itself a sum then this
form is equivalent to
(%i1) x/(x-y)^2 - 1/(x-y) - f(x)/(x-y)^3; 1 x f(x) (%o1) - ----- + -------- - -------- x - y 2 3 (x - y) (x - y) (%i2) multthru ((x-y)^3, %); 2 (%o2) - (x - y) + x (x - y) - f(x) (%i3) ratexpand (%); 2 (%o3) - y + x y - f(x) (%i4) ((a+b)^10*s^2 + 2*a*b*s + (a*b)^2)/(a*b*s^2); 10 2 2 2 (b + a) s + 2 a b s + a b (%o4) ------------------------------ 2 a b s (%i5) multthru (%); /* note that this does not expand (b+a)^10 */ 10 2 a b (b + a) (%o5) - + -- + --------- s 2 a b s (%i6) multthru (a.(b+c.(d+e)+f)); (%o6) a . f + a . c . (e + d) + a . b (%i7) expand (a.(b+c.(d+e)+f)); (%o7) a . f + a . c . e + a . c . d + a . b
exp (expr), etc. count as just one term regardless of how many terms expr has (if it is a sum).
op (expr)is equivalent to
part (expr, 0).
op returns a string if the main operator is
a built-in or user-defined
prefix, binary or n-ary infix, postfix, matchfix, or nofix operator.
op returns a symbol.
op observes the value of the global flag
op evaluates it argument.
(%i1) ?stringdisp: true$ (%i2) op (a * b * c); (%o2) "*" (%i3) op (a * b + c); (%o3) "+" (%i4) op ('sin (a + b)); (%o4) sin (%i5) op (a!); (%o5) "!" (%i6) op (-a); (%o6) "-" (%i7) op ([a, b, c]); (%o7) "[" (%i8) op ('(if a > b then c else d)); (%o8) "if" (%i9) op ('foo (a)); (%o9) foo (%i10) prefix (foo); (%o10) "foo" (%i11) op (foo a); (%o11) "foo"
operatorp (expr, op) returns
if op is equal to the operator of expr.
operatorp (expr, [op_1, ..., op_n]) returns
if some element op_1, ..., op_n is equal to the operator of expr.
optimizealso has the side effect of "collapsing" its argument so that all common subexpressions are shared. Do
example (optimize)for examples.
optimprefix is the prefix used for generated symbols by
trueif expr_2 precedes expr_1 in the ordering set up with the
Thus the complete ordering scale is: numerical constants <
declared constants < declared scalars < first argument to
... < last argument to
orderless < variables which begin with A < ...
< variables which begin with Z < last argument to
... < first argument to
ordergreat < declared
trueif expr_1 precedes expr_2 in the ordering set up by the
expr. It obtains the part of
expras specified by the indices n_1, ..., n_k. First part n_1 of
expris obtained, then part n_2 of that, etc. The result is part n_k of ... part n_2 of part n_1 of
part can be used to obtain an element of a list, a row of a matrix, etc.
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
part (x + y + z, [1, 3]) is
piece holds 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.
partswitch is set to
end is returned when a
selected part of an expression doesn't exist, otherwise an error
message is given.
part (z+2*y, 2, 1) yields 2.
example (part) displays additional examples.
(%i1) partition (2*a*x*f(x), x); (%o1) [2 a, x f(x)] (%i2) partition (a+b, x); (%o2) [b + a, 0] (%i3) partition ([a, b, f(a), c], a); (%o3) [[b, c], [a, f(a)]]
end is returned
when a selected part of an expression doesn't exist, otherwise an
error message is given.
pickapartreturns an expression in terms of intermediate expressions equivalent to the original expression expr.
(%i1) expr: (a+b)/2 + sin (x^2)/3 - log (1 + sqrt(x+1)); 2 sin(x ) b + a (%o1) - log(sqrt(x + 1) + 1) + ------- + ----- 3 2 (%i2) pickapart (expr, 0); 2 sin(x ) b + a (%t2) - log(sqrt(x + 1) + 1) + ------- + ----- 3 2 (%o2) %t2 (%i3) pickapart (expr, 1); (%t3) - log(sqrt(x + 1) + 1) 2 sin(x ) (%t4) ------- 3 b + a (%t5) ----- 2 (%o5) %t5 + %t4 + %t3 (%i5) pickapart (expr, 2); (%t6) log(sqrt(x + 1) + 1) 2 (%t7) sin(x ) (%t8) b + a %t8 %t7 (%o8) -- + -- - %t6 2 3 (%i8) pickapart (expr, 3); (%t9) sqrt(x + 1) + 1 2 (%t10) x b + a sin(%t10) (%o10) ----- - log(%t9) + --------- 2 3 (%i10) pickapart (expr, 4); (%t11) sqrt(x + 1) 2 sin(x ) b + a (%o11) ------- + ----- - log(%t11 + 1) 3 2 (%i11) pickapart (expr, 5); (%t12) x + 1 2 sin(x ) b + a (%o12) ------- + ----- - log(sqrt(%t12) + 1) 3 2 (%i12) pickapart (expr, 6); 2 sin(x ) b + a (%o12) ------- + ----- - log(sqrt(x + 1) + 1) 3 2
partfunctions. It is set during the execution of the function and thus may be referred to in the function itself.
r %e^(%i theta)equivalent to expr, such that
thetaare purely real.
load (powers) loads this function.
expras the index i varies from i_0 to i_1. The evaluation is similar to that of
If i_1 is one less than i_0, the product is an "empty product" and
returns 1 rather than reporting an error. See also
Maxima does not simplify products.
(%i1) product (x + i*(i+1)/2, i, 1, 4); (%o1) (x + 1) (x + 3) (x + 6) (x + 10)
imagpartwill work on expressions involving trigonometic and hyperbolic functions, as well as square root, logarithm, and exponentiation.
a + b %iequivalent to expr, such that a and b are purely real.
rembox (expr, unlabelled) removes all unlabelled boxes from expr.
rembox (expr, label) removes only boxes bearing label.
rembox (expr) removes all boxes, labelled and unlabelled.
Boxes are drawn by the
(%i1) expr: (a*d - b*c)/h^2 + sin(%pi*x); a d - b c (%o1) sin(%pi x) + --------- 2 h (%i2) dpart (dpart (expr, 1, 1), 2, 2); """"""" a d - b c (%o2) sin("%pi x") + --------- """"""" """" " 2" "h " """" (%i3) expr2: lpart (BAR, lpart (FOO, %, 1), 2); FOO""""""""""" BAR"""""""" " """"""" " "a d - b c" (%o3) "sin("%pi x")" + "---------" " """"""" " " """" " """""""""""""" " " 2" " " "h " " " """" " """"""""""" (%i4) rembox (expr2, unlabelled); BAR"""""""" FOO""""""""" "a d - b c" (%o4) "sin(%pi x)" + "---------" """""""""""" " 2 " " h " """"""""""" (%i5) rembox (expr2, FOO); BAR"""""""" """"""" "a d - b c" (%o5) sin("%pi x") + "---------" """"""" " """" " " " 2" " " "h " " " """" " """"""""""" (%i6) rembox (expr2, BAR); FOO""""""""""" " """"""" " a d - b c (%o6) "sin("%pi x")" + --------- " """"""" " """" """""""""""""" " 2" "h " """" (%i7) rembox (expr2); a d - b c (%o7) sin(%pi x) + --------- 2 h
'sumis displayed in sigma notation.
If the upper and lower limits differ by an integer, the summand expr is evaluated for each value of the summation index i, and the results are added together.
Otherwise, if the
true the summation is simplified.
Simplification may sometimes yield a closed form.
If the evaluation flag
false or simplification fails,
the result is a noun form
sum evaluates i_0 and i_1 and quotes i.
The summand expr is quoted under some circumstances,
or evaluated to greater or lesser degree in others.
If i_1 is one less than i_0, the sum is a considered an "empty sum" and
sum returns 0
rather than reporting an error.
When the evaluation flag
the product of summations is expressed as a Cauchy product,
in which the index of the inner summation is a function of the
index of the outer one, rather than varying independently.
The global variable
genindex is the alphabetic prefix used to generate the next index of summation,
when an automatically generated index is needed.
gensumnum is the numeric suffix used to generate the next index of summation,
when an automatically generated index is needed.
false, an automatically-generated index is only
genindex with no numeric suffix.
(%i1) sum (i^2, i, 1, 7); (%o1) 140 (%i2) sum (a[i], i, 1, 7); (%o2) a + a + a + a + a + a + a 7 6 5 4 3 2 1 (%i3) sum (a(i), i, 1, 7); (%o3) a(7) + a(6) + a(5) + a(4) + a(3) + a(2) + a(1) (%i4) sum (a(i), i, 1, n); n ==== \ (%o4) > a(i) / ==== i = 1 (%i5) ev (sum (2^i + i^2, i, 0, n), simpsum); 3 2 n + 1 2 n + 3 n + n (%o5) 2 + --------------- - 1 6 (%i6) ev (sum (1/3^i, i, 1, inf), simpsum); 1 (%o6) - 2 (%i7) ev (sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf), simpsum); 2 (%o7) 5 %pi
A noun form
'lsum is returned
if the argument L does not evaluate to a list.
(%i1) lsum (x^i, i, [1, 2, 7]); 7 2 (%o1) x + x + x (%i2) lsum (i^2, i, rootsof (x^3 - 1)); ==== \ 2 (%o2) > i / ==== 3 i in rootsof(x - 1)
(%i1) verbify ('foo); (%o1) foo (%i2) :lisp $% $FOO (%i2) nounify (foo); (%o2) foo (%i3) :lisp $% %FOO
Go to the first, previous, next, last section, table of contents.