[Maxima] how to calculate all of possible variants of expression?

Raymond Toy raymond.toy at ericsson.com
Wed Jul 18 13:53:52 CDT 2007


toter at mail.ru wrote:
> excuse me for my english :)
> 
> for example I have something like that
> a:[1,2];
> b:[3,4];
> 
> how to do so that c=a*b;
> 
> must be с=[3,4,6,8] (с=[1*3=3, 1*4=4, 2*3=6, 2*4=8]) 

Here is one way:

  flatten(map(lambda([x],map(lambda([y],x*y),[3,4])),[1,2]));

There are probably better ways.

Ray


More information about the Maxima mailing list