Inconsistent behavior when ^ operates on an equation
Subject: Inconsistent behavior when ^ operates on an equation
From: Jorge Calvo
Date: Fri, 9 Aug 2013 15:33:05 +0000
Hello there:
I brought up a related topic a few months ago and filed a bug report (#2522) but it seems to have disappeared. I might have enough time now to do something about it but will need some pointers.
The issue came up as I was writing some notes for a class on the topic of using Maxima to do algebra. (This would come right at the beginning of the course, so I want as simple and consistent a set of instructions as possible.) As we know, there are some equations that solve() can't solve in their original form without some human assistance. As a simple example:
(%i2) solve(x^log(x) = %e);
(%o2) [x^log(x) = %e]
(%i3) log(%);
(%o3) [log(x)^2 = 1]
(%i4) solve(%);
(%o4) [x = %e^-1,x = %e]
The point is that entering log(%) is a quick way to apply log() to each side of the equation; it's much better than having to enter log(lhs(%[1]) = log(rhs(%[1])). I was experimenting with this idea and realized that many primitive operations work well this way:
(%i5) log(a = b);
(%o5) log(a) = log(b)
(%i6) sqrt(a = b);
(%o6) sqrt(a) = sqrt(b)
(%i7) (a = b)^2;
(%o7) a^2 = b^2
(%i8) (a = b) + 5;
(%o8) a+5 = b+5
(%i9) 5 + (a = b);
(%o9) a+5 = b+5
However, exponentials do not:
(%i10) exp(a = b);
(%o10) %e^(a = b)
(%i11) 2^(a=b);
(%o11) 2^(a = b)
My guess is that the problem lies with the way that ^ handles equations. As seen in (%i7), we have the correct behavior if the equation is on the lhs, but not on the rhs. I imagine that fixing ^ would automatically fix exp() as well.
Presumably the code for + can be modified for ^. I might be able to fix this if I knew where to look. However, although I know some LISP, I don't know which files need to be fixed. If someone could point me in the right direction, I would surely appreciate it!
Sincerely,
Jorge
--
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<mailto:jorge.calvo at avemaria.edu>
Web: http://sites.google.com/site/jorgealbertocalvo