I am trying to simplify expressions containing exponents on SymPy. However, the desired results are not returned.
This is what I have tried thus far:
import sympy as sp
a, b, c, d = sp.symbols("a b c d", real = True, positive = True)
exp1 = (a - b + c)**3
exp2 = (a - b + c)**3 - ((a - b + c)**2 - d)**sp.Rational(3, 2)
Exp1 = exp1**sp.Rational(1, 3)
print(Exp1)
Output[1]: ((a - b + c)**3)**(1/3)
The expected result for Exp1
was a - b + c
since I assumsed all the variales are positive.
Exp2 = exp2.subs(d, 0)
print(Exp2)
Output[2]: (a - b + c)**3 - (a - b + c)**2*Abs(a - b + c)
The expected result for Exp2
was 0
.
Is there a way of forcing Sympy to return the fully simplified expressions or results when the base of the exponent has more than one variable.
The following answers did not help solve my problem: