Subject: I really don't understand rules and patterns
From: Richard Fateman
Date: Tue, 02 Apr 2013 14:34:19 -0700
On 4/2/2013 2:20 PM, Daniel Lakeland wrote:
> On 04/02/2013 02:09 PM, Richard Fateman wrote:
>> Basically, On 4/2/2013 1:25 PM, Daniel Lakeland wrote:
>>> What is going on here? I want to find sums involving x,y, or z, and an
>>> index variable, i, j, k and a symbol dq and do something to them. I
>>> have rules like:
>>>
>> 1. Of all the names you could choose, perhaps you should not use x
>> twice.
>> You could say lambda([daniel], member(daniel,'[x,y,z]).
>> Not that it matters here, I think.
>
> Yes, this was quick and dirty, but as you say, it shouldn't matter
> here (I quote the list).
>
>> 2. The big issue is you are expecting Maxima to do some kind of
>> exponential exhaustive search
>> to try to match something you have in mind. It doesn't.
>>
>> If you want to partition sums and products, you can do so but not the
>> way you wrote it.
>
> This bites me every time, having programmed in prolog a bit I know
> that maxima is not doing exhaustive backtracking unification matching,
> but the problem I always have is that I can never figure out what it
> *IS* doing.
>
>> See the paper I wrote and posted a link to, about partitions.
The paper is
www.cs.berkeley.edu/~*fateman*/papers/*partition*.pdf
What pattern matching does is it picks out the coefficients of powers of
variables.
e.g. a*v^2+b*v+c .... you can pick out a,b,c if you tell the matcher
what v is.
if you try to match a^2*b^2 + other stuff, the matcher will pick a main
variable,
say a or b. It will try to match. If it can't do it that way, it will
quit (fail).
It's not prolog.
If you want unification, you can write a program that does that. Or you
can use
partitioning.
Basically, unification in an algebra system with 0, 1, factoring, etc.
is a big
loser in terms of robust control of what you are trying to program.
>
> This sounds very good, and perhaps we can make it part of the
> documentation of maxima. I will search the archives to see if I can
> find it. When I go to the pattern matching docs it never seems to help
> me with this kind of issue, it doesn't really describe the process
> that maxima is willing to carry out.
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima