Online Algebra Calculator
Many of users do not use powerful Maxima computer algebra system for systematic work, but for ad hoc algebraic calculations – equations, functions, matrixes, etc. only. To do this job, it is not useful to download the whole application from a web site.
Function: xreduce (<F>, <s>)
![Xreduce Example declare (F, nary);
F ([L]) := L;
xreduce (F, [a, b, c, d, e]);
G ([L]) := L;
xreduce (G, [a, b, c, d, e]);
lreduce (G, [a, b, c, d, e]);](http://maxima-online.org//plot.html?g=i1521184752.png&t=img&db=r1134124142)
Function: xreduce (<F>, <s>, <s_0>) Extends the function <F> to an n-ary function by composition, or, if <F> is already n-ary, applies <F> to <s>. When <F> is not n-ary, xreduce is the same as lreduce. The argument <s> is a list.
Functions known to be n-ary include addition +, multiplication *, and, or, max, min, and append. Functions may also be declared n-ary by declare(<F>, nary). For these functions, xreduce is expected to be faster than either rreduce or lreduce.
When the optional argument <s_0> is present, the result is equivalent to xreduce(<s>, cons(<s_0>, <s>)).
Floating point addition is not exactly associative; be that as it may, xreduce applies Maximas n-ary addition when <s> contains floating point numbers.
Examples:
xreduce applied to a function known to be n-ary. F is called once, with all arguments.
(%i1) declare (F, nary);
(%o1) done
(%i2) F ([L]) := L;
(%o2) F([L]) := L
(%i3) xreduce (F, [a, b, c, d, e]);
(%o3) [[[[[("[", simp), a], b], c], d], e] xreduce applied to a function not known to be n-ary. G is called several times, with two arguments each time.
(%i1) G ([L]) := L;
(%o1) G([L]) := L
(%i2) xreduce (G, [a, b, c, d, e]);
(%o2) [[[[[("[", simp), a], b], c], d], e]
(%i3) lreduce (G, [a, b, c, d, e]);
(%o3) [[[[a, b], c], d], e](%o1) true (%i2)