1 | initial version |
Here is a longish answer that will show you a few ways to get what you want... but won't exactly answer your question.
Apparently this is what Maxima is looking for (Sage uses Maxima for its assumptions and solving).
sage: x,y,z = var('x y z')
sage: assume(x>0)
sage: assume(y>0)
sage: assume(z>0)
sage: eqn = (x == y**z)
sage: eqn
x == y^z
sage: assume(z,'integer')
sage: solve(eqn,y)
[y == x^(1/z)]
I should point out that Maxima doesn't use its assumptions that much in its solving.
But Maxima then apparently doesn't care what the answer is, as long as x>0
.
Maxima 5.22.1 http://maxima.sourceforge.net
using Lisp ECL 10.4.1
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) assume(y>0,z>0,x>0);
(%o1) [y > 0, z > 0, x > 0]
(%i2) eqn:x=y^z;
z
(%o2) x = y
(%i3) solve(eqn,y);
Is z an integer?
n;
1/z
(%o3) [y = x ]
So this could be a bug - or feature - in Maxima. Of course, such functions are in general multivalued, so depending on your context this might not really be a good answer anyway. You might instead like
(%i5) load(to_poly_solver);
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009/06/02 07:49:49 $
define: warning: redefining the built-in function prog1
define: warning: redefining the built-in function symbolcheck
define: warning: redefining the built-in function push
define: warning: redefining the built-in function pop
define: warning: redefining the built-in function tr_ev
(%o5) /Users/.../sage-4.6.2.alpha0/local/share/maxima\
/5.22.1/share/contrib/to_poly_solver.mac
(%i6) to_poly_solve(eqn,y);
2 %i %pi %z5
------------
1/z z
(%o6) %union([y = x %e ])
where %z5
is an arbitrary integer. Normally this would come from solve(eqn,y,to_poly_solve=True)
but the exception takes precedence in our current implementation.