Hmm, agreed this looks wrong. I'd think this should be:
(cond
((or (member a indefinites) (member b indefinites)
(member a infinities) (member b infinities)) nil)
((like a b) t)
...
That is, nothing should compare 'equal' to an indefinite or an infinity. I
would guess that the like clause was intended to be AND and not OR -- that
is, two things that are equal structurally compare equal unless the first
is indefinite (but why not the second, and why not infinities?).
I suppose the comparisons are 'member' rather than 'memq' to allow for the
introduction of NaNs, ((rat) 1 0), etc.
Re bare objects, I suspect it might be easier to wrap all objects in
something like ((mobject simp) <bare object>). Then you can look at all
the cases handling caar = 'bigfloat to see where arithmetic gets delegated.
Of course, you still need to think about things like scalarity.
-s
On Sat, Jun 2, 2012 at 3:43 AM, Rupert Swarbrick <rswarbrick at gmail.com>wrote:
> Hi there,
>
> I've been hunting through some core Maxima code to try to work out where
> one could insert hooks to make simplifications etc. work sensibly with
> bare objects. I noticed that MEQP, used for implementing is(equal(...)),
> contains the following test (line 1000 or so of compar.lisp):
>
> (cond
> ((or (like a b)) (not (member a indefinites)))
> ((or (member a indefinites) (member b indefinites)
> (member a infinities) (member b infinities)) nil)
>
> .... more tests ....
> )
>
> INDEFINITES contains $UND and $IND, so the first bit makes sense (LIKE
> is checking for syntactic equality). But the next bit seems strange to
> me. It has the effect that
>
> (%i1) is(equal(inf, inf));
> (%o1) true
> (%i2) is(equal(inf, 1+inf));
> (%o2) false
>
> The first happens because of the LIKE test, the second because 1+inf
> isn't an atom equal to inf.
>
> This seems really odd to me. Is there a reason we have this behaviour?
>
> Rupert
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>