Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Lreduce Calculator

Lreduce

Function: lreduce (<F>, <s>)

Function: lreduce (<F>, <s>, <s_0>) Extends the binary function <F> to an n-ary function by composition, where <s> is a list.

lreduce(<F>, <s>) returns F(... F(F(s_1, s_2), s_3), ... s_n). When the optional argument <s_0> is present, the result is equivalent to lreduce(<F>, cons(<s_0>, <s>)).

The function <F> is first applied to the leftmost list elements, thus the name "lreduce".

See also rreduce, xreduce, and tree_reduce.

Examples:

lreduce without the optional argument.

          (%i1) lreduce (f, [1, 2, 3]);
          (%o1)                     f(f(1, 2), 3)
          (%i2) lreduce (f, [1, 2, 3, 4]);
          (%o2)                  f(f(f(1, 2), 3), 4)

lreduce with the optional argument.

          (%i1) lreduce (f, [1, 2, 3], 4);
          (%o1)                  f(f(f(4, 1), 2), 3)

lreduce applied to built-in binary operators. / is the division operator.

          (%i1) lreduce ("^", args ({a, b, c, d}));
                                         b c d
          (%o1)                       ((a ) )
          (%i2) lreduce ("/", args ({a, b, c, d}));
                                          a
          (%o2)                         -----
                                        b c d

(%o1)                                true
(%i2) 

Lreduce Example

Related Examples

lreduce-matrix

x : matrix([1,2,3],[3...

(lreduce);

Calculate

lreduce

lreduce("*",[1,2,3]);

Calculate

lreduce

v1:1024*2*11*13*23;

v2:1024*2*3*17*29;

v3:1024*3*5*13*19;

Calculate

lreduce

lreduce("*",[a,b,c,d]);

Calculate

lreduce

lreduce("*",[1,2]);

Calculate

lreduce

lreduce("*",[1,2]);

Calculate

lreduce

lreduce("*",[1,2]);

Calculate

lreduce-matrix

x : matrix([1,2,3],[3...

lreduce;

Calculate

lreduce

v1:1024*2*11*13*23;

v2:1024*2*3*17*29;

v3:1024*3*5*13*19;

Calculate

lreduce

lreduce("*",[1]);

Calculate