On Dec 12, 2007 1:24 AM, Robert Dodier <robert.dodier at gmail.com> wrote:
> Here's a modification of DIMNARY (called from DIMENSION-NARY) which makes Maxima
> more eager to put in parentheses:...
> I don;'t think that causes any incorrect outputs, but whether the
> number of parentheses is appropriate is a matter of taste.
> DIMNARY as defined above seems to encourage a tasteful
> amount of parentheses. Maybe someone else can try it.
Thanks Robert. I like this much better than the previous behavior.
It looks much better on boolean expressions, but also on mixtures of
commutative and non-commutative multiplication:
a*b.c =>
OLD a b . c NEW a (b . c)
a.b*c =>
OLD a . b c NEW (a . b) c
a.b*c.d =>
OLD a . b c . d NEW (a . b) (c . d)
(Though I think it would look even better if .-product terms sorted to
the right of non-.-product terms, as in math usually scalar terms are
shown to the left of non-scalar expressions.)
I could only find one pathological case which looks strange, but it is
truly pathological and I don't think we need to worry:
'(a."("(a))) =>
OLD a . (a) NEW a . ((a))
This case actually shows that it's an improvement:
'(a."("(a+b))) =>
OLD a . (a+b) NEW a . ((a+b))
The double-parens clarify that the (,) operator is there, while the
old format didn't distinguish it from a.(a+b). But as I say,
single-argument "(" is pretty pathological.
If no one finds any problems with this change, I'd support putting it
in standard Maxima. Thanks again, Robert.
-s