'Sympy: Is there a way to apply the collect() function to exponents?
I have the following equation:
$$ f(x,y) = x^{-a} \cdot x^{-b} \cdot y^{a} \cdot y^{-b} \cdot z^{-a} $$
I want to express it as follows:
$$ f(x,y) = \left( \frac{x}{yz}\right)^{a} \cdot \left( \frac{x}{y} \right)^{b} $$
For that I tried the collect() function and the powsimp() function, among others, and I couldn't get the desired result. Is it possible to do what I want?
This is my code:
a,b = symbols('a,b', constant = True, positive=True, real=True)
x,y,z = symbols('x,y,z', positive=True, real=True)
eq = x**a * x**b * y**-a * y**-b * z**-a
collect(eq,a, exact = True)
#powsimp(eq)
Returns:
$$ x^{a+b}y^{-a-b}z^{-a} $$
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
