It is a classic question about SymPy. By default SymPy assumes that
all symbols represent arbitrary complex numbers. For the most part
only simplifications that are compatible with any complex numbers will
be applied either automatically or by explicit simplification
functions such as powsimp, simplify etc. I say "for the most part"
because some evaluation/simplification routines ignore degenerate
cases like x/x -> 1 even though x could be zero.
In this case the question is whether (1/a)^x = 1/(a^x). Suppose that a
= -1 and x = 1/2 then we have:
(1/(-1))^(1/2) = (-1)^(1/2) = i
On the other hand
1/(-1)^(1/2) = 1/i = -i
So for a = -1 and x = 1/2 we have (1/a)^x = -1/(a^x).
Recognising that 1/a = a^-1 the more general question is when will
(a^x)^y be equal to a^(x*y). If all symbols are positive or if y is an
integer then this holds but more generally it does not necessarily
hold. From first principles SymPy defines x^y as being exp(log(x)*y)
where log should be understood as having a branch cut on the negative
reals so that log(x) = log(abs(x)) + I*arg(x) and arg(x) is in
(-pi,pi]. This branch cut determines when identities like (1/a)^x =
1/a^x will hold.
--
Oscar
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/003401dae023%246da70330%2448f50990%24%40gmail.com.