(maxima.info)Introduction to Expressions
6.1 Introduction to Expressions
===============================
There are a number of reserved words which should not 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
automatically generated by info2www version 1.2.2.9