Function: math[cartprod] - Cartesian product

Calling Sequence:

cartprod(L, v);

Parameters:

L - a list of lists
v - (optional) a name

Description:

This function works like and uses combinat/cartprod, but returns a sequence of pairs instead of a table. So evaluating the table returned by combinat/cartprod with a while loop is not necessary.

It is possible to assign the result of math/cartprod to an unassigned second argument. In that case each pair is printed in a separate line on the screen, and the call to math/cartprod returns NULL.

This function is part of the math package, and so can be used only after performing the command with(math) or with(math, cartprod).

Examples:

> with(math, cartprod);

[Maple Math]

> cartprod([[1, 2, 3, 4], [a, b]]);

[Maple Math]

> cartprod([[1, 2, 3, 4], [a, b]], 'p');

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

> p;

[Maple Math]

See Also:

combinat/cartprod .

Version History:

Version 1.00 - September 27, 1997