Inconsistent behavior when ^ operates on an equation



Dear Richard and Barton:  Thanks for the replies!

1. In regards to Richard's question about (a=b) ^ (c=d), I would imagine the result should be consistent with what + does in this situation:

(%i1) (a=b) + (c=d);
(%o1) c+a = d+b

Right now, the present behavior for ^ is:

(%i2) (a=b) ^ (c=d);
(%o2) a^(c = d) = b^(c = d)

but presumably we would eventually want:

(%i2) (a=b) ^ (c=d);
(%o2) a^c = b^d

This makes sense since raising equal quantities to the equal powers should give equal results.  However, it seems that my suggestion is not the result obtained by mapping over one argument and then another in either order, so perhaps this case would require yet another branch.  Assuming I figure out how to fix the problem with a^(b = c), I can try to fix this one as well.

2. Or, Try map(exp, a=b) which does what you want.
more generally  map(f, expression) can apply any function f, e.g. f(r):=sin(r^3)^2.
It might be nice to show students  map and even lambda.,
e.g.  map (lambda([r],sin(r^3)^2),   expression)

Using map was an excellent suggestion, and I would be happy to introduce it earlier in the course.  Lambda, however, seems a little too advanced at this stage if the game.  We are exploring computer algebra as a prelude to programming, so the students at this point would not have even learned about user-defined functions.  At any rate, I was excited about the map solution until I realized that:

(a) It requires lambda for operators like + and ^, and

(b) it does not work with exp() in bracketed equations (like the result of a failed solve()), as in my original example.  For example:

(%i4) solve(log(x) + log(x+9) = 2*log(6));
(%o4) [log(x) = 2*log(6)-log(x+9)]
(%i5) map(exp, %);
(%o5) [%e^(log(x) = 2*log(6)-log(x+9))]

I suppose that I could introduce an index and try something like:

(%i7) solve(log(x) + log(x+9) = 2*log(6));
(%o7) [log(x) = 2*log(6)-log(x+9)]
(%i8) [map(exp, %[1])];
(%o8) [x = 36/(x+9)]

but again, the inconsistency is a little annoying (for me) and likely confusing (for my students).

3. I will have to investigate simp.lisp further to see how the issue is handled for + (which I gather is simplus) and try to imitate it for simpexpt.  Of course, I will need to understand both these function a little more than I now do?

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