The legitimity of the simplifications of poers depend on the values of the argiments and of the exponents.
This well explained in the subparagraph Powers of the sympy's simplify
documentation.
As pointed out by @tolga, the canonicalize_radical
method of symbolic expressions does some simplifications that full_simplify
doesn't. I am not sure that they are always legitimate.
BTW, from x.canonicalize_radical
:
Warning:
As shown in the examples below, a canonical form is not always
returned, i.e., two mathematically identical expressions might be
converted to different expressions.Assumptions are not taken into
account during the transformation. This may result in a branch
choice inconsistent with your assumptions.
Being a wrapper for Maxima's radcan
, canonicalize_radical
may use Sage's assumptions. However, in your case, it proceeds to simplifications without assumptions :
sage: ( (exp(p*x - q*x)/q)^(1/(p-q)) ).canonicalize_radical()
e^x/q^(1/(p - q))
EDIT : Sympy is more cautious :
sage: ( (exp(p*x - q*x)/q)^(1/(p-q)) )._sympy_().simplify()._sage_()
(e^((p - q)*x)/q)^(1/(p - q))
but does not (currently) uses Sage's assumptions :
sage: with assuming (p, q, "integer", p>q, q>0): ( (exp(p*x - q*x)/q)^(1/(p-q))
....: )._sympy_().simplify()._sage_()
(e^((p - q)*x)/q)^(1/(p - q))
HTH,
canonicalize_radical()
seems to produce better results.Here is a real-life example. I was able to get almost the desired result with a combination of
.canonicalize_radical().simplify_real()
but it somehow misses the last rather trivial step in evaluating $\frac{q}{p-q}+\frac{p-2q}{p-q}$. Weird.