I've been trying to figure out how to create multisets in Maxima and a function that produces the cartesian product of two multisets. I've tried using lists and row matrices. For example, I can represent the multiset $\{1,2,4,4\}$ as the set $\{1,2,s[1],s[2]\}$, where $s[1]=s[2]=4$. However, this is not flexible and is very cumbersome. Any suggestions?
Asked
Active
Viewed 96 times
2
-
1use (4,2) to represent the element 4 with multiplicity 2. For example the multiset {1,2,4,4} is {(1,1),(2,1),(4,2)}. The multiset {2,2,2,5,5} is {(2,3),(5,2)}. In their Cartesian product, the element (4,2) has multiplicity 6 which is the product of the multiplicity 2 of 4 in the first multiset with the multiplicity 3 of 2 in the second one. The Cartesian product is {((1,2),3),((1,5),2),((2,2),3),((2,5),2),((4,2),6),((4,5),4)}. – Mirko Feb 22 '16 at 03:23