tellsimpafter issue



The issue is how much  work do you want pattern
matching to do?  would you like to have the
expression foo(c,d) match the pattern   foo(a+b,a-b)
 by solving a set of linear equations?  Maybe you
do, but you should realize that writing a pattern
that looks like a+b   is a bad idea, and that the
message "partions sum"  means  "It might work but
you probably misunderstand the way the matcher works".

as for matchin g  pp(a1+a2),  I suggest you do this:

matchdeclare(s,sum_of_two_atoms);
sum_of_two_atoms(z):= not(atom(z)) and
equal(part(z,0),"+") and length(z)=2 and
atom(part(z,1))and atom(part(z,2)

then
tellsimp(pp(s),ppx(part(s,1),part(s,2));

I've been away from email, so I apologize for
joining this discussion late.
RJF

----- Original Message -----
From: Robert Dodier <robert.dodier at gmail.com>
Date: Monday, May 7, 2007 9:39 pm
Subject: Re: [Maxima] tellsimpafter issue

> On 5/7/07, Stavros Macrakis
<macrakis at alum.mit.edu> wrote:
> 
> > matchdeclare([a1,a2],atom)$
> 
> > tellsimpafter(ppp(a1+a2),ppx(a1,a2));
> > a2 + a1 partitions `sum'
> > ppp(x+y) => ppx(0, y + x)            <<<<<<<<<
ignores 
> matchdeclare of a1
> > and a2 as atoms!!!
> >       (perhaps this is just a simple bug)
> 
> That's a feature of PART+ . a2 sweeps up all the
atoms in the sum,
> and then PART+ tries to match 0 to any match
variables not yet
> assigned anything.
> 
> I'm not saying this is the best possible design,
but it is intentional
> from what i can tell.
> 
> By the way, "foo + bar partitions sum" is just an
informational
> message. It doesn't mean there's anything wrong.
> 
> > > Sorry to be vague; the code is confusing.
> >
> > Exactly, the user shouldn't have to care about
any of that. If 
> you, looking
> > at the code, can't tell what is going on, how is
the poor 
> mathematical user
> > supposed to understand it?
> 
> Well, I didn't mean to say I'm happy with this
situation.
> 
> > It would be nice to have a pattern-matching
package that was both 
> powerful> and easy to use. Unfortunately, that is
not currently the 
> case.  In the
> > meantime, it often turns out to be easier to
write one's own 
> matching> code... regrettably.
> 
> Yeah. It's really too bad about that.
> 
> Robert
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>