OK, I know why we rejected giving sets the bag property. Some functions,
for example
ratexpand, automatically map over bags. But the mapping doesn't
resimplify. Since
lists and matrices don't have any simplifications, it's not a problem. But
for sets:
OK:
(%i1) ratexpand(set(a*(b+a), a*b + a^2));
(%o1) {a*(b+a),a*b+a^2}
Make a set into a bag:
(%i2) :lisp(defmfun mbagp (x)
(and (not (atom x))
(member (caar x) '(mequal mlist $matrix $set) :test #'eq)))
Oops! The set isn't simplified:
(%i2) ratexpand(set(a*(b+a), a*b + a^2));
(%o2) {a*b+a^2,a*b+a^2}
(%i3) expand(%,0,0);
(%o3) {a*b+a^2}
Of course, the mapping mechanism of ratexpand and friends over bags should
be fixed.
Then sets could be bags. And may that would be good?
Barton
maxima-bounces at math.utexas.edu wrote on 11/09/2010 01:57:45 PM:
> [image removed]
>
> Re: [Maxima] what is a bag?
>
> Barton Willis
>
> to:
>
> Stavros Macrakis
>
> 11/09/2010 01:57 PM
>
> Sent by:
>
> maxima-bounces at math.utexas.edu
>
> Cc:
>
> Edwin Woollett, maxima mailing list, maxima-bounces
>
> Maxima sets aren't bags:
>
> (%i2) :lisp(mbagp `(($set) 1 2))
> NIL
>
> I've forgotten the reason we didn't declare sets to be bags, but I do
> remember
> experimenting with making sets bags.
>
>
> --Barton
>
> maxima-bounces at math.utexas.edu wrote on 11/09/2010 01:47:14 PM:
>
>
> > Bags are container types, including lists, matrices, and sets (and
> > presumably multisets if we ever implement them).
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima