How to do defmatch without using matchdeclare? defmatch(anyname, x(i, l)*x(j, k))$ anyname(x(a,b)*x(c, d)) returns false always
Subject: How to do defmatch without using matchdeclare? defmatch(anyname, x(i, l)*x(j, k))$ anyname(x(a,b)*x(c, d)) returns false always
From: dp2 at cise.ufl.edu
Date: Mon, 6 Feb 2006 13:27:42 -0500 (EST)
Thanks Robert,
There is small glitch I am facing. If I am passing a variable containing
list to the matchdeclare, the rule doesnt work.
e.g.
tmplist: [a, b, c, d, e];
matchdeclare (tmplist, all);
.....
Please tell me any way to pass the list to matchdeclare, as the list is
dynamic in the program.
regards
Dileep
> Hi Dileep,
>
>
> From what you describe here, it sounds like what you
> want is defrule and not defmatch.
>
>> Lets say given: x(i, l)*x(j, k) = r(l)s(k)
>> I want to replace x(a,b)*x(c,d) in a equation with r(b)s(d) by
>> substituting l=b and k=d.
>
> Here's what I get. I'm assuming x is literally the name of
> the function in question.
>
> matchdeclare ([a, b, c, d, e], all); defrule (myrule, x(a,b)*x(c,d)*e,
> r(b)*s(d)*e);
>
> apply1 (x(i, l)*x(j, k), myrule); => r(k)*s(l) apply1
> (23*x(i+1,j-1)*x(m/2, n/2)/%pi, myrule); => 23*s(j-1)*r(n/2)/%pi
> apply1 (sin (x(i,3)*y(i,3)*x(7,j)), myrule); => sin(r(3)*y(i,3)*s(j))
>
> There seems to be ambiguity in the way you've stated the
> substitution --- x(a,b)*x(c,d) goes to r(b)s(d), so x(c,d)*x(a,b) goes to
> r(d)s(b) -- can we be sure r(d)s(b) is the same as r(b)s(d) ?
>
> hth Robert Dodier
>
>
>