Using log and exp with solve



Alternatively you can map exp and log over the equations:

(%i2) eq : log(x) + log(x+9) = 2*log(6)$
(%i3) map(exp, eq);
(%o3) x*(x+9) = 36
(%i4) solve(%);
(%o4) [x = -12,x = 3]

(%i5) eq : 3^(2*x) = 3^(x^2)$
(%i6) map(log, eq);
(%o6) 2*log(3)*x = log(3)*x^2
(%i7) solve(%);
(%o7) [x = 0,x = 2]

Volker van Nek

2012/12/19 Jorge Calvo <Jorge.Calvo at avemaria.edu>:
> Hello there:
>
> I just noticed that log and exp seem to treat equations differently, and this creates (apparently) unnecessary difficulties for solve.  For example, I can use log to help out solve deal with some exponential equations:
>
> (%i2) solve(3^(2*x) = 3^(x^2));
> (%o2) [3^x^2 = 3^(2*x)]
> (%i3) log(%);
> (%o3) [log(3)*x^2 = 2*log(3)*x]
> (%i4) solve(%);
> (%o4) [x = 0,x = 2]
>
> I would like to use exp in a similar way for logarithmic equations, but instead I get:
>
> (%i5) solve(log(x) + log(x+9) = 2*log(6));
> (%o5) [log(x) = 2*log(6)-log(x+9)]
> (%i6) exp(%);
> (%o6) [%e^(log(x) = 2*log(6)-log(x+9))]
> (%i7) solve(%);
> (%o7) []
>
> The problem seems to be that
>
> log(A=B) --> log(A) = log(B)
>
> while
>
> exp(A=B) --> exp(A=B)  instead of exp(A) = exp(B).
>
> Is there a reason for this?  Could it (or should it) be fixed?
>
> Thanks!
>
> Jorge
>
> PS. Of course, I can force the desired behavior by typing exp(lhs(%[1] = rhs(%[1]) instead of exp(%), but this seems silly.  I can also do
>
> (%i8) solve(log(x) + log(x+9) = 2*log(6));
> (%o8) [log(x) = 2*log(6)-log(x+9)]
> (%i9) %-log(x);
> (%o9) [0 = -log(x+9)-log(x)+2*log(6)]
> (%i10) logcontract(%);
> (%o10) [0 = log(36/(x*(x+9)))]
> (%i11) solve(%);
> (%o11) [x = -12,x = 3]
>
> but this is working too hard.
>
> --
> Dr. Jorge Alberto Calvo
> Associate Professor of Mathematics
> Department of Mathematics and Physics
> Ave Maria University
>
> Phone: (239) 280-1608
> Email: jorge.calvo at avemaria.edu
> Web: http://sites.google.com/site/jorgealbertocalvo
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima