log(a*b) is definitely not log(a)*log(b), so you shouldn't use that rule. But what happens is (and is the reason for the "partition" message), is that log(x*y) gets matched with
a=1
b=x*y
which is a valid match, since you have not specified any restrictions on a or b.
log(1) is zero, and therefore log(a)*log(b) --> 0 * log(x*y) --> 0.
for the second rule,
log(x*y) is transformed to log(1)+log(x*y) --> log(x*y).
the matcher in maxima is not strictly syntactic. Consider: did you want your rule to work for log(15) --> log(3)+log(5)??
or for log(x*y*z) ??
RJF
----- Original Message -----
From: Raindrop <cmoucha at raindrop.ws>
Date: Thursday, July 6, 2006 10:59 am
Subject: Problem with defrule
>
> Hello,
> I quite new to Maxima and I have a problem with the defrule function.
> I'm just testing out what's possible and what not.
> So I don't have a real goal.
> OK, now my problem:
> For example, I want to replace log(a*b) with log(a)*log(b) or with
> log(a)+log(b).
> I've tried it the following code:
> matchdeclare(a,true);
> matchdeclare(b,true);
>
> defrule(r1, log(a*b), log(a)*log(b)); in the first case or
> defrule(r2, log(a*b), log(a)+log(b)); in the second case.
>
> When I call
> apply1(log(x*y),r1);
> I only get "0" as result in the first case and in the second case
> I get back
> the log(x*y), but not my intended result.
>
> Can anybody tell me what I did wrong and how to make it right?!?!
> Thanx a lot!
>
> --
> View this message in context: http://www.nabble.com/Problem-with-
> defrule-tf1902175.html#a5204694
> Sent from the Maxima forum at Nabble.com.
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>